From 9037c0fe4c07b76bafb9a07b1600ac600bcf4245 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 20 Oct 2012 18:03:08 +0200 Subject: [PATCH] irc: add option irc.network.whois_double_nick to double nick in command /whois --- ChangeLog | 1 + doc/de/autogen/user/irc_options.txt | 5 +++ doc/en/autogen/user/irc_options.txt | 5 +++ doc/fr/autogen/user/irc_options.txt | 5 +++ doc/it/autogen/user/irc_options.txt | 5 +++ doc/ja/autogen/user/irc_options.txt | 5 +++ po/cs.po | 13 +++++--- po/de.po | 13 +++++--- po/es.po | 13 +++++--- po/fr.po | 18 ++++++++--- po/hu.po | 15 ++++++--- po/it.po | 13 +++++--- po/ja.po | 13 +++++--- po/pl.po | 13 +++++--- po/pt_BR.po | 13 +++++--- po/ru.po | 15 ++++++--- po/weechat.pot | 13 +++++--- src/plugins/irc/irc-command.c | 48 +++++++++++++++++------------ src/plugins/irc/irc-config.c | 20 ++++++++---- src/plugins/irc/irc-config.h | 1 + 20 files changed, 175 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e7357bd4..36777db2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ Version 0.4.0 (under dev!) hook_connect, move "sock" from hook_connect arguments to callback of hook_connect (task #11205) * aspell: add bar item "aspell_dict" (dictionary used on current buffer) +* irc: add option irc.network.whois_double_nick to double nick in command /whois * irc: send whois on self nick when /whois is done without argument on a channel (task #12273) * irc: remove local variable "away" in server/channels buffers after server diff --git a/doc/de/autogen/user/irc_options.txt b/doc/de/autogen/user/irc_options.txt index 506b1422a..12e84df8d 100644 --- a/doc/de/autogen/user/irc_options.txt +++ b/doc/de/autogen/user/irc_options.txt @@ -373,6 +373,11 @@ ** Typ: boolesch ** Werte: on, off (Standardwert: `off`) +* [[option_irc.network.whois_double_nick]] *irc.network.whois_double_nick* +** Beschreibung: `double the nick in /whois command (if only one nick is given), to get idle time in answer; for example: "/whois nick" will send "whois nick nick"` +** Typ: boolesch +** Werte: on, off (Standardwert: `on`) + * [[option_irc.server_default.addresses]] *irc.server_default.addresses* ** Beschreibung: `Liste der Hostnamen/Ports oder IP/Ports des Servers (durch Komma getrennt)` ** Typ: Zeichenkette diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt index 37f74c06c..7af334e3e 100644 --- a/doc/en/autogen/user/irc_options.txt +++ b/doc/en/autogen/user/irc_options.txt @@ -373,6 +373,11 @@ ** type: boolean ** values: on, off (default value: `off`) +* [[option_irc.network.whois_double_nick]] *irc.network.whois_double_nick* +** description: `double the nick in /whois command (if only one nick is given), to get idle time in answer; for example: "/whois nick" will send "whois nick nick"` +** type: boolean +** values: on, off (default value: `on`) + * [[option_irc.server_default.addresses]] *irc.server_default.addresses* ** description: `list of hostname/port or IP/port for server (separated by comma)` ** type: string diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt index 6620924b8..bf06dfc52 100644 --- a/doc/fr/autogen/user/irc_options.txt +++ b/doc/fr/autogen/user/irc_options.txt @@ -373,6 +373,11 @@ ** type: booléen ** valeurs: on, off (valeur par défaut: `off`) +* [[option_irc.network.whois_double_nick]] *irc.network.whois_double_nick* +** description: `doubler le pseudo dans la commande /whois (si un seul pseudo est donné), pour avoir le temps d'inactivité; par exemple: "/whois pseudo" enverra "whois pseudo pseudo"` +** type: booléen +** valeurs: on, off (valeur par défaut: `on`) + * [[option_irc.server_default.addresses]] *irc.server_default.addresses* ** description: `liste de nom/port ou IP/port pour le serveur (séparés par des virgules)` ** type: chaîne diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt index cac2f0ddb..2ea54bdb2 100644 --- a/doc/it/autogen/user/irc_options.txt +++ b/doc/it/autogen/user/irc_options.txt @@ -373,6 +373,11 @@ ** tipo: bool ** valori: on, off (valore predefinito: `off`) +* [[option_irc.network.whois_double_nick]] *irc.network.whois_double_nick* +** descrizione: `double the nick in /whois command (if only one nick is given), to get idle time in answer; for example: "/whois nick" will send "whois nick nick"` +** tipo: bool +** valori: on, off (valore predefinito: `on`) + * [[option_irc.server_default.addresses]] *irc.server_default.addresses* ** descrizione: `elenco di host/porte o IP/porte per il server (separati da virgole)` ** tipo: stringa diff --git a/doc/ja/autogen/user/irc_options.txt b/doc/ja/autogen/user/irc_options.txt index 8fec99e6f..e4dcd149b 100644 --- a/doc/ja/autogen/user/irc_options.txt +++ b/doc/ja/autogen/user/irc_options.txt @@ -373,6 +373,11 @@ ** タイプ: ブール ** 値: on, off (デフォルト値: `off`) +* [[option_irc.network.whois_double_nick]] *irc.network.whois_double_nick* +** 説明: `double the nick in /whois command (if only one nick is given), to get idle time in answer; for example: "/whois nick" will send "whois nick nick"` +** タイプ: ブール +** 値: on, off (デフォルト値: `on`) + * [[option_irc.server_default.addresses]] *irc.server_default.addresses* ** 説明: `サーバのホスト名/ポート番号又は IP アドレス/ポート番号のリスト (コンマ区切り)` ** タイプ: 文字列 diff --git a/po/cs.po b/po/cs.po index bd29b8000..c47e9a4b8 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -6031,9 +6031,6 @@ msgid "" msgstr "" "interval mezi dvěmi knotrolami pro lag, kdyz se lag zvětšuje (v sekundách)" -msgid "send unknown commands to server" -msgstr "posílat neznámé příkazy na server" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6047,6 +6044,14 @@ msgstr "" "interval mezi dvěmi knotrolemi pro notifikaci IRC príkazem \"whois\" (v " "minutách)" +msgid "send unknown commands to server" +msgstr "posílat neznámé příkazy na server" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP požadavek od %s%s%s: %s%s%s%s%s%s" diff --git a/po/de.po b/po/de.po index 180f7c90c..d17bb8f23 100644 --- a/po/de.po +++ b/po/de.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-10-19 17:57+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -6592,9 +6592,6 @@ msgstr "" "Intervall zwischen zwei Aktualisierungen der Verzögerungsanzeige (Lag-Item), " "wenn die Verzögerungszeit sich erhöht (in Sekunden)" -msgid "send unknown commands to server" -msgstr "sendet unbekannte Befehle an den Server" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6608,6 +6605,14 @@ msgstr "" "Intervall zwischen zwei notify Überprüfungen mit dem IRC Befehl \"whois" "\" (in Minuten)" +msgid "send unknown commands to server" +msgstr "sendet unbekannte Befehle an den Server" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP angefordert von %s%s%s: %s%s%s%s%s%s" diff --git a/po/es.po b/po/es.po index d39ca8485..5ba44fb5f 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -6290,9 +6290,6 @@ msgstr "" "intervalo de refresco para el elemento de lag, cuando este aumenta (en " "segundos)" -msgid "send unknown commands to server" -msgstr "envía comandos desconocidos al servidor" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6306,6 +6303,14 @@ msgstr "" "intervalo entre dos comprobaciones para notificaciones con el comando IRC " "\"whois\" (en minutos)" +msgid "send unknown commands to server" +msgstr "envía comandos desconocidos al servidor" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP solicitado por %s%s%s: %s%s%s%s%s%s" diff --git a/po/fr.po b/po/fr.po index 7da8a4df2..00e424d2d 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" -"PO-Revision-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" +"PO-Revision-Date: 2012-10-20 17:54+0200\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -6399,9 +6399,6 @@ msgstr "" "intervalle entre deux rafraichissements du lag, lorsque le lag augmente (en " "secondes)" -msgid "send unknown commands to server" -msgstr "envoie les commandes inconnues au serveur" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6415,6 +6412,17 @@ msgstr "" "intervalle entre deux vérifications de notification avec la commande IRC " "\"whois\" (en minutes)" +msgid "send unknown commands to server" +msgstr "envoie les commandes inconnues au serveur" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" +"doubler le pseudo dans la commande /whois (si un seul pseudo est donné), " +"pour avoir le temps d'inactivité; par exemple: \"/whois pseudo\" enverra " +"\"whois pseudo pseudo\"" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP demandé par %s%s%s: %s%s%s%s%s%s" diff --git a/po/hu.po b/po/hu.po index 079ecf223..d895a5f03 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -5581,10 +5581,6 @@ msgid "" "seconds)" msgstr "két távollétellenőrzés közti idő (percben, 0 = nincs ellenőrzés)" -#, fuzzy -msgid "send unknown commands to server" -msgstr "ismeretlen parancsok küldése az IRC szervernek" - #, fuzzy msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" @@ -5596,6 +5592,15 @@ msgid "" "minutes)" msgstr "két távollétellenőrzés közti idő (percben, 0 = nincs ellenőrzés)" +#, fuzzy +msgid "send unknown commands to server" +msgstr "ismeretlen parancsok küldése az IRC szervernek" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, fuzzy, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%s%s%s eltávolította %s%s%s-t a szerverről" diff --git a/po/it.po b/po/it.po index 08bdd939e..515a0e6b1 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -6293,9 +6293,6 @@ msgstr "" "intervallo tra due aggiornamenti per l'elemento ritardo, quando è in aumento " "(in secondi)" -msgid "send unknown commands to server" -msgstr "invia comandi sconosciuti al server" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6309,6 +6306,14 @@ msgstr "" "intervallo tra due verifiche per la notifica con il comando IRC \"whois" "\" (in minuti)" +msgid "send unknown commands to server" +msgstr "invia comandi sconosciuti al server" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP richiesto da %s%s%s: %s%s%s%s%s%s" diff --git a/po/ja.po b/po/ja.po index 143141abc..b13cd0789 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -6149,9 +6149,6 @@ msgstr "" "遅延時間が増加する場合、遅延アイテムの 2 回のリフレッシュの間のインターバル " "(秒単位)" -msgid "send unknown commands to server" -msgstr "未定義のコマンドをサーバに送信" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6163,6 +6160,14 @@ msgid "" msgstr "" "IRC コマンド \"whois\" による通知の 2 回のチェックの間のインターバル (分単位)" +msgid "send unknown commands to server" +msgstr "未定義のコマンドをサーバに送信" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%s%s%s%s からの CTCP 要求: %s%s%s%s%s%s" diff --git a/po/pl.po b/po/pl.po index 4c39eed74..05d959c11 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -6258,9 +6258,6 @@ msgstr "" "przerwa między dwoma odświeżeniami wskaźnika lagu, kiedy się on zwiększa (w " "sekundach)" -msgid "send unknown commands to server" -msgstr "wysyłaj nieznane komendy do serwera" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -6274,6 +6271,14 @@ msgstr "" "przerwa pomiędzy dwoma sprawdzeniami powiadomień komendą IRC \"whois\" (w " "minutach)" +msgid "send unknown commands to server" +msgstr "wysyłaj nieznane komendy do serwera" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP zażądane przez %s%s%s: %s%s%s%s%s%s" diff --git a/po/pt_BR.po b/po/pt_BR.po index ae03baa54..37975e015 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -5749,9 +5749,6 @@ msgid "" "seconds)" msgstr "" -msgid "send unknown commands to server" -msgstr "enviar comandos desconhecidos ao servidor" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -5765,6 +5762,14 @@ msgstr "" "intervalo entre duas verificações por notificação com o comando IRC \"whois" "\" (em minutos)" +msgid "send unknown commands to server" +msgstr "enviar comandos desconhecidos ao servidor" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%sCTCP requisitado por %s%s%s: %s%s%s%s%s%s" diff --git a/po/ru.po b/po/ru.po index efba4575b..8544373f6 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -5601,10 +5601,6 @@ msgid "" msgstr "" "интервал между проверками на отсутствие (в минутах, 0 = не проверять никогда)" -#, fuzzy -msgid "send unknown commands to server" -msgstr "отсылать неизвестные команды IRC серверу" - #, fuzzy msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" @@ -5618,6 +5614,15 @@ msgid "" msgstr "" "интервал между проверками на отсутствие (в минутах, 0 = не проверять никогда)" +#, fuzzy +msgid "send unknown commands to server" +msgstr "отсылать неизвестные команды IRC серверу" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, fuzzy, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "%s%s%s убил %s%s%s" diff --git a/po/weechat.pot b/po/weechat.pot index 5ca70e763..bd7bb605e 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-10-20 16:43+0200\n" +"POT-Creation-Date: 2012-10-20 17:54+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -4831,9 +4831,6 @@ msgid "" "seconds)" msgstr "" -msgid "send unknown commands to server" -msgstr "" - msgid "" "interval between two checks for notify with IRC command \"ison\" (in minutes)" msgstr "" @@ -4843,6 +4840,14 @@ msgid "" "minutes)" msgstr "" +msgid "send unknown commands to server" +msgstr "" + +msgid "" +"double the nick in /whois command (if only one nick is given), to get idle " +"time in answer; for example: \"/whois nick\" will send \"whois nick nick\"" +msgstr "" + #, c-format msgid "%sCTCP requested by %s%s%s: %s%s%s%s%s%s" msgstr "" diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index be2850b0f..9e450ef9b 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -4888,38 +4888,48 @@ int irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { + int double_nick; + const char *ptr_nick; + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("whois", 1); /* make C compiler happy */ (void) data; - (void) argv; + + double_nick = weechat_config_boolean (irc_config_network_whois_double_nick); + ptr_nick = NULL; if (argc > 1) { - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "WHOIS %s", argv_eol[1]); + if ((argc > 2) || strchr (argv_eol[1], ',')) + { + /* do not double nick if we have more than one argument or a comma */ + double_nick = 0; + ptr_nick = argv_eol[1]; + } + else + ptr_nick = argv[1]; } else { - if (ptr_channel - && (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)) - { - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "WHOIS %s", ptr_channel->name); - } - else - { - if (ptr_server->nick) - { - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "WHOIS %s", ptr_server->nick); - } - else - IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "whois"); - } + if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)) + ptr_nick = ptr_channel->name; + else if (ptr_server->nick) + ptr_nick = ptr_server->nick; } + if (!ptr_nick) + { + IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "whois"); + } + + irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "WHOIS %s%s%s", + ptr_nick, + (double_nick) ? " " : "", + (double_nick) ? ptr_nick : ""); + return WEECHAT_RC_OK; } diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index e51290145..650a5264a 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -131,6 +131,7 @@ struct t_config_option *irc_config_network_lag_refresh_interval; struct t_config_option *irc_config_network_notify_check_ison; struct t_config_option *irc_config_network_notify_check_whois; struct t_config_option *irc_config_network_send_unknown_commands; +struct t_config_option *irc_config_network_whois_double_nick; /* IRC config, server section */ @@ -2520,12 +2521,6 @@ irc_config_init () N_("interval between two refreshs of lag item, when lag is increasing " "(in seconds)"), NULL, 1, 3600, "1", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_send_unknown_commands = weechat_config_new_option ( - irc_config_file, ptr_section, - "send_unknown_commands", "boolean", - N_("send unknown commands to server"), - NULL, 0, 0, "off", NULL, 0, NULL, NULL, - &irc_config_change_network_send_unknown_commands, NULL, NULL, NULL); irc_config_network_notify_check_ison = weechat_config_new_option ( irc_config_file, ptr_section, "notify_check_ison", "integer", @@ -2540,6 +2535,19 @@ irc_config_init () "(in minutes)"), NULL, 1, 60 * 24 * 7, "5", NULL, 0, NULL, NULL, &irc_config_change_network_notify_check_whois, NULL, NULL, NULL); + irc_config_network_send_unknown_commands = weechat_config_new_option ( + irc_config_file, ptr_section, + "send_unknown_commands", "boolean", + N_("send unknown commands to server"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, + &irc_config_change_network_send_unknown_commands, NULL, NULL, NULL); + irc_config_network_whois_double_nick = weechat_config_new_option ( + irc_config_file, ptr_section, + "whois_double_nick", "boolean", + N_("double the nick in /whois command (if only one nick is given), to " + "get idle time in answer; for example: \"/whois nick\" will send " + "\"whois nick nick\""), + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* msgbuffer */ ptr_section = weechat_config_new_section (irc_config_file, "msgbuffer", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index cdc95c21d..447d366bd 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -160,6 +160,7 @@ extern struct t_config_option *irc_config_network_lag_refresh_interval; extern struct t_config_option *irc_config_network_notify_check_ison; extern struct t_config_option *irc_config_network_notify_check_whois; extern struct t_config_option *irc_config_network_send_unknown_commands; +extern struct t_config_option *irc_config_network_whois_double_nick; extern struct t_config_option *irc_config_server_default[];