summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--doc/de/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/de/autogen/user/irc_options.txt7
-rw-r--r--doc/en/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/en/autogen/user/irc_options.txt7
-rw-r--r--doc/fr/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/fr/autogen/user/irc_options.txt7
-rw-r--r--doc/it/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/it/autogen/user/irc_options.txt7
-rw-r--r--doc/ja/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/ja/autogen/user/irc_options.txt7
-rw-r--r--po/cs.po13
-rw-r--r--po/de.po13
-rw-r--r--po/es.po13
-rw-r--r--po/fr.po32
-rw-r--r--po/hu.po12
-rw-r--r--po/it.po13
-rw-r--r--po/ja.po13
-rw-r--r--po/pl.po13
-rw-r--r--po/pt_BR.po12
-rw-r--r--po/ru.po12
-rw-r--r--po/weechat.pot12
-rw-r--r--src/plugins/irc/irc-channel.c260
-rw-r--r--src/plugins/irc/irc-channel.h11
-rw-r--r--src/plugins/irc/irc-config.c12
-rw-r--r--src/plugins/irc/irc-config.h1
-rw-r--r--src/plugins/irc/irc-protocol.c64
-rw-r--r--src/plugins/irc/irc-server.c56
-rw-r--r--src/plugins/irc/irc-upgrade.c38
29 files changed, 585 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index bd980cdf2..11ea60dec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,8 @@ Version 0.4.1 (under dev!)
* aspell: add info "aspell_dict" (dictionaries used on a buffer)
* aspell: optimization on spellers to improve speed (save state by buffer)
* guile: fix compilation with guile 2.0
+* irc: unmask smart filtered join if nick speaks in channel some minutes after
+ the join, new option irc.look.smart_filter_join_unmask (task #12405)
* irc: fix memory leak in purge of hashtables with joins (it was done only for
the first server in the list)
* irc: add color in output of /names when result is on server buffer (channel
diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt
index f05e485cf..c5befdb1b 100644
--- a/doc/de/autogen/plugin_api/hdata.txt
+++ b/doc/de/autogen/plugin_api/hdata.txt
@@ -42,6 +42,7 @@
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer, hdata: "irc_channel_speaking") +
'last_nick_speaking_time' (pointer, hdata: "irc_channel_speaking") +
+ 'join_smart_filtered' (hashtable) +
'buffer' (pointer, hdata: "buffer") +
'buffer_as_string' (string) +
'prev_channel' (pointer, hdata: "irc_channel") +
diff --git a/doc/de/autogen/user/irc_options.txt b/doc/de/autogen/user/irc_options.txt
index 76e6a00b9..142bc19f1 100644
--- a/doc/de/autogen/user/irc_options.txt
+++ b/doc/de/autogen/user/irc_options.txt
@@ -303,8 +303,13 @@
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
+* [[option_irc.look.smart_filter_join_unmask]] *irc.look.smart_filter_join_unmask*
+** Beschreibung: `delay for unmasking a join message that was filtered with tag "irc_smart_filter" (in minutes): if a nick jas joined max N minutes ago and then says something on channel (message, notice or update on topic), the join is unmasked, as well as nick changes after this join (0 = disable: never unmask a join)`
+** Typ: integer
+** Werte: 0 .. 10080 (Standardwert: `30`)
+
* [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick*
-** Beschreibung: `aktiviert einen intelligenten Filter für Nachrichten von einem "Nick"`
+** Beschreibung: `enable smart filter for "nick" messages (nick changes)`
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt
index ba73ebae1..c1edfb464 100644
--- a/doc/en/autogen/plugin_api/hdata.txt
+++ b/doc/en/autogen/plugin_api/hdata.txt
@@ -42,6 +42,7 @@
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer, hdata: "irc_channel_speaking") +
'last_nick_speaking_time' (pointer, hdata: "irc_channel_speaking") +
+ 'join_smart_filtered' (hashtable) +
'buffer' (pointer, hdata: "buffer") +
'buffer_as_string' (string) +
'prev_channel' (pointer, hdata: "irc_channel") +
diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt
index 6462c0ae2..6b5cd5800 100644
--- a/doc/en/autogen/user/irc_options.txt
+++ b/doc/en/autogen/user/irc_options.txt
@@ -303,8 +303,13 @@
** type: boolean
** values: on, off (default value: `on`)
+* [[option_irc.look.smart_filter_join_unmask]] *irc.look.smart_filter_join_unmask*
+** description: `delay for unmasking a join message that was filtered with tag "irc_smart_filter" (in minutes): if a nick jas joined max N minutes ago and then says something on channel (message, notice or update on topic), the join is unmasked, as well as nick changes after this join (0 = disable: never unmask a join)`
+** type: integer
+** values: 0 .. 10080 (default value: `30`)
+
* [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick*
-** description: `enable smart filter for "nick" messages`
+** description: `enable smart filter for "nick" messages (nick changes)`
** type: boolean
** values: on, off (default value: `on`)
diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt
index a56613426..f7e0719f7 100644
--- a/doc/fr/autogen/plugin_api/hdata.txt
+++ b/doc/fr/autogen/plugin_api/hdata.txt
@@ -42,6 +42,7 @@
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer, hdata: "irc_channel_speaking") +
'last_nick_speaking_time' (pointer, hdata: "irc_channel_speaking") +
+ 'join_smart_filtered' (hashtable) +
'buffer' (pointer, hdata: "buffer") +
'buffer_as_string' (string) +
'prev_channel' (pointer, hdata: "irc_channel") +
diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt
index a3cddf431..7fb0545d2 100644
--- a/doc/fr/autogen/user/irc_options.txt
+++ b/doc/fr/autogen/user/irc_options.txt
@@ -303,8 +303,13 @@
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
+* [[option_irc.look.smart_filter_join_unmask]] *irc.look.smart_filter_join_unmask*
+** description: `délai pour démasquer un message "join" qui a été filtré avec l'étiquette "irc_smart_filter" (en minutes): si le pseudo a rejoint au maximum il y a N minutes et qu'il a dit quelque chose sur le canal (message, notice ou mise à 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")`
+** type: entier
+** valeurs: 0 .. 10080 (valeur par défaut: `30`)
+
* [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick*
-** description: `activer le filtre intelligent pour les messages "nick"`
+** description: `activer le filtre intelligent pour les messages "nick" (changements de pseudo)`
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt
index bb2792e94..c2a2ac6f3 100644
--- a/doc/it/autogen/plugin_api/hdata.txt
+++ b/doc/it/autogen/plugin_api/hdata.txt
@@ -42,6 +42,7 @@
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer, hdata: "irc_channel_speaking") +
'last_nick_speaking_time' (pointer, hdata: "irc_channel_speaking") +
+ 'join_smart_filtered' (hashtable) +
'buffer' (pointer, hdata: "buffer") +
'buffer_as_string' (string) +
'prev_channel' (pointer, hdata: "irc_channel") +
diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt
index 952a3a74d..6a6210d1d 100644
--- a/doc/it/autogen/user/irc_options.txt
+++ b/doc/it/autogen/user/irc_options.txt
@@ -303,8 +303,13 @@
** tipo: bool
** valori: on, off (valore predefinito: `on`)
+* [[option_irc.look.smart_filter_join_unmask]] *irc.look.smart_filter_join_unmask*
+** descrizione: `delay for unmasking a join message that was filtered with tag "irc_smart_filter" (in minutes): if a nick jas joined max N minutes ago and then says something on channel (message, notice or update on topic), the join is unmasked, as well as nick changes after this join (0 = disable: never unmask a join)`
+** tipo: intero
+** valori: 0 .. 10080 (valore predefinito: `30`)
+
* [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick*
-** descrizione: `abilita filtro smart per i messaggi "nick"`
+** descrizione: `enable smart filter for "nick" messages (nick changes)`
** tipo: bool
** valori: on, off (valore predefinito: `on`)
diff --git a/doc/ja/autogen/plugin_api/hdata.txt b/doc/ja/autogen/plugin_api/hdata.txt
index f594fc30d..56c0df846 100644
--- a/doc/ja/autogen/plugin_api/hdata.txt
+++ b/doc/ja/autogen/plugin_api/hdata.txt
@@ -42,6 +42,7 @@
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer, hdata: "irc_channel_speaking") +
'last_nick_speaking_time' (pointer, hdata: "irc_channel_speaking") +
+ 'join_smart_filtered' (hashtable) +
'buffer' (pointer, hdata: "buffer") +
'buffer_as_string' (string) +
'prev_channel' (pointer, hdata: "irc_channel") +
diff --git a/doc/ja/autogen/user/irc_options.txt b/doc/ja/autogen/user/irc_options.txt
index 08e53d9f9..9c5360366 100644
--- a/doc/ja/autogen/user/irc_options.txt
+++ b/doc/ja/autogen/user/irc_options.txt
@@ -303,8 +303,13 @@
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)
+* [[option_irc.look.smart_filter_join_unmask]] *irc.look.smart_filter_join_unmask*
+** 説明: `delay for unmasking a join message that was filtered with tag "irc_smart_filter" (in minutes): if a nick jas joined max N minutes ago and then says something on channel (message, notice or update on topic), the join is unmasked, as well as nick changes after this join (0 = disable: never unmask a join)`
+** タイプ: 整数
+** 値: 0 .. 10080 (デフォルト値: `30`)
+
* [[option_irc.look.smart_filter_nick]] *irc.look.smart_filter_nick*
-** 説明: `"nick" メッセージのスマートフィルタを有効化`
+** 説明: `enable smart filter for "nick" messages (nick changes)`
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)
diff --git a/po/cs.po b/po/cs.po
index ee1916fa5..94a789f8d 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:07+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6066,12 +6066,21 @@ msgstr "zpoždění pro filtrování zpráv join/part/quit (v minutách)"
msgid "enable smart filter for \"join\" messages"
msgstr "povolit chytrý filter pro \"join\" zprávy"
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr "povolit chytrý filter pro \"part\" a \"quit\" zprávy"
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+#, fuzzy
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "povolit chytrý filter pro \"nick\" zprávy"
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/de.po b/po/de.po
index 08c398be3..b0c93f089 100644
--- a/po/de.po
+++ b/po/de.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:07+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -6692,13 +6692,22 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr "aktiviert einen intelligenten Filter für \"join\" Nachrichten"
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr ""
"aktiviert einen intelligenten Filter für \"part\" und \"quit\" Nachrichten"
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+#, fuzzy
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr ""
"aktiviert einen intelligenten Filter für Nachrichten von einem \"Nick\""
diff --git a/po/es.po b/po/es.po
index 2b9845442..efee52ae2 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:07+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6312,12 +6312,21 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr "habilitar el filtro inteligente para mensajes \"join\""
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr "habilitar el filtro inteligente para mensajes \"part\" y \"quit\""
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+#, fuzzy
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "habilitar el filtro inteligente para mensajes \"nick\""
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/fr.po b/po/fr.po
index 1e0ebcc16..457f5fd3a 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
-"PO-Revision-Date: 2013-02-14 20:41+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
+"PO-Revision-Date: 2013-02-17 12:18+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -1227,12 +1227,15 @@ msgstr ""
" set: définir le niveau de debug pour l'extension\n"
"extension: nom de l'extension (\"core\" pour le coeur de WeeChat)\n"
" niveau: niveau de debug pour l'extension\n"
-" dump: afficher les variables mémoire WeeChat dans le fichier log (les mêmes messages sont affichés lorsque WeeChat plante)\n"
-" buffer: afficher le contenu du tampon en valeurs hexadécimales dans le fichier log\n"
+" dump: afficher les variables mémoire WeeChat dans le fichier log (les "
+"mêmes messages sont affichés lorsque WeeChat plante)\n"
+" buffer: afficher le contenu du tampon en valeurs hexadécimales dans le "
+"fichier log\n"
" color: afficher des infos sur les paires de couleur courantes\n"
" cursor: activer/désactiver le debug pour le mode curseur\n"
" dirs: afficher les répertoires\n"
-" hdata: afficher des infos sur les hdata (avec free: supprimer tous les hdata en mémoire)\n"
+" hdata: afficher des infos sur les hdata (avec free: supprimer tous les "
+"hdata en mémoire)\n"
" hooks: afficher des infos sur les hooks\n"
"infolists: afficher des infos sur les infolists\n"
" memory: afficher des infos sur l'utilisation de la mémoire\n"
@@ -6504,13 +6507,28 @@ msgstr "délai pour filtrer les messages join/part/quit (en minutes)"
msgid "enable smart filter for \"join\" messages"
msgstr "activer le filtre intelligent pour les messages \"join\""
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+"délai pour démasquer un message \"join\" qui a été filtré avec l'étiquette "
+"\"irc_smart_filter\" (en minutes): si le pseudo a rejoint au maximum il y a "
+"N minutes et qu'il a dit quelque chose sur le canal (message, notice ou mise "
+"à 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 "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr "activer le filtre intelligent pour les messages \"part\" et \"quit\""
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
-msgstr "activer le filtre intelligent pour les messages \"nick\""
+msgid "enable smart filter for \"nick\" messages (nick changes)"
+msgstr ""
+"activer le filtre intelligent pour les messages \"nick\" (changements de "
+"pseudo)"
msgid "strip colors in topic (used only when displaying buffer title)"
msgstr ""
diff --git a/po/hu.po b/po/hu.po
index 7b71392a1..6d3ef5803 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:07+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5606,13 +5606,21 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr "új üzenetet tartalmazó ablak színe"
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr ""
#. TRANSLATORS: please do not translate "nick"
#, fuzzy
-msgid "enable smart filter for \"nick\" messages"
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "új üzenetet tartalmazó ablak színe"
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/it.po b/po/it.po
index 4ad213f91..8e0ec6348 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-02-03 12:13+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6328,6 +6328,14 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr "abilita filtro smart per i messaggi \"join\" (entrata)"
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr ""
@@ -6335,7 +6343,8 @@ msgstr ""
"(disconnessione)"
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+#, fuzzy
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "abilita filtro smart per i messaggi \"nick\""
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/ja.po b/po/ja.po
index b94bd7e5d..35c7f8257 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:07+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -6276,12 +6276,21 @@ msgstr "参加/退出/終了 メッセージのフィルタリングを遅らせ
msgid "enable smart filter for \"join\" messages"
msgstr "\"join\" メッセージのスマートフィルタを有効化"
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr "\"part\" と \"quit\" メッセージのスマートフィルタを有効化"
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+#, fuzzy
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "\"nick\" メッセージのスマートフィルタを有効化"
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/pl.po b/po/pl.po
index d8462f6eb..2839d54e3 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -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-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:08+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6404,12 +6404,21 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr "włącza mądre filtrowanie dla wiadomości \"join\""
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr "włącza inteligentne filtrowanie dla wiadomości \"part\" oraz \"quit\""
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+#, fuzzy
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "włącza mądre filtrowanie dla wiadomości \"nick\""
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 473d5689c..5b10ebc5d 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -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-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:08+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5782,12 +5782,20 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr ""
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr ""
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr ""
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/ru.po b/po/ru.po
index d783a20df..5daec0ecc 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -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-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+0100\n"
"PO-Revision-Date: 2013-01-20 12:08+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5625,13 +5625,21 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr "цвет текущего окна с сообщениями"
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr ""
#. TRANSLATORS: please do not translate "nick"
#, fuzzy
-msgid "enable smart filter for \"nick\" messages"
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr "цвет текущего окна с сообщениями"
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/po/weechat.pot b/po/weechat.pot
index 048a51259..6d19ba114 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-02-14 20:40+0100\n"
+"POT-Creation-Date: 2013-02-17 12:17+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"
@@ -4883,12 +4883,20 @@ msgstr ""
msgid "enable smart filter for \"join\" messages"
msgstr ""
+msgid ""
+"delay for unmasking a join message that was filtered with tag "
+"\"irc_smart_filter\" (in minutes): if a nick jas joined max N minutes ago "
+"and then says something on channel (message, notice or update on topic), the "
+"join is unmasked, as well as nick changes after this join (0 = disable: "
+"never unmask a join)"
+msgstr ""
+
#. TRANSLATORS: please do not translate "part" and "quit"
msgid "enable smart filter for \"part\" and \"quit\" messages"
msgstr ""
#. TRANSLATORS: please do not translate "nick"
-msgid "enable smart filter for \"nick\" messages"
+msgid "enable smart filter for \"nick\" messages (nick changes)"
msgstr ""
msgid "strip colors in topic (used only when displaying buffer title)"
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index f9366a5c2..a26a1b19a 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -293,6 +293,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
new_channel->nicks_speaking[1] = NULL;
new_channel->nicks_speaking_time = NULL;
new_channel->last_nick_speaking_time = NULL;
+ new_channel->join_smart_filtered = NULL;
new_channel->buffer = new_buffer;
new_channel->buffer_as_string = NULL;
@@ -721,6 +722,254 @@ irc_channel_nick_speaking_time_rename (struct t_irc_server *server,
}
/*
+ * Adds a nick in hashtable "join_smart_filtered" (creates the hashtable if
+ * needed).
+ */
+
+void
+irc_channel_join_smart_filtered_add (struct t_irc_channel *channel,
+ const char *nick,
+ time_t join_time)
+{
+ /* return if unmasking of smart filtered joins is disabled */
+ if (weechat_config_integer (irc_config_look_smart_filter_join_unmask) == 0)
+ return;
+
+ /* create hashtable if needed */
+ if (!channel->join_smart_filtered)
+ {
+ channel->join_smart_filtered = weechat_hashtable_new (64,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_TIME,
+ NULL,
+ NULL);
+ }
+ if (!channel->join_smart_filtered)
+ return;
+
+ weechat_hashtable_set (channel->join_smart_filtered, nick, &join_time);
+}
+
+/*
+ * Renames a nick in hashtable "join_smart_filtered".
+ */
+
+void
+irc_channel_join_smart_filtered_rename (struct t_irc_channel *channel,
+ const char *old_nick,
+ const char *new_nick)
+{
+ time_t *ptr_time, join_time;
+
+ /* return if hashtable does not exist in channel */
+ if (!channel->join_smart_filtered)
+ return;
+
+ /* search old_nick in hashtable */
+ ptr_time = weechat_hashtable_get (channel->join_smart_filtered, old_nick);
+ if (!ptr_time)
+ return;
+
+ /* remove old_nick, add new_nick with time of old_nick */
+ join_time = *ptr_time;
+ weechat_hashtable_remove (channel->join_smart_filtered, old_nick);
+ weechat_hashtable_set (channel->join_smart_filtered, new_nick, &join_time);
+}
+
+/*
+ * Removes a nick in hashtable "join_smart_filtered".
+ */
+
+void
+irc_channel_join_smart_filtered_remove (struct t_irc_channel *channel,
+ const char *nick)
+{
+ /* return if hashtable does not exist in channel */
+ if (!channel->join_smart_filtered)
+ return;
+
+ weechat_hashtable_remove (channel->join_smart_filtered, nick);
+}
+
+/*
+ * Unmasks a smart filtered join if nick is in hashtable "join_smart_filtered",
+ * then removes nick from hashtable.
+ */
+
+void
+irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
+ const char *nick)
+{
+ int i, unmask_delay, length_tags, nick_found, join, nick_changed;
+ int smart_filtered, remove_smart_filter;
+ time_t *ptr_time, date_min;
+ struct t_hdata *hdata_line, *hdata_line_data;
+ struct t_gui_line *own_lines;
+ struct t_gui_line *line;
+ struct t_gui_line_data *line_data;
+ const char **tags, *irc_nick1, *irc_nick2;
+ char *new_tags, *nick_to_search;
+ struct t_hashtable *hashtable;
+
+ /* return if hashtable does not exist in channel */
+ if (!channel->join_smart_filtered)
+ return;
+
+ /* return if unmasking of smart filtered joins is disabled */
+ unmask_delay = weechat_config_integer (irc_config_look_smart_filter_join_unmask);
+ if (unmask_delay == 0)
+ return;
+
+ /* check if nick is in hashtable "join_smart_filtered" */
+ ptr_time = weechat_hashtable_get (channel->join_smart_filtered, nick);
+ if (!ptr_time)
+ return;
+
+ /*
+ * the min date allowed to unmask a join (a join older than this date will
+ * not be unmasked)
+ */
+ date_min = time (NULL) - (unmask_delay * 60);
+
+ /*
+ * if the join is too old (older than current time - unmask delay), just
+ * remove nick from hashtable and return
+ */
+ if (*ptr_time < date_min)
+ {
+ weechat_hashtable_remove (channel->join_smart_filtered, nick);
+ return;
+ }
+
+ /* get hdata and pointers on last line in buffer */
+ own_lines = weechat_hdata_pointer (weechat_hdata_get ("buffer"),
+ channel->buffer, "own_lines");
+ if (!own_lines)
+ return;
+ line = weechat_hdata_pointer (weechat_hdata_get ("lines"),
+ own_lines, "last_line");
+ if (!line)
+ return;
+ hdata_line = weechat_hdata_get ("line");
+ hdata_line_data = weechat_hdata_get ("line_data");
+
+ /* the nick to search in messages (track nick changes) */
+ nick_to_search = strdup (nick);
+ if (!nick_to_search)
+ return;
+
+ /* loop on lines until we find the join */
+ while (line)
+ {
+ line_data = weechat_hdata_pointer (hdata_line, line, "data");
+ if (!line_data)
+ break;
+
+ /* exit loop if we reach the unmask delay */
+ if (weechat_hdata_time (hdata_line_data, line_data, "date_printed") < date_min)
+ break;
+
+ /* check tags in line */
+ length_tags = 0;
+ nick_found = 0;
+ join = 0;
+ nick_changed = 0;
+ irc_nick1 = NULL;
+ irc_nick2 = NULL;
+ smart_filtered = 0;
+ tags = weechat_hdata_pointer (hdata_line_data, line_data, "tags_array");
+ for (i = 0; tags[i]; i++)
+ {
+ if (strncmp (tags[i], "nick_", 5) == 0)
+ {
+ if (strcmp (tags[i] + 5, nick_to_search) == 0)
+ nick_found = 1;
+ }
+ else if (strcmp (tags[i], "irc_join") == 0)
+ join = 1;
+ else if (strcmp (tags[i], "irc_nick") == 0)
+ nick_changed = 1;
+ else if (strncmp (tags[i], "irc_nick1_", 10) == 0)
+ irc_nick1 = tags[i] + 10;
+ else if (strncmp (tags[i], "irc_nick2_", 10) == 0)
+ irc_nick2 = tags[i] + 10;
+ else if (strcmp (tags[i], "irc_smart_filter") == 0)
+ smart_filtered = 1;
+ length_tags += strlen (tags[i]) + 1;
+ }
+
+ /* check if we must remove tag "irc_smart_filter" in line */
+ remove_smart_filter = 0;
+ if (nick_changed && irc_nick1 && irc_nick2
+ && (strcmp (irc_nick2, nick_to_search) == 0))
+ {
+ /* update the nick to search if the line is a message "nick" */
+ free (nick_to_search);
+ nick_to_search = strdup (irc_nick1);
+ if (!nick_to_search)
+ break;
+ remove_smart_filter = 1;
+ }
+ else if (nick_found && join && smart_filtered)
+ {
+ remove_smart_filter = 1;
+ }
+
+ if (remove_smart_filter)
+ {
+ /*
+ * unmask a "nick" or "join" message: remove the tag
+ * "irc_smart_filter"
+ */
+ new_tags = malloc (length_tags);
+ if (new_tags)
+ {
+ /* build a string with all tags, except "irc_smart_filter" */
+ new_tags[0] = '\0';
+ for (i = 0; tags[i]; i++)
+ {
+ if (strcmp (tags[i], "irc_smart_filter") != 0)
+ {
+ if (new_tags[0])
+ strcat (new_tags, ",");
+ strcat (new_tags, tags[i]);
+ }
+ }
+ hashtable = weechat_hashtable_new (4,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL,
+ NULL);
+ if (hashtable)
+ {
+ /* update tags in line (remove tag "irc_smart_filter") */
+ weechat_hashtable_set (hashtable, "tags_array", new_tags);
+ weechat_hdata_update (hdata_line_data, line_data, hashtable);
+ weechat_hashtable_free (hashtable);
+ }
+ free (new_tags);
+ }
+
+ /*
+ * exit loop if the message was the join (if it's a nick change,
+ * then we loop until we find the join)
+ */
+ if (join)
+ break;
+ }
+
+ /* continue with previous line in buffer */
+ line = weechat_hdata_move (hdata_line, line, -1);
+ }
+
+ if (nick_to_search)
+ free (nick_to_search);
+
+ weechat_hashtable_remove (channel->join_smart_filtered, nick);
+}
+
+
+/*
* Rejoins a channel (for example after kick).
*/
@@ -867,6 +1116,8 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
if (channel->nicks_speaking[1])
weechat_list_free (channel->nicks_speaking[1]);
irc_channel_nick_speaking_time_free_all (channel);
+ if (channel->join_smart_filtered)
+ weechat_hashtable_free (channel->join_smart_filtered);
if (channel->buffer_as_string)
free (channel->buffer_as_string);
@@ -925,6 +1176,7 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
+ WEECHAT_HDATA_VAR(struct t_irc_channel, join_smart_filtered, HASHTABLE, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, 0, NULL, "buffer");
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, 0, NULL, hdata_name);
@@ -1059,6 +1311,10 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
i++;
}
}
+ if (!weechat_infolist_new_var_string (ptr_item, "join_smart_filtered",
+ weechat_hashtable_get_string (channel->join_smart_filtered,
+ "keys_values")))
+ return 0;
return 1;
}
@@ -1098,6 +1354,10 @@ irc_channel_print_log (struct t_irc_channel *channel)
weechat_log_printf (" nicks_speaking[1]. . . . : 0x%lx", channel->nicks_speaking[1]);
weechat_log_printf (" nicks_speaking_time. . . : 0x%lx", channel->nicks_speaking_time);
weechat_log_printf (" last_nick_speaking_time. : 0x%lx", channel->last_nick_speaking_time);
+ weechat_log_printf (" join_smart_filtered. . . : 0x%lx (hashtable: '%s')",
+ channel->join_smart_filtered,
+ weechat_hashtable_get_string (channel->join_smart_filtered,
+ "keys_values"));
weechat_log_printf (" buffer . . . . . . . . . : 0x%lx", channel->buffer);
weechat_log_printf (" buffer_as_string . . . . : '%s'", channel->buffer_as_string);
weechat_log_printf (" prev_channel . . . . . . : 0x%lx", channel->prev_channel);
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 65c5cb055..ada35adfd 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -67,6 +67,7 @@ struct t_irc_channel
struct t_irc_channel_speaking *nicks_speaking_time; /* for smart filter */
/* of join/part/quit messages */
struct t_irc_channel_speaking *last_nick_speaking_time;
+ struct t_hashtable *join_smart_filtered; /* smart filtered joins */
struct t_gui_buffer *buffer; /* buffer allocated for channel */
char *buffer_as_string; /* used to return buffer info */
struct t_irc_channel *prev_channel; /* link to previous channel */
@@ -118,6 +119,16 @@ extern void irc_channel_nick_speaking_time_rename (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *old_nick,
const char *new_nick);
+extern void irc_channel_join_smart_filtered_add (struct t_irc_channel *channel,
+ const char *nick,
+ time_t join_time);
+extern void irc_channel_join_smart_filtered_rename (struct t_irc_channel *channel,
+ const char *old_nick,
+ const char *new_nick);
+extern void irc_channel_join_smart_filtered_remove (struct t_irc_channel *channel,
+ const char *nick);
+extern void irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
+ const char *nick);
extern void irc_channel_rejoin (struct t_irc_server *server,
struct t_irc_channel *channel);
extern int irc_channel_autorejoin_cb (void *data, int remaining_calls);
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index eee061e2f..9c9d40bad 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -94,6 +94,7 @@ struct t_config_option *irc_config_look_raw_messages;
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_quit;
struct t_config_option *irc_config_look_smart_filter_nick;
struct t_config_option *irc_config_look_topic_strip_colors;
@@ -2309,6 +2310,15 @@ irc_config_init ()
/* TRANSLATORS: please do not translate "join" */
N_("enable smart filter for \"join\" messages"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ irc_config_look_smart_filter_join_unmask = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "smart_filter_join_unmask", "integer",
+ N_("delay for unmasking a join message that was filtered with tag "
+ "\"irc_smart_filter\" (in minutes): if a nick jas joined max N "
+ "minutes ago and then says something on channel (message, notice or "
+ "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_quit = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_quit", "boolean",
@@ -2319,7 +2329,7 @@ irc_config_init ()
irc_config_file, ptr_section,
"smart_filter_nick", "boolean",
/* TRANSLATORS: please do not translate "nick" */
- N_("enable smart filter for \"nick\" messages"),
+ N_("enable smart filter for \"nick\" messages (nick changes)"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_topic_strip_colors = weechat_config_new_option (
irc_config_file, ptr_section,
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index bacdf7990..0f0d3d45c 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -129,6 +129,7 @@ extern struct t_config_option *irc_config_look_raw_messages;
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_quit;
extern struct t_config_option *irc_config_look_smart_filter_nick;
extern struct t_config_option *irc_config_look_topic_strip_colors;
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index e9de72f3a..8252830db 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -508,7 +508,7 @@ IRC_PROTOCOL_CALLBACK(join)
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
char *pos_channel;
- int local_join, display_host;
+ int local_join, display_host, smart_filter;
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
@@ -578,16 +578,23 @@ IRC_PROTOCOL_CALLBACK(join)
display_host = (local_join) ?
weechat_config_boolean (irc_config_look_display_host_join_local) :
weechat_config_boolean (irc_config_look_display_host_join);
+
+ /*
+ * "smart" filter the join message is it's not a join from myself, if
+ * smart filtering is enabled, and if nick was not speaking in channel
+ */
+ smart_filter = (!local_join
+ && weechat_config_boolean (irc_config_look_smart_filter)
+ && weechat_config_boolean (irc_config_look_smart_filter_join)
+ && !ptr_nick_speaking);
+
+ /* display the join */
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
ptr_channel->buffer),
date,
irc_protocol_tags (command,
- (local_join
- || !weechat_config_boolean (irc_config_look_smart_filter)
- || !weechat_config_boolean (irc_config_look_smart_filter_join)
- || ptr_nick_speaking) ?
- NULL : "irc_smart_filter",
+ smart_filter ? "irc_smart_filter" : NULL,
nick),
_("%s%s%s%s%s%s%s%s%s%s has joined %s%s%s"),
weechat_prefix ("join"),
@@ -604,6 +611,14 @@ IRC_PROTOCOL_CALLBACK(join)
pos_channel,
IRC_COLOR_MESSAGE_JOIN);
+ /*
+ * if join is smart filtered, save the nick in hashtable, and if nick
+ * is speaking shortly after the join, it will be unmasked
+ * (option irc.look.smart_filter_join_unmask)
+ */
+ if (smart_filter)
+ irc_channel_join_smart_filtered_add (ptr_channel, nick, time (NULL));
+
/* display message in private if private has flag "has_quit_server" */
if (!local_join)
irc_channel_display_nick_back_in_pv (server, ptr_nick, nick);
@@ -996,6 +1011,8 @@ IRC_PROTOCOL_CALLBACK(nick)
nick, new_nick);
irc_channel_nick_speaking_time_rename (server, ptr_channel,
nick, new_nick);
+ irc_channel_join_smart_filtered_rename (ptr_channel,
+ nick, new_nick);
}
if (old_color)
@@ -1078,6 +1095,14 @@ IRC_PROTOCOL_CALLBACK(notice)
{
/* notice for channel */
ptr_channel = irc_channel_search (server, pos_target);
+
+ /*
+ * unmask a smart filtered join if it is in hashtable
+ * "join_smart_filtered" of channel
+ */
+ if (ptr_channel)
+ irc_channel_join_smart_filtered_unmask (ptr_channel, nick);
+
ptr_nick = irc_nick_search (server, ptr_channel, nick);
weechat_printf_date_tags ((ptr_channel) ? ptr_channel->buffer : server->buffer,
date,
@@ -1390,7 +1415,12 @@ IRC_PROTOCOL_CALLBACK(part)
}
}
else
+ {
+ /* part from another user */
+ irc_channel_join_smart_filtered_remove (ptr_channel,
+ ptr_nick->name);
irc_nick_free (server, ptr_channel, ptr_nick);
+ }
}
}
@@ -1506,6 +1536,12 @@ IRC_PROTOCOL_CALLBACK(privmsg)
ptr_channel = irc_channel_search (server, pos_target);
if (ptr_channel)
{
+ /*
+ * unmask a smart filtered join if it is in hashtable
+ * "join_smart_filtered" of channel
+ */
+ irc_channel_join_smart_filtered_unmask (ptr_channel, nick);
+
/* CTCP to channel */
if ((pos_args[0] == '\01')
&& (pos_args[strlen (pos_args) - 1] == '\01'))
@@ -1673,10 +1709,10 @@ IRC_PROTOCOL_CALLBACK(quit)
if (ptr_nick
|| (irc_server_strcasecmp (server, ptr_channel->name, nick) == 0))
{
- /* display quit message */
+ local_quit = (irc_server_strcasecmp (server, nick, server->nick) == 0);
if (!irc_ignore_check (server, ptr_channel->name, nick, host))
{
- local_quit = (irc_server_strcasecmp (server, nick, server->nick) == 0);
+ /* display quit message */
ptr_nick_speaking = NULL;
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
@@ -1749,6 +1785,11 @@ IRC_PROTOCOL_CALLBACK(quit)
IRC_COLOR_MESSAGE_QUIT);
}
}
+ if (!local_quit && ptr_nick)
+ {
+ irc_channel_join_smart_filtered_remove (ptr_channel,
+ ptr_nick->name);
+ }
if (ptr_nick)
irc_nick_free (server, ptr_channel, ptr_nick);
}
@@ -1855,6 +1896,13 @@ IRC_PROTOCOL_CALLBACK(topic)
ptr_nick = irc_nick_search (server, ptr_channel, nick);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
+ /*
+ * unmask a smart filtered join if it is in hashtable
+ * "join_smart_filtered" of channel
+ */
+ if (ptr_channel)
+ irc_channel_join_smart_filtered_unmask (ptr_channel, nick);
+
if (pos_topic && pos_topic[0])
{
topic_color = irc_color_decode (pos_topic,
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 8327f159c..771368c3f 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -2688,14 +2688,11 @@ void
irc_server_check_join_manual_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
- struct t_irc_server *server;
+ /* make C compiler happy */
+ (void) data;
- server = (struct t_irc_server *)data;
- if (server)
- {
- if (*((time_t *)value) + (60 * 10) < time (NULL))
- weechat_hashtable_remove (hashtable, key);
- }
+ if (*((time_t *)value) + (60 * 10) < time (NULL))
+ weechat_hashtable_remove (hashtable, key);
}
/*
@@ -2707,13 +2704,33 @@ void
irc_server_check_join_noswitch_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
- struct t_irc_server *server;
+ /* make C compiler happy */
+ (void) data;
- server = (struct t_irc_server *)data;
- if (server)
+ if (*((time_t *)value) + (60 * 10) < time (NULL))
+ weechat_hashtable_remove (hashtable, key);
+}
+
+/*
+ * Callback called for each smart filtered join of a channel: deletes old
+ * entries in the hashtable.
+ */
+
+void
+irc_server_check_join_smart_filtered_cb (void *data,
+ struct t_hashtable *hashtable,
+ const void *key, const void *value)
+{
+ int unmask_delay;
+
+ /* make C compiler happy */
+ (void) data;
+
+ unmask_delay = weechat_config_integer (irc_config_look_smart_filter_join_unmask);
+ if ((unmask_delay == 0)
+ || (*((time_t *)value) < time (NULL) - (unmask_delay * 60)))
{
- if (*((time_t *)value) + (60 * 10) < time (NULL))
- weechat_hashtable_remove (hashtable, key);
+ weechat_hashtable_remove (hashtable, key);
}
}
@@ -2725,6 +2742,7 @@ int
irc_server_timer_cb (void *data, int remaining_calls)
{
struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
struct t_irc_redirect *ptr_redirect, *ptr_next_redirect;
time_t current_time;
static struct timeval tv;
@@ -2835,10 +2853,20 @@ irc_server_timer_cb (void *data, int remaining_calls)
{
weechat_hashtable_map (ptr_server->join_manual,
&irc_server_check_join_manual_cb,
- ptr_server);
+ NULL);
weechat_hashtable_map (ptr_server->join_noswitch,
&irc_server_check_join_noswitch_cb,
- ptr_server);
+ NULL);
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ if (ptr_channel->join_smart_filtered)
+ {
+ weechat_hashtable_map (ptr_channel->join_smart_filtered,
+ &irc_server_check_join_smart_filtered_cb,
+ NULL);
+ }
+ }
ptr_server->last_data_purge = current_time;
}
}
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index e262c88de..3a9568a06 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -284,8 +284,10 @@ irc_upgrade_read_cb (void *data,
int object_id,
struct t_infolist *infolist)
{
- int flags, sock, size, i, index;
- char *buf, option_name[64];
+ int flags, sock, size, i, index, nicks_count;
+ long number;
+ time_t join_time;
+ char *buf, option_name[64], **nicks, *nick_join, *pos, *error;
const char *buffer_name, *str, *nick;
struct t_irc_nick *ptr_nick;
struct t_irc_redirect *ptr_redirect;
@@ -482,6 +484,38 @@ irc_upgrade_read_cb (void *data,
option_name));
index++;
}
+ str = weechat_infolist_string (infolist, "join_smart_filtered");
+ if (str)
+ {
+ nicks = weechat_string_split (str, ",", 0, 0,
+ &nicks_count);
+ if (nicks)
+ {
+ for (i = 0; i < nicks_count; i++)
+ {
+ pos = strchr (nicks[i], ':');
+ if (pos)
+ {
+ nick_join = weechat_strndup (nicks[i],
+ pos - nicks[i]);
+ if (nick_join)
+ {
+ error = NULL;
+ number = strtol (pos + 1, &error, 10);
+ if (error && !error[0])
+ {
+ join_time = (time_t)number;
+ irc_channel_join_smart_filtered_add (irc_upgrade_current_channel,
+ nick_join,
+ join_time);
+ }
+ free (nick_join);
+ }
+ }
+ }
+ weechat_string_free_split (nicks);
+ }
+ }
}
}
break;