summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-09-03 18:20:35 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-09-03 18:20:35 +0200
commite43dd396469ce3b2bd6dd598f7720fc5ce179d44 (patch)
treeefbaa96d528fb36944a37a206290e693c90a7dff /src/core
parent909d123692a3bcf4694f341af7db55bb9496aba7 (diff)
downloadweechat-e43dd396469ce3b2bd6dd598f7720fc5ce179d44.zip
Reintroduce /ignore command to ignore IRC nicks/hosts, using regex
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-command.c65
1 files changed, 45 insertions, 20 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 8f8d078ef..579954436 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -302,7 +302,7 @@ command_bar (void *data, struct t_gui_buffer *buffer,
if (string_strcasecmp (argv[2], "-all") == 0)
{
gui_bar_free_all ();
- gui_chat_printf (NULL, _("All bars deleted"));
+ gui_chat_printf (NULL, _("All bars have been deleted"));
//gui_bar_create_default ();
}
else
@@ -891,9 +891,17 @@ command_filter (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_ERROR;
}
- gui_filter_new (argv[2], argv[3], argv_eol[4]);
- gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
- _("Filter added"));
+ if (gui_filter_new (argv[2], argv[3], argv_eol[4]))
+ {
+ gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
+ _("Filter added"));
+ }
+ else
+ {
+ gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
+ _("%sError adding filter"),
+ gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
+ }
return WEECHAT_RC_OK;
}
@@ -910,33 +918,49 @@ command_filter (void *data, struct t_gui_buffer *buffer,
"filter del");
return WEECHAT_RC_ERROR;
}
- error = NULL;
- number = strtol (argv[2], &error, 10);
- if (error && !error[0])
+ if (string_strcasecmp (argv[2], "-all") == 0)
{
- ptr_filter = gui_filter_search_by_number (number);
- if (ptr_filter)
+ if (gui_filters)
{
- gui_filter_free (ptr_filter);
+ gui_filter_free_all ();
gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
- _("Filter deleted"));
+ _("All filters have been deleted"));
}
else
{
gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
- _("%sError: filter not found"),
- gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
- return WEECHAT_RC_ERROR;
+ _("No message filter defined"));
}
}
else
{
- gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
- _("%sError: wrong filter number"),
- gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
- return WEECHAT_RC_ERROR;
+ error = NULL;
+ number = strtol (argv[2], &error, 10);
+ if (error && !error[0])
+ {
+ ptr_filter = gui_filter_search_by_number (number);
+ if (ptr_filter)
+ {
+ gui_filter_free (ptr_filter);
+ gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
+ _("Filter deleted"));
+ }
+ else
+ {
+ gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
+ _("%sError: filter not found"),
+ gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
+ return WEECHAT_RC_ERROR;
+ }
+ }
+ else
+ {
+ gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
+ _("%sError: wrong filter number"),
+ gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
+ return WEECHAT_RC_ERROR;
+ }
}
-
return WEECHAT_RC_OK;
}
@@ -2816,7 +2840,7 @@ command_init ()
"to tags or regex"),
N_("[list] | [enable|disable|toggle] | "
"[add buffer tags regex] | "
- "[del number]"),
+ "[del number|-all]"),
N_(" list: list all filters\n"
" enable: enable filters (filters are enabled by "
"default)\n"
@@ -2826,6 +2850,7 @@ command_init ()
" del: delete a filter\n"
" number: number of filter to delete (look at list to "
"find it)\n"
+ " -all: delete all filters\n"
" buffer: buffer where filter is active: it may be "
"a name (category.name) or \"*\" for all buffers\n"
" tags: comma separated list of tags, for "