From b1005fc23e963e55cf6606888e14b60b4ab27d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20G=C3=B6rs?= Date: Fri, 2 Nov 2012 17:51:12 +0100 Subject: [PATCH] irc: add option irc.network.alternate_nick to disable dynamic nick generation when all nicks are already in use on server (task #12281) --- ChangeLog | 2 ++ 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 | 8 +++++++- po/de.po | 8 +++++++- po/es.po | 8 +++++++- po/fr.po | 14 ++++++++++++-- po/hu.po | 8 +++++++- po/it.po | 8 +++++++- po/ja.po | 8 +++++++- po/pl.po | 8 +++++++- po/pt_BR.po | 8 +++++++- po/ru.po | 8 +++++++- po/weechat.pot | 8 +++++++- src/plugins/irc/irc-config.c | 9 +++++++++ src/plugins/irc/irc-config.h | 1 + src/plugins/irc/irc-server.c | 11 +++++++---- 20 files changed, 126 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index db50bb8ee..f9786aeca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ 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.alternate_nick to disable dynamic nick generation + when all nicks are already in use on server (task #12281) * 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) diff --git a/doc/de/autogen/user/irc_options.txt b/doc/de/autogen/user/irc_options.txt index 12e84df8d..e497a0079 100644 --- a/doc/de/autogen/user/irc_options.txt +++ b/doc/de/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** Typ: boolesch ** Werte: on, off (Standardwert: `off`) +* [[option_irc.network.alternate_nick]] *irc.network.alternate_nick* +** Beschreibung: `get an alternate nick when the nick is already used on server: add some "_" until the nick has a length of 9, and then replace last char (or the two last chars) by a number from 1 to 99, until we find a nick not used on server` +** Typ: boolesch +** Werte: on, off (Standardwert: `on`) + * [[option_irc.network.autoreconnect_delay_growing]] *irc.network.autoreconnect_delay_growing* ** Beschreibung: `Multiplikator für die Verzögerung bei der automatischen Wiederverbindung zum Server (1 = immer die selbe Verzögerung nutzen, 2 = Verzögerung*2 für jeden weiteren Versuch, ..)` ** Typ: integer diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt index 7af334e3e..a1f745a3a 100644 --- a/doc/en/autogen/user/irc_options.txt +++ b/doc/en/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** type: boolean ** values: on, off (default value: `off`) +* [[option_irc.network.alternate_nick]] *irc.network.alternate_nick* +** description: `get an alternate nick when the nick is already used on server: add some "_" until the nick has a length of 9, and then replace last char (or the two last chars) by a number from 1 to 99, until we find a nick not used on server` +** type: boolean +** values: on, off (default value: `on`) + * [[option_irc.network.autoreconnect_delay_growing]] *irc.network.autoreconnect_delay_growing* ** description: `growing factor for autoreconnect delay to server (1 = always same delay, 2 = delay*2 for each retry, ..)` ** type: integer diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt index bf06dfc52..f70160c9f 100644 --- a/doc/fr/autogen/user/irc_options.txt +++ b/doc/fr/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** type: booléen ** valeurs: on, off (valeur par défaut: `off`) +* [[option_irc.network.alternate_nick]] *irc.network.alternate_nick* +** description: `obtenir un pseudo alternatif lorsque le pseudo est déjà utilisé sur le serveur: ajouter des "_" jusqu'à ce que le pseudo ait une longeur de 9, puis remplacer le dernier caractère (ou les deux derniers) par un nombre de 1 à 99, jusqu'à trouver un pseudo non utilisé sur le serveur` +** type: booléen +** valeurs: on, off (valeur par défaut: `on`) + * [[option_irc.network.autoreconnect_delay_growing]] *irc.network.autoreconnect_delay_growing* ** description: `facteur de croissance du délai d'autoreconnection au serveur (1 = toujours le même délai, 2 = délai*2 pour chaque tentative, etc...)` ** type: entier diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt index 2ea54bdb2..416355149 100644 --- a/doc/it/autogen/user/irc_options.txt +++ b/doc/it/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** tipo: bool ** valori: on, off (valore predefinito: `off`) +* [[option_irc.network.alternate_nick]] *irc.network.alternate_nick* +** descrizione: `get an alternate nick when the nick is already used on server: add some "_" until the nick has a length of 9, and then replace last char (or the two last chars) by a number from 1 to 99, until we find a nick not used on server` +** tipo: bool +** valori: on, off (valore predefinito: `on`) + * [[option_irc.network.autoreconnect_delay_growing]] *irc.network.autoreconnect_delay_growing* ** descrizione: `fattore di crescita per il ritardo della riconnessione automatica al server (1 = sempre identico, 2 = ritardo*2 per ogni tentativo, ...)` ** tipo: intero diff --git a/doc/ja/autogen/user/irc_options.txt b/doc/ja/autogen/user/irc_options.txt index e4dcd149b..d554db780 100644 --- a/doc/ja/autogen/user/irc_options.txt +++ b/doc/ja/autogen/user/irc_options.txt @@ -318,6 +318,11 @@ ** タイプ: ブール ** 値: on, off (デフォルト値: `off`) +* [[option_irc.network.alternate_nick]] *irc.network.alternate_nick* +** 説明: `get an alternate nick when the nick is already used on server: add some "_" until the nick has a length of 9, and then replace last char (or the two last chars) by a number from 1 to 99, until we find a nick not used on server` +** タイプ: ブール +** 値: on, off (デフォルト値: `on`) + * [[option_irc.network.autoreconnect_delay_growing]] *irc.network.autoreconnect_delay_growing* ** 説明: `サーバに自動再接続する際の遅延間隔に関する増加係数 (1 = 遅延間隔は常に同じ, 2 = リトライごとに遅延間隔を 2 倍、..)` ** タイプ: 整数 diff --git a/po/cs.po b/po/cs.po index 205a77e79..14f6e3d85 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -6074,6 +6074,12 @@ msgstr "barva pro staré téma rozhovoru kanálu (když se téma změní)" msgid "color for new channel topic (when topic is changed)" msgstr "barva pro nové téma rozhovoru kanálu (když se téma změní)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/de.po b/po/de.po index 4e100761f..d46b83ccf 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-10-19 17:57+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -6626,6 +6626,12 @@ msgstr "" "Farbe in dem das neue Thema des Channels dargestellt werden soll, falls das " "Thema des Channels geändert wurde" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/es.po b/po/es.po index d4e5317e1..427e54050 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -6329,6 +6329,12 @@ msgstr "color para el tema antiguo del canal (cuando se cambia el tema)" msgid "color for new channel topic (when topic is changed)" msgstr "color para el nuevo tema del canal (cuando se cambia el tema)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/fr.po b/po/fr.po index 4d85f5d13..2b967b62f 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-11-02 15:35+0100\n" -"PO-Revision-Date: 2012-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" +"PO-Revision-Date: 2012-11-02 17:46+0100\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -6505,6 +6505,16 @@ msgstr "couleur pour l'ancien titre du canal (lorsque le titre est changé)" msgid "color for new channel topic (when topic is changed)" msgstr "couleur pour le nouveau titre du canal (lorsque le titre est changé)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" +"obtenir un pseudo alternatif lorsque le pseudo est déjà utilisé sur le " +"serveur: ajouter des \"_\" jusqu'à ce que le pseudo ait une longeur de 9, " +"puis remplacer le dernier caractère (ou les deux derniers) par un nombre de " +"1 à 99, jusqu'à trouver un pseudo non utilisé sur le serveur" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/hu.po b/po/hu.po index c31803900..13a5c11de 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -5626,6 +5626,12 @@ msgstr "" msgid "color for new channel topic (when topic is changed)" msgstr "" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/it.po b/po/it.po index 093d6f201..5f7ac4e60 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -6331,6 +6331,12 @@ msgstr "colore del precedente argomento del canale (quando viene cambiato)" msgid "color for new channel topic (when topic is changed)" msgstr "colore del nuovo argomento del canale (quando viene cambiato)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/ja.po b/po/ja.po index fea7cd3b0..1c9cb958f 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -6193,6 +6193,12 @@ msgstr "古いチャンネルトピックの色 (トピックが変更された msgid "color for new channel topic (when topic is changed)" msgstr "新しいチャンネルトピックの色 (トピックが変更されたとき)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/pl.po b/po/pl.po index 08628f387..051a930ac 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -6295,6 +6295,12 @@ msgstr "kolor starego tematu kanału (kiedy temat został zmieniony)" msgid "color for new channel topic (when topic is changed)" msgstr "kolor nowego tematu kanału (kiedy temat został zmieniony)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/pt_BR.po b/po/pt_BR.po index 83b5483e9..b2f897e94 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -5791,6 +5791,12 @@ msgstr "cor para o tópico antigo do canal (quando o tópico é alterado)" msgid "color for new channel topic (when topic is changed)" msgstr "cor para o novo tópico do canal (quando o tópico é alterado)" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/ru.po b/po/ru.po index d393e7805..9afdcb543 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -5643,6 +5643,12 @@ msgstr "" msgid "color for new channel topic (when topic is changed)" msgstr "" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/po/weechat.pot b/po/weechat.pot index 28b401eef..9a2d0fa9a 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-11-02 15:35+0100\n" +"POT-Creation-Date: 2012-11-02 17:45+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -4882,6 +4882,12 @@ msgstr "" msgid "color for new channel topic (when topic is changed)" msgstr "" +msgid "" +"get an alternate nick when the nick is already used on server: add some \"_" +"\" until the nick has a length of 9, and then replace last char (or the two " +"last chars) by a number from 1 to 99, until we find a nick not used on server" +msgstr "" + msgid "" "growing factor for autoreconnect delay to server (1 = always same delay, 2 = " "delay*2 for each retry, ..)" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 650a5264a..72d31f44f 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -120,6 +120,7 @@ struct t_config_option *irc_config_color_topic_new; /* IRC config, network section */ +struct t_config_option *irc_config_network_alternate_nick; struct t_config_option *irc_config_network_autoreconnect_delay_growing; struct t_config_option *irc_config_network_autoreconnect_delay_max; struct t_config_option *irc_config_network_colors_receive; @@ -2471,6 +2472,14 @@ irc_config_init () return 0; } + irc_config_network_alternate_nick = weechat_config_new_option ( + irc_config_file, ptr_section, + "alternate_nick", "boolean", + N_("get an alternate nick when the nick is already used on server: add " + "some \"_\" until the nick has a length of 9, and then replace last " + "char (or the two last chars) by a number from 1 to 99, until we " + "find a nick not used on server"), + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_autoreconnect_delay_growing = weechat_config_new_option ( irc_config_file, ptr_section, "autoreconnect_delay_growing", "integer", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 447d366bd..085ae3aa5 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -149,6 +149,7 @@ extern struct t_config_option *irc_config_color_reason_quit; extern struct t_config_option *irc_config_color_topic_old; extern struct t_config_option *irc_config_color_topic_new; +extern struct t_config_option *irc_config_network_alternate_nick; extern struct t_config_option *irc_config_network_autoreconnect_delay_growing; extern struct t_config_option *irc_config_network_autoreconnect_delay_max; extern struct t_config_option *irc_config_network_colors_receive; diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 6ef24337a..018cb59b9 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -551,10 +551,13 @@ irc_server_get_alternate_nick (struct t_irc_server *server) return nick; } - /* - * we have tried all nicks in list, then use main nick - * and we will add "_" and then number if needed - */ + /* now we have tried all nicks in list */ + + /* if alternate nick is disabled, just return NULL */ + if (!weechat_config_boolean (irc_config_network_alternate_nick)) + return NULL; + + /* use main nick and we will add "_" and then number if needed */ server->nick_alternate_number = 0; snprintf (nick, sizeof (nick), "%s", server->nicks_array[0]); }