diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-06-14 09:53:07 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-06-14 09:53:07 +0200 |
commit | dfb6516a11a053150d69e8c3957f607293065ba9 (patch) | |
tree | 27099f62544a867af00546b82ced70c30905da3b /src | |
parent | 21c5583c3b5d1e6d05b97da4ec6f492bfcea8b2a (diff) | |
download | weechat-dfb6516a11a053150d69e8c3957f607293065ba9.zip |
irc: add value "+" for option irc.look.smart_filter_mode to use modes from server prefixes (closes #90)
The new default value of option irc.look.smart_filter_mode is now "+".
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-config.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-mode.c | 13 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 19c835876..be0d5cbc4 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -2660,10 +2660,11 @@ irc_config_init () "smart_filter_mode", "string", /* TRANSLATORS: please do not translate "mode" */ N_("enable smart filter for \"mode\" messages: \"*\" to filter all " - "modes, \"xyz\" to filter only modes x/y/z, \"-xyz\" to filter all " - "modes but not x/y/z; examples: \"ovh\": filter modes o/v/h, " + "modes, \"+\" to filter all modes in server prefixes (for example " + "\"ovh\"), \"xyz\" to filter only modes x/y/z, \"-xyz\" to filter " + "all modes but not x/y/z; examples: \"ovh\": filter modes o/v/h, " "\"-bkl\": filter all modes but not b/k/l"), - NULL, 0, 0, "ovh", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "+", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_smart_filter_nick = weechat_config_new_option ( irc_config_file, ptr_section, "smart_filter_nick", "boolean", diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c index b0b9230fb..b641fcf08 100644 --- a/src/plugins/irc/irc-mode.c +++ b/src/plugins/irc/irc-mode.c @@ -265,7 +265,7 @@ irc_mode_channel_update (struct t_irc_server *server, /* * Checks if a mode is smart filtered (according to option - * irc.look.smart_filter_mode). + * irc.look.smart_filter_mode and server prefix modes). * * Returns: * 1: the mode is smart filtered @@ -273,7 +273,7 @@ irc_mode_channel_update (struct t_irc_server *server, */ int -irc_mode_smart_filtered (char mode) +irc_mode_smart_filtered (struct t_irc_server *server, char mode) { const char *ptr_modes; @@ -287,6 +287,10 @@ irc_mode_smart_filtered (char mode) if (strcmp (ptr_modes, "*") == 0) return 1; + /* if var is "+", modes from server prefixes are filtered */ + if (strcmp (ptr_modes, "+") == 0) + return strchr (irc_server_get_prefix_modes (server), mode) ? 1 : 0; + /* * if var starts with "-", smart filter all modes except following modes * example: "-kl": smart filter all modes but not k/l @@ -392,8 +396,11 @@ irc_mode_channel_set (struct t_irc_server *server, if (ptr_arg) current_arg++; - if (smart_filter && !irc_mode_smart_filtered (pos[0])) + if (smart_filter + && !irc_mode_smart_filtered (server, pos[0])) + { smart_filter = 0; + } if (pos[0] == 'k') { |