feature: /ignore command

Like it's already implemented in irc plugin, this commit adds the /ignore command. Now you can filter messages in group chats to not be shown, based on a part of Tox ID. The ignore list of IDs is manageable in this way:
[tox]  /ignore  list
                add <ID part>
                del <ID part>

ommit messages from people with certain Tox IDs

list: show the list of ignores
add: add an ID to the list
del: delete an ID from the list
This commit is contained in:
nogaems 2019-03-27 06:33:29 +03:00
parent fe5589432d
commit 5c8f9bc239
No known key found for this signature in database
GPG key ID: 91316FB98FDBB08B
9 changed files with 290 additions and 16 deletions

View file

@ -276,6 +276,23 @@ twc_get_next_completion(struct t_weelist *completion_list,
return comp;
}
/**
* Checks if an ID is ignored.
*/
bool
twc_is_id_ignored(struct t_twc_profile *profile, const char *short_id)
{
struct t_weelist_item *ignore_item;
for (ignore_item = weechat_list_get(profile->ignores, 0); ignore_item;
ignore_item = weechat_list_next(ignore_item))
{
if (!weechat_strncasecmp(short_id, weechat_list_string(ignore_item),
strlen(weechat_list_string(ignore_item))))
return true;
}
return false;
}
/**
* reverse the bytes of a 32-bit integer.
*/