diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/irc_options.txt | 5 | ||||
-rw-r--r-- | doc/en/autogen/user/irc_options.txt | 5 | ||||
-rw-r--r-- | doc/fr/autogen/user/irc_options.txt | 5 | ||||
-rw-r--r-- | doc/it/autogen/user/irc_options.txt | 5 | ||||
-rw-r--r-- | doc/ja/autogen/user/irc_options.txt | 5 | ||||
-rw-r--r-- | po/cs.po | 10 | ||||
-rw-r--r-- | po/de.po | 10 | ||||
-rw-r--r-- | po/es.po | 10 | ||||
-rw-r--r-- | po/fr.po | 16 | ||||
-rw-r--r-- | po/hu.po | 10 | ||||
-rw-r--r-- | po/it.po | 10 | ||||
-rw-r--r-- | po/ja.po | 10 | ||||
-rw-r--r-- | po/pl.po | 10 | ||||
-rw-r--r-- | po/pt_BR.po | 10 | ||||
-rw-r--r-- | po/ru.po | 10 | ||||
-rw-r--r-- | po/tr.po | 10 | ||||
-rw-r--r-- | po/weechat.pot | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-mode.c | 69 | ||||
-rw-r--r-- | src/plugins/irc/irc-mode.h | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 17 |
23 files changed, 231 insertions, 24 deletions
@@ -64,6 +64,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * aspell: fix detection of nicks with non-alphanumeric chars * guile: disable guile gmp allocator (fix crash on unload of relay plugin) (bug #40628) +* irc: add option irc.look.smart_filter_mode (task #12499) * irc: add option irc.network.ban_mask_default (bug #26571) * irc: add option irc.network.lag_max * irc: fix ignore on a host without nick diff --git a/doc/de/autogen/user/irc_options.txt b/doc/de/autogen/user/irc_options.txt index 7ade2ce82..f4fe1ae7b 100644 --- a/doc/de/autogen/user/irc_options.txt +++ b/doc/de/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** Typ: integer ** Werte: 0 .. 10080 (Standardwert: `30`) +* [[option_irc.look.smart_filter_mode]] *irc.look.smart_filter_mode* +** Beschreibung: `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, "-bkl": filter all modes but not b/k/l` +** Typ: Zeichenkette +** Werte: beliebige Zeichenkette (Standardwert: `"ovh"`) + * [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick* ** Beschreibung: `aktiviert einen intelligenten Filter für "nick" Nachrichten (Änderungen des Nick)` ** Typ: boolesch diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt index 1c73e0cd4..7eb7a0e64 100644 --- a/doc/en/autogen/user/irc_options.txt +++ b/doc/en/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** type: integer ** values: 0 .. 10080 (default value: `30`) +* [[option_irc.look.smart_filter_mode]] *irc.look.smart_filter_mode* +** description: `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, "-bkl": filter all modes but not b/k/l` +** type: string +** values: any string (default value: `"ovh"`) + * [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick* ** description: `enable smart filter for "nick" messages (nick changes)` ** type: boolean diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt index 1478e8c7b..7d3564505 100644 --- a/doc/fr/autogen/user/irc_options.txt +++ b/doc/fr/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** type: entier ** valeurs: 0 .. 10080 (valeur par défaut: `30`) +* [[option_irc.look.smart_filter_mode]] *irc.look.smart_filter_mode* +** description: `activer le filtre intelligent pour les messages "mode": "*" pour filtrer tous les modes, "xyz" pour filtrer seulement les modes x/y/z, "-xyz" pour filtrer tous les modes sauf x/y/z; exemples: "ovh": filtrer les modes o/v/h, "-bkl": filtrer tous les modes sauf b/k/l` +** type: chaîne +** valeurs: toute chaîne (valeur par défaut: `"ovh"`) + * [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick* ** description: `activer le filtre intelligent pour les messages "nick" (changements de pseudo)` ** type: booléen diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt index 4730959e6..19b858d6c 100644 --- a/doc/it/autogen/user/irc_options.txt +++ b/doc/it/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** tipo: intero ** valori: 0 .. 10080 (valore predefinito: `30`) +* [[option_irc.look.smart_filter_mode]] *irc.look.smart_filter_mode* +** descrizione: `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, "-bkl": filter all modes but not b/k/l` +** tipo: stringa +** valori: qualsiasi stringa (valore predefinito: `"ovh"`) + * [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick* ** descrizione: `abilita filtro smart per i messaggi "nick" (cambio nick)` ** tipo: bool diff --git a/doc/ja/autogen/user/irc_options.txt b/doc/ja/autogen/user/irc_options.txt index 11a92848f..33e15966d 100644 --- a/doc/ja/autogen/user/irc_options.txt +++ b/doc/ja/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** タイプ: 整数 ** 値: 0 .. 10080 (デフォルト値: `30`) +* [[option_irc.look.smart_filter_mode]] *irc.look.smart_filter_mode* +** 説明: `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, "-bkl": filter all modes but not b/k/l` +** タイプ: 文字列 +** 値: 未制約文字列 (デフォルト値: `"ovh"`) + * [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick* ** 説明: `"nick" メッセージに対するスマートフィルタを有効化 (ニックネームの変更通知)` ** タイプ: ブール @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:39+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6561,6 +6561,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" #, fuzzy msgid "enable smart filter for \"nick\" messages (nick changes)" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:39+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -7377,6 +7377,14 @@ msgstr "" "Änderungen am Topic oder falls der Nick gewechselt wird (0 = deaktiviert: " "join-Mitteilungen bleiben verborgen)" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:39+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6821,6 +6821,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" #, fuzzy msgid "enable smart filter for \"nick\" messages (nick changes)" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" -"PO-Revision-Date: 2013-12-15 15:23+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" +"PO-Revision-Date: 2013-12-16 09:40+0100\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -7212,6 +7212,18 @@ msgstr "" "à jour du topic), le \"join\" est démasqué, tout comme les changements de " "pseudo après ce \"join\" (0 = désactiver: ne jamais démasquer un \"join\")" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" +"activer le filtre intelligent pour les messages \"mode\": \"*\" pour filtrer " +"tous les modes, \"xyz\" pour filtrer seulement les modes x/y/z, \"-xyz\" " +"pour filtrer tous les modes sauf x/y/z; exemples: \"ovh\": filtrer les modes " +"o/v/h, \"-bkl\": filtrer tous les modes sauf b/k/l" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:39+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6056,6 +6056,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" #, fuzzy msgid "enable smart filter for \"nick\" messages (nick changes)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:39+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6956,6 +6956,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "abilita filtro smart per i messaggi \"nick\" (cambio nick)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:39+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/WeeChat>\n" @@ -6891,6 +6891,14 @@ msgstr "" "ニックネームを変更したら、参加メッセージのマスクが外れます (0 = 無効: 参加" "メッセージは必ずマスクされます)" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:40+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7059,6 +7059,14 @@ msgstr "" "podobnie jak zmiany nicków po jego wejściu (0 = wyłączone: nigdy nie " "odmaskowuj)" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "włącza mądre filtrowanie dla wiadomości \"nick\" (zmiana nicka)" diff --git a/po/pt_BR.po b/po/pt_BR.po index f07c5d505..0f80237ae 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:40+0100\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6280,6 +6280,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-12-15 14:40+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6080,6 +6080,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" #, fuzzy msgid "enable smart filter for \"nick\" messages (nick changes)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-11-09 10:13+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5371,6 +5371,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index ba5e4ea6c..5864e370f 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-12-15 14:20+0100\n" +"POT-Creation-Date: 2013-12-16 09:37+0100\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5328,6 +5328,14 @@ msgid "" "never unmask a join)" msgstr "" +#. TRANSLATORS: please do not translate "mode" +msgid "" +"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, \"-bkl\": filter all modes but not b/" +"k/l" +msgstr "" + #. TRANSLATORS: please do not translate "nick" msgid "enable smart filter for \"nick\" messages (nick changes)" msgstr "" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 6b3b1f818..50e20d2da 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -99,6 +99,7 @@ struct t_config_option *irc_config_look_smart_filter; struct t_config_option *irc_config_look_smart_filter_delay; struct t_config_option *irc_config_look_smart_filter_join; struct t_config_option *irc_config_look_smart_filter_join_unmask; +struct t_config_option *irc_config_look_smart_filter_mode; struct t_config_option *irc_config_look_smart_filter_nick; struct t_config_option *irc_config_look_smart_filter_quit; struct t_config_option *irc_config_look_topic_strip_colors; @@ -2569,6 +2570,15 @@ irc_config_init () "update on topic), the join is unmasked, as well as nick changes " "after this join (0 = disable: never unmask a join)"), NULL, 0, 60*24*7, "30", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_mode = weechat_config_new_option ( + irc_config_file, ptr_section, + "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, " + "\"-bkl\": filter all modes but not b/k/l"), + NULL, 0, 0, "ovh", 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-config.h b/src/plugins/irc/irc-config.h index 0a5e13e0d..47a4ba22e 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -147,6 +147,7 @@ extern struct t_config_option *irc_config_look_smart_filter; extern struct t_config_option *irc_config_look_smart_filter_delay; extern struct t_config_option *irc_config_look_smart_filter_join; extern struct t_config_option *irc_config_look_smart_filter_join_unmask; +extern struct t_config_option *irc_config_look_smart_filter_mode; extern struct t_config_option *irc_config_look_smart_filter_nick; extern struct t_config_option *irc_config_look_smart_filter_quit; extern struct t_config_option *irc_config_look_topic_strip_colors; diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c index a3179de91..b16d9bc9a 100644 --- a/src/plugins/irc/irc-mode.c +++ b/src/plugins/irc/irc-mode.c @@ -26,6 +26,7 @@ #include "../weechat-plugin.h" #include "irc.h" #include "irc-mode.h" +#include "irc-config.h" #include "irc-server.h" #include "irc-channel.h" #include "irc-nick.h" @@ -263,21 +264,64 @@ irc_mode_channel_update (struct t_irc_server *server, } /* + * Checks if a mode is smart filtered (according to option + * irc.look.smart_filter_mode). + * + * Returns: + * 1: the mode is smart filtered + * 0: the mode is NOT smart filtered + */ + +int +irc_mode_smart_filtered (char mode) +{ + const char *ptr_modes; + + ptr_modes = weechat_config_string (irc_config_look_smart_filter_mode); + + /* if empty value, there's no smart filtering on mode messages */ + if (!ptr_modes || !ptr_modes[0]) + return 0; + + /* if var is "*", ALL modes are smart filtered */ + if (strcmp (ptr_modes, "*") == 0) + return 1; + + /* + * if var starts with "-", smart filter all modes except following modes + * example: "-kl": smart filter all modes but not k/l + */ + if (ptr_modes[0] == '-') + return (strchr (ptr_modes + 1, mode)) ? 0 : 1; + + /* + * explicit list of modes to smart filter + * example: "ovh": smart filter modes o/v/h + */ + return (strchr (ptr_modes, mode)) ? 1 : 0; +} + +/* * Sets channel modes using CHANMODES (from message 005) and update channel * modes if needed. + * + * Returns: + * 1: the mode message can be "smart filtered" + * 0: the mode message must NOT be "smart filtered" */ -void +int irc_mode_channel_set (struct t_irc_server *server, struct t_irc_channel *channel, const char *modes) { char *pos_args, *str_modes, set_flag, **argv, *pos, *ptr_arg, chanmode_type; int argc, current_arg, update_channel_modes, channel_modes_updated; + int smart_filter; struct t_irc_nick *ptr_nick; if (!server || !channel || !modes) - return; + return 0; channel_modes_updated = 0; argc = 0; @@ -287,7 +331,7 @@ irc_mode_channel_set (struct t_irc_server *server, { str_modes = weechat_strndup (modes, pos_args - modes); if (!str_modes) - return; + return 0; pos_args++; while (pos_args[0] == ' ') pos_args++; @@ -297,11 +341,15 @@ irc_mode_channel_set (struct t_irc_server *server, { str_modes = strdup (modes); if (!str_modes) - return; + return 0; } current_arg = 0; + smart_filter = (weechat_config_boolean (irc_config_look_smart_filter) + && weechat_config_string (irc_config_look_smart_filter_mode) + && weechat_config_string (irc_config_look_smart_filter_mode)[0]) ? 1 : 0; + if (str_modes && str_modes[0]) { set_flag = '+'; @@ -344,6 +392,9 @@ irc_mode_channel_set (struct t_irc_server *server, if (ptr_arg) current_arg++; + if (smart_filter && !irc_mode_smart_filtered (pos[0])) + smart_filter = 0; + if (pos[0] == 'k') { /* channel key */ @@ -388,6 +439,14 @@ irc_mode_channel_set (struct t_irc_server *server, { irc_nick_set_mode (server, channel, ptr_nick, (set_flag == '+'), pos[0]); + if (smart_filter + && irc_channel_nick_speaking_time_search (server, + channel, + ptr_nick->name, + 1)) + { + smart_filter = 0; + } } } } @@ -410,6 +469,8 @@ irc_mode_channel_set (struct t_irc_server *server, if (channel_modes_updated) weechat_bar_item_update ("buffer_modes"); + + return smart_filter; } /* diff --git a/src/plugins/irc/irc-mode.h b/src/plugins/irc/irc-mode.h index 28c570bed..140a98b04 100644 --- a/src/plugins/irc/irc-mode.h +++ b/src/plugins/irc/irc-mode.h @@ -23,9 +23,9 @@ struct t_irc_server; struct t_irc_channel; -extern void irc_mode_channel_set (struct t_irc_server *server, - struct t_irc_channel *channel, - const char *modes); +extern int irc_mode_channel_set (struct t_irc_server *server, + struct t_irc_channel *channel, + const char *modes); extern void irc_mode_user_set (struct t_irc_server *server, const char *modes, int reset_modes); diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 3aa8844ad..cf0735b24 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -848,6 +848,7 @@ IRC_PROTOCOL_CALLBACK(kill) IRC_PROTOCOL_CALLBACK(mode) { char *pos_modes; + int smart_filter, local_mode; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; struct t_gui_buffer *ptr_buffer; @@ -859,16 +860,24 @@ IRC_PROTOCOL_CALLBACK(mode) if (irc_channel_is_channel (server, argv[2])) { + smart_filter = 0; ptr_channel = irc_channel_search (server, argv[2]); if (ptr_channel) - irc_mode_channel_set (server, ptr_channel, pos_modes); + { + smart_filter = irc_mode_channel_set (server, ptr_channel, + pos_modes); + } + local_mode = (irc_server_strcasecmp (server, nick, server->nick) == 0); ptr_nick = irc_nick_search (server, ptr_channel, nick); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, ptr_buffer), date, - irc_protocol_tags (command, NULL, NULL), + irc_protocol_tags (command, + (smart_filter && !local_mode) ? + "irc_smart_filter" : NULL, + NULL), _("%sMode %s%s %s[%s%s%s]%s by %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, @@ -2923,8 +2932,8 @@ IRC_PROTOCOL_CALLBACK(324) irc_channel_set_modes (ptr_channel, ((argc > 4) ? argv_eol[4] : NULL)); if (argc > 4) { - irc_mode_channel_set (server, ptr_channel, - ptr_channel->modes); + (void) irc_mode_channel_set (server, ptr_channel, + ptr_channel->modes); } } weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, |