mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 22:25:42 +02:00
Allow mask or regex for IRC command /ignore (mask is default)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -96,15 +96,12 @@ struct t_irc_ignore *
|
||||
irc_ignore_search_by_number (int number)
|
||||
{
|
||||
struct t_irc_ignore *ptr_ignore;
|
||||
int i;
|
||||
|
||||
i = 1;
|
||||
for (ptr_ignore = irc_ignore_list; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
if (i == number)
|
||||
if (ptr_ignore->number == number)
|
||||
return ptr_ignore;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* ignore not found */
|
||||
@@ -137,6 +134,7 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
|
||||
new_ignore = malloc (sizeof (*new_ignore));
|
||||
if (new_ignore)
|
||||
{
|
||||
new_ignore->number = (last_irc_ignore) ? last_irc_ignore->number + 1 : 1;
|
||||
new_ignore->mask = strdup (mask);
|
||||
new_ignore->regex_mask = regex;
|
||||
new_ignore->server = (server) ? strdup (server) : strdup ("*");
|
||||
@@ -212,9 +210,18 @@ irc_ignore_check (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
void
|
||||
irc_ignore_free (struct t_irc_ignore *ignore)
|
||||
{
|
||||
struct t_irc_ignore *ptr_ignore;
|
||||
|
||||
weechat_hook_signal_send ("irc_ignore_removing",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, ignore);
|
||||
|
||||
/* decrement number for all ignore after this one */
|
||||
for (ptr_ignore = ignore->next_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
ptr_ignore->number--;
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (ignore->mask)
|
||||
free (ignore->mask);
|
||||
|
||||
@@ -27,6 +27,7 @@ struct t_irc_channel;
|
||||
|
||||
struct t_irc_ignore
|
||||
{
|
||||
int number; /* ignore number */
|
||||
char *mask; /* nick / host mask */
|
||||
regex_t *regex_mask; /* regex for mask */
|
||||
char *server; /* server name */
|
||||
|
||||
@@ -312,6 +312,7 @@ plugin_load (const char *filename)
|
||||
new_plugin->string_remove_quotes = &string_remove_quotes;
|
||||
new_plugin->string_strip = &string_strip;
|
||||
new_plugin->string_has_highlight = &string_has_highlight;
|
||||
new_plugin->string_mask_to_regex = &string_mask_to_regex;
|
||||
new_plugin->string_explode = &string_explode;
|
||||
new_plugin->string_free_exploded = &string_free_exploded;
|
||||
new_plugin->string_split_command = &string_split_command;
|
||||
|
||||
@@ -146,6 +146,7 @@ struct t_weechat_plugin
|
||||
const char *chars);
|
||||
int (*string_has_highlight) (const char *string,
|
||||
const char *highlight_words);
|
||||
char *(*string_mask_to_regex) (const char *mask);
|
||||
char **(*string_explode) (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max, int *num_items);
|
||||
void (*string_free_exploded) (char **exploded_string);
|
||||
@@ -616,6 +617,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
weechat_plugin->string_strip(__string, __left, __right, __chars)
|
||||
#define weechat_string_has_highlight(__string, __highlight_words) \
|
||||
weechat_plugin->string_has_highlight(__string, __highlight_words)
|
||||
#define weechat_string_mask_to_regex(__mask) \
|
||||
weechat_plugin->string_mask_to_regex(__mask)
|
||||
#define weechat_string_explode(__string, __separator, __eol, __max, \
|
||||
__num_items) \
|
||||
weechat_plugin->string_explode(__string, __separator, __eol, \
|
||||
|
||||
Reference in New Issue
Block a user