diff options
32 files changed, 95 insertions, 44 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index b1203d2a5..82b5abe2e 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -81,6 +81,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * alias: change default command for alias /beep to "/print -beep" * exec: add exec plugin: new command /exec and file exec.conf * guile: fix module used after unload of a script +* irc: add support of "away-notify" capability (closes #12) * irc: add command /unquiet (closes #36) * irc: add command /allpv (task #13111) * irc: fix truncated read on socket with SSL (bug #41558) diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt index 3a34b479a..22bfbaff0 100644 --- a/doc/de/autogen/plugin_api/hdata.txt +++ b/doc/de/autogen/plugin_api/hdata.txt @@ -175,6 +175,7 @@ *** 'nick_alternate_number' (integer) *** 'nick' (string) *** 'nick_modes' (string) +*** 'cap_away_notify' (integer) *** 'isupport' (string) *** 'prefix_modes' (string) *** 'prefix_chars' (string) diff --git a/doc/de/autogen/user/irc_options.txt b/doc/de/autogen/user/irc_options.txt index 9e3ae0639..68ebfc32b 100644 --- a/doc/de/autogen/user/irc_options.txt +++ b/doc/de/autogen/user/irc_options.txt @@ -469,7 +469,7 @@ ** Werte: 0 .. 1000000 (Standardwert: `25`) * [[option_irc.server_default.capabilities]] *irc.server_default.capabilities* -** Beschreibung: `durch Kommata getrennte Liste von erweiterten Client Fähigkeiten ("client capabilities"), welche vom Server angeboten und genutzt werden sollen. Fähigkeiten die von WeeChat unterstützt werden: multi-prefix, userhost-in-name (Beispiel: "multi-prefix, userhost-in-name")` +** Beschreibung: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names, away-notify (example: "multi-prefix,userhost-in-names,away-notify")` ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `""`) diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt index dc0fa6b7a..ef139d9fe 100644 --- a/doc/en/autogen/plugin_api/hdata.txt +++ b/doc/en/autogen/plugin_api/hdata.txt @@ -175,6 +175,7 @@ *** 'nick_alternate_number' (integer) *** 'nick' (string) *** 'nick_modes' (string) +*** 'cap_away_notify' (integer) *** 'isupport' (string) *** 'prefix_modes' (string) *** 'prefix_chars' (string) diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt index a9c05cc60..3920de6b8 100644 --- a/doc/en/autogen/user/irc_options.txt +++ b/doc/en/autogen/user/irc_options.txt @@ -469,7 +469,7 @@ ** values: 0 .. 1000000 (default value: `25`) * [[option_irc.server_default.capabilities]] *irc.server_default.capabilities* -** description: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names (example: "multi-prefix,userhost-in-names")` +** description: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names, away-notify (example: "multi-prefix,userhost-in-names,away-notify")` ** type: string ** values: any string (default value: `""`) diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt index b0c0c0869..ac927d1cd 100644 --- a/doc/fr/autogen/plugin_api/hdata.txt +++ b/doc/fr/autogen/plugin_api/hdata.txt @@ -175,6 +175,7 @@ *** 'nick_alternate_number' (integer) *** 'nick' (string) *** 'nick_modes' (string) +*** 'cap_away_notify' (integer) *** 'isupport' (string) *** 'prefix_modes' (string) *** 'prefix_chars' (string) diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt index bde33bf68..c71344668 100644 --- a/doc/fr/autogen/user/irc_options.txt +++ b/doc/fr/autogen/user/irc_options.txt @@ -469,7 +469,7 @@ ** valeurs: 0 .. 1000000 (valeur par défaut: `25`) * [[option_irc.server_default.capabilities]] *irc.server_default.capabilities* -** description: `liste séparée par des virgules de capacités client ("client capabilities") à activer sur le serveur si elles sont disponibles; les capacités supportées par WeeChat sont: multi-prefix, userhost-in-names (exemple: "multi-prefix,userhost-in-names")` +** description: `liste séparée par des virgules de capacités client ("client capabilities") à activer sur le serveur si elles sont disponibles; les capacités supportées par WeeChat sont: multi-prefix, userhost-in-names, away-notify (exemple: "multi-prefix,userhost-in-names,away-notify")` ** type: chaîne ** valeurs: toute chaîne (valeur par défaut: `""`) diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt index b8698f256..a5f587e9d 100644 --- a/doc/it/autogen/plugin_api/hdata.txt +++ b/doc/it/autogen/plugin_api/hdata.txt @@ -175,6 +175,7 @@ *** 'nick_alternate_number' (integer) *** 'nick' (string) *** 'nick_modes' (string) +*** 'cap_away_notify' (integer) *** 'isupport' (string) *** 'prefix_modes' (string) *** 'prefix_chars' (string) diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt index a45e81434..0efc560fb 100644 --- a/doc/it/autogen/user/irc_options.txt +++ b/doc/it/autogen/user/irc_options.txt @@ -469,7 +469,7 @@ ** valori: 0 .. 1000000 (valore predefinito: `25`) * [[option_irc.server_default.capabilities]] *irc.server_default.capabilities* -** descrizione: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names (example: "multi-prefix,userhost-in-names")` +** descrizione: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names, away-notify (example: "multi-prefix,userhost-in-names,away-notify")` ** tipo: stringa ** valori: qualsiasi stringa (valore predefinito: `""`) diff --git a/doc/ja/autogen/plugin_api/hdata.txt b/doc/ja/autogen/plugin_api/hdata.txt index 2c2e7e394..c198174d1 100644 --- a/doc/ja/autogen/plugin_api/hdata.txt +++ b/doc/ja/autogen/plugin_api/hdata.txt @@ -175,6 +175,7 @@ *** 'nick_alternate_number' (integer) *** 'nick' (string) *** 'nick_modes' (string) +*** 'cap_away_notify' (integer) *** 'isupport' (string) *** 'prefix_modes' (string) *** 'prefix_chars' (string) diff --git a/doc/ja/autogen/user/irc_options.txt b/doc/ja/autogen/user/irc_options.txt index d82965244..ef66cfdc2 100644 --- a/doc/ja/autogen/user/irc_options.txt +++ b/doc/ja/autogen/user/irc_options.txt @@ -469,7 +469,7 @@ ** 値: 0 .. 1000000 (デフォルト値: `25`) * [[option_irc.server_default.capabilities]] *irc.server_default.capabilities* -** 説明: `サーバで利用可能ならば有効化する "client capabilities" のコンマ区切りリスト; WeeChat で利用できる機能: multi-prefix、userhost-in-names (例: "multi-prefix,userhost-in-names")` +** 説明: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names, away-notify (example: "multi-prefix,userhost-in-names,away-notify")` ** タイプ: 文字列 ** 値: 未制約文字列 (デフォルト値: `""`) diff --git a/doc/pl/autogen/plugin_api/hdata.txt b/doc/pl/autogen/plugin_api/hdata.txt index 308357e99..a682af5d5 100644 --- a/doc/pl/autogen/plugin_api/hdata.txt +++ b/doc/pl/autogen/plugin_api/hdata.txt @@ -175,6 +175,7 @@ *** 'nick_alternate_number' (integer) *** 'nick' (string) *** 'nick_modes' (string) +*** 'cap_away_notify' (integer) *** 'isupport' (string) *** 'prefix_modes' (string) *** 'prefix_chars' (string) diff --git a/doc/pl/autogen/user/irc_options.txt b/doc/pl/autogen/user/irc_options.txt index 75c918d90..194999c92 100644 --- a/doc/pl/autogen/user/irc_options.txt +++ b/doc/pl/autogen/user/irc_options.txt @@ -469,7 +469,7 @@ ** wartości: 0 .. 1000000 (domyślna wartość: `25`) * [[option_irc.server_default.capabilities]] *irc.server_default.capabilities* -** opis: `oddzielona przecinkami lista opcji włączanych dla serwera, jeśli są dostępne; opcje wspierane przez WeeChat: multi-prefix, userhost-in-names (przykład: "multi-prefix,userhost-in-names")` +** opis: `comma-separated list of client capabilities to enable for server if they are available; capabilities supported by WeeChat are: multi-prefix, userhost-in-names, away-notify (example: "multi-prefix,userhost-in-names,away-notify")` ** typ: ciąg ** wartości: dowolny ciąg (domyślna wartość: `""`) @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6511,7 +6511,7 @@ msgstr "příkaz spuštěný při startu WeeChat, před načtením pluginů" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-27 19:25+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -7401,10 +7401,11 @@ msgid "password for server (note: content is evaluated, see /help eval)" msgstr "Passwort für Server (Hinweis: Inhalt wird evaluiert, siehe /help eval)" #. TRANSLATORS: please keep words "client capabilities" between brackets if translation is different (see fr.po) +#, fuzzy msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" "durch Kommata getrennte Liste von erweiterten Client Fähigkeiten (\"client " "capabilities\"), welche vom Server angeboten und genutzt werden sollen. " @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6744,7 +6744,7 @@ msgstr "comando ejecutado cuando WeeChat inicia, antes de cargar los plugins" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" "lista separada por comas de capabilidades del cliente (\"client capabilities" "\") para habilitar en el servidor si están disponibles (ejemplo: \"multi-" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" -"PO-Revision-Date: 2014-03-30 12:24+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" +"PO-Revision-Date: 2014-03-30 16:12+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -7234,12 +7234,12 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" "liste séparée par des virgules de capacités client (\"client capabilities\") " "à activer sur le serveur si elles sont disponibles; les capacités supportées " -"par WeeChat sont: multi-prefix, userhost-in-names (exemple: \"multi-prefix," -"userhost-in-names\")" +"par WeeChat sont: multi-prefix, userhost-in-names, away-notify (exemple: " +"\"multi-prefix,userhost-in-names,away-notify\")" msgid "" "mechanism for SASL authentication: \"plain\" for plain text password, \"dh-" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6025,7 +6025,7 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6883,7 +6883,7 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-29 20:07+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" @@ -6970,10 +6970,11 @@ msgstr "" "サーバのパスワード (注意: 値は評価されます、/help eval を参照してください)" #. TRANSLATORS: please keep words "client capabilities" between brackets if translation is different (see fr.po) +#, fuzzy msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" "サーバで利用可能ならば有効化する \"client capabilities\" のコンマ区切りリス" "ト; WeeChat で利用できる機能: multi-prefix、userhost-in-names (例: \"multi-" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7020,10 +7020,11 @@ msgid "password for server (note: content is evaluated, see /help eval)" msgstr "hasło dla serwera ( zawartość jest przetwarzana, zobacz /help eval)" #. TRANSLATORS: please keep words "client capabilities" between brackets if translation is different (see fr.po) +#, fuzzy msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" "oddzielona przecinkami lista opcji włączanych dla serwera, jeśli są " "dostępne; opcje wspierane przez WeeChat: multi-prefix, userhost-in-names " diff --git a/po/pt_BR.po b/po/pt_BR.po index efb720aad..6803a8b93 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: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6246,7 +6246,7 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6049,7 +6049,7 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5371,7 +5371,7 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" diff --git a/po/weechat.pot b/po/weechat.pot index b402dbdfb..74d3fa91a 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: 2014-03-30 12:23+0200\n" +"POT-Creation-Date: 2014-03-30 16:11+0200\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" @@ -5317,7 +5317,7 @@ msgstr "" msgid "" "comma-separated list of client capabilities to enable for server if they are " "available; capabilities supported by WeeChat are: multi-prefix, userhost-in-" -"names (example: \"multi-prefix,userhost-in-names\")" +"names, away-notify (example: \"multi-prefix,userhost-in-names,away-notify\")" msgstr "" msgid "" diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 2076acf0a..9dbf3b794 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -492,9 +492,10 @@ irc_channel_check_away (struct t_irc_server *server, { if ((channel->type == IRC_CHANNEL_TYPE_CHANNEL) && channel->nicks) { - if ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK) > 0) - && ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS) == 0) - || (channel->nicks_count <= IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS)))) + if (server->cap_away_notify + || ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK) > 0) + && ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS) == 0) + || (channel->nicks_count <= IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS))))) { channel->checking_away++; irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_LOW, NULL, diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index e25100df7..0405e27ba 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -1627,8 +1627,8 @@ irc_config_server_new_option (struct t_config_file *config_file, /* TRANSLATORS: please keep words "client capabilities" between brackets if translation is different (see fr.po) */ N_("comma-separated list of client capabilities to enable for " "server if they are available; capabilities supported by " - "WeeChat are: multi-prefix, userhost-in-names (example: " - "\"multi-prefix,userhost-in-names\")"), + "WeeChat are: multi-prefix, userhost-in-names, away-notify " + "(example: \"multi-prefix,userhost-in-names,away-notify\")"), NULL, 0, 0, default_value, value, null_value_allowed, diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index c9b6763af..370a275e9 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -903,6 +903,7 @@ irc_nick_set_away (struct t_irc_server *server, struct t_irc_channel *channel, struct t_irc_nick *nick, int is_away) { if (!is_away + || server->cap_away_notify || ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK) > 0) && ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS) == 0) || (channel->nicks_count <= IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS))))) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 85882cc0c..c44fadad7 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -211,6 +211,33 @@ IRC_PROTOCOL_CALLBACK(authenticate) } /* + * Callback for the IRC message "AWAY": away info about a nick (with capability + * "away-notify"). + * + * Message looks like: + * :nick!user@host AWAY + * :nick!user@host AWAY :I am away + */ + +IRC_PROTOCOL_CALLBACK(away) +{ + struct t_irc_channel *ptr_channel; + struct t_irc_nick *ptr_nick; + + IRC_PROTOCOL_MIN_ARGS(2); + + for (ptr_channel = server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) + { + ptr_nick = irc_nick_search (server, ptr_channel, nick); + if (ptr_nick) + irc_nick_set_away (server, ptr_channel, ptr_nick, (argc > 2)); + } + + return WEECHAT_RC_OK; +} + +/* * Callback for the IRC message "CAP": client capability. * * Message looks like: @@ -350,6 +377,10 @@ IRC_PROTOCOL_CALLBACK(cap) sasl_to_do = 1; break; } + else if (strcmp (caps_supported[i], "away-notify") == 0) + { + server->cap_away_notify = 1; + } } weechat_string_free_split (caps_supported); } @@ -5076,6 +5107,7 @@ irc_protocol_recv_command (struct t_irc_server *server, struct t_hashtable *hash_tags; struct t_irc_protocol_msg irc_protocol_messages[] = { { "authenticate", /* authenticate */ 1, 0, &irc_protocol_cb_authenticate }, + { "away", /* away (cap away-notify) */ 1, 0, &irc_protocol_cb_away }, { "cap", /* client capability */ 1, 0, &irc_protocol_cb_cap }, { "error", /* error received from IRC server */ 1, 0, &irc_protocol_cb_error }, { "invite", /* invite a nick on a channel */ 1, 0, &irc_protocol_cb_invite }, diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index eac3ba5a7..45a3cc341 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -971,6 +971,7 @@ irc_server_alloc (const char *name) new_server->nick_alternate_number = -1; new_server->nick = NULL; new_server->nick_modes = NULL; + new_server->cap_away_notify = 0; new_server->isupport = NULL; new_server->prefix_modes = NULL; new_server->prefix_chars = NULL; @@ -2865,13 +2866,12 @@ irc_server_timer_cb (void *data, int remaining_calls) { /* check away (only if lag check was not done) */ away_check = IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_AWAY_CHECK); - if (away_check > 0) + if (!ptr_server->cap_away_notify + && (away_check > 0) + && ((ptr_server->last_away_check == 0) + || (current_time >= ptr_server->last_away_check + (away_check * 60)))) { - if ((ptr_server->last_away_check == 0) - || (current_time >= ptr_server->last_away_check + (away_check * 60))) - { - irc_server_check_away (ptr_server); - } + irc_server_check_away (ptr_server); } } @@ -4295,6 +4295,7 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address, server->nick_modes = NULL; weechat_bar_item_update ("input_prompt"); } + server->cap_away_notify = 0; server->is_away = 0; server->away_time = 0; server->lag = 0; @@ -4820,6 +4821,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name) WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, cap_away_notify, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, 0, NULL, NULL); @@ -5028,6 +5030,8 @@ irc_server_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_string (ptr_item, "nick_modes", server->nick_modes)) return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "cap_away_notify", server->cap_away_notify)) + return 0; if (!weechat_infolist_new_var_string (ptr_item, "isupport", server->isupport)) return 0; if (!weechat_infolist_new_var_string (ptr_item, "prefix_modes", server->prefix_modes)) @@ -5373,6 +5377,7 @@ irc_server_print_log () weechat_log_printf (" nick_alternate_number: %d", ptr_server->nick_alternate_number); weechat_log_printf (" nick . . . . . . . . : '%s'", ptr_server->nick); weechat_log_printf (" nick_modes . . . . . : '%s'", ptr_server->nick_modes); + weechat_log_printf (" cap_away_notify. . . : %d", ptr_server->cap_away_notify); weechat_log_printf (" isupport . . . . . . : '%s'", ptr_server->isupport); weechat_log_printf (" prefix_modes . . . . : '%s'", ptr_server->prefix_modes); weechat_log_printf (" prefix_chars . . . . : '%s'", ptr_server->prefix_chars); diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index a48eeaa5c..1a85588e9 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -173,6 +173,7 @@ struct t_irc_server /* (nick____1, nick____2, ...) */ char *nick; /* current nickname */ char *nick_modes; /* nick modes */ + int cap_away_notify; /* 1 if capability away-notify is enabled*/ char *isupport; /* copy of message 005 (ISUPPORT) */ char *prefix_modes; /* prefix modes from msg 005 (eg "ohv") */ char *prefix_chars; /* prefix chars from msg 005 (eg "@%+") */ diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index dfc76d718..d77084fea 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -361,6 +361,7 @@ irc_upgrade_read_cb (void *data, str = weechat_infolist_string (infolist, "nick_modes"); if (str) irc_upgrade_current_server->nick_modes = strdup (str); + irc_upgrade_current_server->cap_away_notify = weechat_infolist_integer (infolist, "cap_away_notify"); str = weechat_infolist_string (infolist, "isupport"); if (str) irc_upgrade_current_server->isupport = strdup (str); |