summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--doc/de/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/en/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/fr/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/it/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/ja/autogen/plugin_api/hdata.txt1
-rw-r--r--po/cs.po14
-rw-r--r--po/de.po14
-rw-r--r--po/es.po14
-rw-r--r--po/fr.po20
-rw-r--r--po/hu.po8
-rw-r--r--po/it.po14
-rw-r--r--po/ja.po14
-rw-r--r--po/pl.po14
-rw-r--r--po/pt_BR.po14
-rw-r--r--po/ru.po8
-rw-r--r--po/weechat.pot8
-rw-r--r--src/plugins/irc/irc-protocol.c54
-rw-r--r--src/plugins/irc/irc-server.c99
-rw-r--r--src/plugins/irc/irc-server.h4
20 files changed, 197 insertions, 109 deletions
diff --git a/ChangeLog b/ChangeLog
index 73e29046e..878ad8e66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,6 +58,8 @@ Version 0.3.9 (under dev!)
* fifo: ignore read failing with error EAGAIN (bug #37019)
* guile: fix crash when unloading a script without pointer to interpreter
* guile: fix path of guile include dirs in cmake build (patch #7790)
+* irc: generate alternate nicks dynamically when all nicks are already in use
+ (task #12209)
* irc: fix split of received IRC message: keep spaces at the end of message
* irc: move options from core to irc plugin: weechat.look.nickmode to
irc.look.nick_mode (new type: integer with values: none/prefix/action/both)
diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt
index 7a639fae7..b07cafae6 100644
--- a/doc/de/autogen/plugin_api/hdata.txt
+++ b/doc/de/autogen/plugin_api/hdata.txt
@@ -149,6 +149,7 @@
'nicks_count' (integer) +
'nicks_array' (string, array_size: 'nicks_count') +
'nick_first_tried' (integer) +
+ 'nick_alternate_number' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt
index 4c1276f56..8bbac8e95 100644
--- a/doc/en/autogen/plugin_api/hdata.txt
+++ b/doc/en/autogen/plugin_api/hdata.txt
@@ -149,6 +149,7 @@
'nicks_count' (integer) +
'nicks_array' (string, array_size: 'nicks_count') +
'nick_first_tried' (integer) +
+ 'nick_alternate_number' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt
index c1b91fbf7..68090727a 100644
--- a/doc/fr/autogen/plugin_api/hdata.txt
+++ b/doc/fr/autogen/plugin_api/hdata.txt
@@ -149,6 +149,7 @@
'nicks_count' (integer) +
'nicks_array' (string, array_size: 'nicks_count') +
'nick_first_tried' (integer) +
+ 'nick_alternate_number' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt
index 20b6d9f90..3c629d384 100644
--- a/doc/it/autogen/plugin_api/hdata.txt
+++ b/doc/it/autogen/plugin_api/hdata.txt
@@ -149,6 +149,7 @@
'nicks_count' (integer) +
'nicks_array' (string, array_size: 'nicks_count') +
'nick_first_tried' (integer) +
+ 'nick_alternate_number' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
diff --git a/doc/ja/autogen/plugin_api/hdata.txt b/doc/ja/autogen/plugin_api/hdata.txt
index 41604ff20..8d5da8097 100644
--- a/doc/ja/autogen/plugin_api/hdata.txt
+++ b/doc/ja/autogen/plugin_api/hdata.txt
@@ -149,6 +149,7 @@
'nicks_count' (integer) +
'nicks_array' (string, array_size: 'nicks_count') +
'nick_first_tried' (integer) +
+ 'nick_alternate_number' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
diff --git a/po/cs.po b/po/cs.po
index 56203c426..2ee3aedab 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6560,8 +6560,8 @@ msgstr ""
"%s%s: všechny deklarované přezdívky jsou již používány nebo nevalidní, "
"zavírám spojení se serverem"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr ""
"%s%s: přezdívka \"%s\" je nevalidní, zkouším přezdívku číslo %d (\"%s\")"
@@ -6573,13 +6573,13 @@ msgstr ""
"%s%s: všechny deklarované přezdívky jsou již používány, zavírám spojení se "
"serverem"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr ""
"%s: přezdívka \"%s\" je již používaná, zkouším přezdívku číslo %d (\"%s\")"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s: přezdívka \"%s\" je nedostupná, zkouším přezdívku číslo %d (\"%s\")"
diff --git a/po/de.po b/po/de.po
index e3a56fa35..46e461141 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-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -7085,8 +7085,8 @@ msgstr ""
"%s%s: alle voreingestellten Nicknamen sind bereits in Verwendung oder "
"ungültig, Verbindung wird getrennt!"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s%s: der Nickname \"%s\" ist ungültig, versuche Nickname #%d (\"%s\")"
#, c-format
@@ -7097,14 +7097,14 @@ msgstr ""
"%s%s: alle voreingestellten Nicknamen werden zur Zeit schon genutzt. "
"Verbindung wird getrennt"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr ""
"%s: der Nickname \"%s\" wird bereits verwendet. Versuche nun #%d (\"%s\") "
"als neuen Nicknamen zu nutzen"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s: der Nickname \"%s\" ist nicht verfügbar. Versuche nun den Nicknamen #"
"%d (\"%s\")"
diff --git a/po/es.po b/po/es.po
index 724e022a1..7559dfe6a 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6817,8 +6817,8 @@ msgstr ""
"%s%s: todos los apodos declarados ya están en uso o son inválidos, cerrando "
"la conexión con el servidor"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s%s: el apodo \"%s\" es inválido, probando con apodo #%d (\"%s\")"
#, c-format
@@ -6829,12 +6829,12 @@ msgstr ""
"%s%s: todos los apodos declarados ya están en uso, cerrando la conexión con "
"el servidor"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr "%s: el apodo \"%s\" ya está en uso, probando con apodo #%d (\"%s\")"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s: el apodo \"%s\" no está disponible, probando con apodo #%d (\"%s\")"
diff --git a/po/fr.po b/po/fr.po
index 86d3fd074..4fe2b5849 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
-"PO-Revision-Date: 2012-08-21 21:18+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
+"PO-Revision-Date: 2012-08-22 18:51+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -6890,9 +6890,8 @@ msgstr ""
"invalides, fermeture de la connexion avec le serveur"
#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
-msgstr ""
-"%s%s: le pseudo \"%s\" est invalide, essai avec le pseudo n°%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
+msgstr "%s%s: le pseudo \"%s\" est invalide, essai avec le pseudo \"%s\""
#, c-format
msgid ""
@@ -6903,16 +6902,15 @@ msgstr ""
"de la connexion avec le serveur"
#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr ""
-"%s: le pseudo \"%s\" est déjà en cours d'utilisation, essai avec le pseudo n°"
-"%d (\"%s\")"
+"%s: le pseudo \"%s\" est déjà en cours d'utilisation, essai avec le pseudo "
+"\"%s\""
#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
-"%s%s: le pseudo \"%s\" n'est pas disponible, essai avec le pseudo n°%d (\"%s"
-"\")"
+"%s%s: le pseudo \"%s\" n'est pas disponible, essai avec le pseudo \"%s\""
#, c-format
msgid "%s%s: command \"%s\" not found:"
diff --git a/po/hu.po b/po/hu.po
index 6b3920d7e..aa14ec3ec 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6124,7 +6124,7 @@ msgstr ""
"szerverrel!\n"
#, fuzzy, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s: a(z) \"%s\" név már foglalt, próbálom a második nevet: \"%s\"\n"
#, fuzzy, c-format
@@ -6134,11 +6134,11 @@ msgid ""
msgstr "%s: minden megadott név foglalt, kapcsolat bontása a szerverrel!\n"
#, fuzzy, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr "%s: a(z) \"%s\" név már foglalt, próbálom a második nevet: \"%s\"\n"
#, fuzzy, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s: a(z) \"%s\" név már foglalt, próbálom a második nevet: \"%s\"\n"
#, fuzzy, c-format
diff --git a/po/it.po b/po/it.po
index fb562dc62..55407600b 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6811,8 +6811,8 @@ msgstr ""
"%s%s: tutti i nick specificati sono già in uso oppure invalidi, chiusura "
"della connessione con il server in corso"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s%s: il nick \"%s\" è invalido, tentativo con il nick #%d (\"%s\")"
#, c-format
@@ -6823,12 +6823,12 @@ msgstr ""
"%s%s: tutti i nick specificati sono già in uso, chiusura della connessione "
"con il server in corso"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr "%s: il nick \"%s\" è già in uso, tentativo con il nick #%d (\"%s\")"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s: il nick \"%s\" non è disponibile, tentativo con il nick #%d (\"%s\")"
diff --git a/po/ja.po b/po/ja.po
index a1a264212..3f3191897 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -6645,8 +6645,8 @@ msgstr ""
"%s%s: 全ての設定されたニックネームは既に利用されているか、無効です、サーバと"
"の接続を閉じています"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr ""
"%s%s: ニックネームは \"%s\" 無効です、ニックネーム #%d (\"%s\") を試行してい"
"ます"
@@ -6659,14 +6659,14 @@ msgstr ""
"%s%s: 全ての設定されたニックネームは既に利用されています、サーバとの接続を閉"
"じています"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr ""
"%s: ニックネーム \"%s\" は既に使われています、ニックネーム #%d (\"%s\") を試"
"行しています"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s: ニックネーム \"%s\" は無効です、ニックネーム #%d (\"%s\") を試行してい"
"ます"
diff --git a/po/pl.po b/po/pl.po
index 285784a1d..b8b3d3763 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6778,8 +6778,8 @@ msgstr ""
"%s%s: wszystkie zadeklarowane nicki są już w użyciu lub są niewłaściwe, "
"zamykam połączenie z serwerem"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s%s: nick \"%s\" jest nieprawidłowy, próbuje nicku #%d (\"%s\")"
#, c-format
@@ -6790,12 +6790,12 @@ msgstr ""
"%s%s: wszystkie zadeklarowane nicki są w użyciu, zamykam połączenie z "
"serwerem"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr "%s: nick \"%s\" jest już używany, próbuje nick #%d (\"%s\")"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: nick \"%s\" jest niedostępny, próbuje nicku #%d (\"%s\")"
#, c-format
diff --git a/po/pt_BR.po b/po/pt_BR.po
index fd9f9d1e3..d458c90f5 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6265,8 +6265,8 @@ msgstr ""
"%s%s: todos os apelidos declarados já estão em uso ou são inválidos, "
"fechando conexão com o servidor"
-#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s%s: apelido \"%s\" é inválido, tentando apelido #%d (\"%s\")"
#, c-format
@@ -6277,12 +6277,12 @@ msgstr ""
"%s%s: todos os apelidos declarados já estão em uso, fechando conexão com o "
"servidor"
-#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr "%s: apelido \"%s\" já está em uso, tentando apelido #%d (\"%s\")"
-#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+#, fuzzy, c-format
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: apelido \"%s\" está indisponível, tentando apelido #%d (\"%s\")"
#, c-format
diff --git a/po/ru.po b/po/ru.po
index 7d1e48c76..ab5a59a97 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6152,7 +6152,7 @@ msgstr ""
"%s: все предложенные ники заняты или непригодны, отключаюсь от сервера!\n"
#, fuzzy, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr "%s: ник \"%s\" уже используется, пробую второй ник \"%s\"\n"
#, fuzzy, c-format
@@ -6162,11 +6162,11 @@ msgid ""
msgstr "%s: все предложенные ники заняты, отключаюсь от сервера!\n"
#, fuzzy, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr "%s: ник \"%s\" уже используется, пробую второй ник \"%s\"\n"
#, fuzzy, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s: ник \"%s\" уже используется, пробую второй ник \"%s\"\n"
#, fuzzy, c-format
diff --git a/po/weechat.pot b/po/weechat.pot
index dc59902e5..d97277524 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-08-21 21:36+0200\n"
+"POT-Creation-Date: 2012-08-22 19:19+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -5332,7 +5332,7 @@ msgid ""
msgstr ""
#, c-format
-msgid "%s%s: nickname \"%s\" is invalid, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""
msgstr ""
#, c-format
@@ -5342,11 +5342,11 @@ msgid ""
msgstr ""
#, c-format
-msgid "%s: nickname \"%s\" is already in use, trying nickname #%d (\"%s\")"
+msgid "%s: nickname \"%s\" is already in use, trying nickname \"%s\""
msgstr ""
#, c-format
-msgid "%s%s: nickname \"%s\" is unavailable, trying nickname #%d (\"%s\")"
+msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
#, c-format
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 067a992e6..709ef9caf 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -4082,7 +4082,7 @@ IRC_PROTOCOL_CALLBACK(368)
IRC_PROTOCOL_CALLBACK(432)
{
- int nick_index;
+ const char *alternate_nick;
struct t_gui_buffer *ptr_buffer;
/*
@@ -4099,13 +4099,8 @@ IRC_PROTOCOL_CALLBACK(432)
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
- nick_index = irc_server_get_nick_index (server);
- if (nick_index < 0)
- nick_index = 0;
- else
- nick_index = (nick_index + 1) % server->nicks_count;
-
- if (nick_index == server->nick_first_tried)
+ alternate_nick = irc_server_get_alternate_nick (server);
+ if (!alternate_nick)
{
weechat_printf (ptr_buffer,
_("%s%s: all declared nicknames are "
@@ -4119,12 +4114,11 @@ IRC_PROTOCOL_CALLBACK(432)
weechat_printf (ptr_buffer,
_("%s%s: nickname \"%s\" is invalid, "
- "trying nickname #%d (\"%s\")"),
+ "trying nickname \"%s\""),
weechat_prefix ("error"),
- IRC_PLUGIN_NAME, server->nick, nick_index + 1,
- server->nicks_array[nick_index]);
+ IRC_PLUGIN_NAME, server->nick, alternate_nick);
- irc_server_set_nick (server, server->nicks_array[nick_index]);
+ irc_server_set_nick (server, alternate_nick);
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
@@ -4138,7 +4132,7 @@ IRC_PROTOCOL_CALLBACK(432)
IRC_PROTOCOL_CALLBACK(433)
{
- int nick_index;
+ const char *alternate_nick;
struct t_gui_buffer *ptr_buffer;
/*
@@ -4151,13 +4145,8 @@ IRC_PROTOCOL_CALLBACK(433)
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
- nick_index = irc_server_get_nick_index (server);
- if (nick_index < 0)
- nick_index = 0;
- else
- nick_index = (nick_index + 1) % server->nicks_count;
-
- if (nick_index == server->nick_first_tried)
+ alternate_nick = irc_server_get_alternate_nick (server);
+ if (!alternate_nick)
{
weechat_printf (ptr_buffer,
_("%s%s: all declared nicknames are "
@@ -4171,11 +4160,10 @@ IRC_PROTOCOL_CALLBACK(433)
weechat_printf (ptr_buffer,
_("%s: nickname \"%s\" is already in use, "
- "trying nickname #%d (\"%s\")"),
- IRC_PLUGIN_NAME, server->nick, nick_index + 1,
- server->nicks_array[nick_index]);
+ "trying nickname \"%s\""),
+ IRC_PLUGIN_NAME, server->nick, alternate_nick);
- irc_server_set_nick (server, server->nicks_array[nick_index]);
+ irc_server_set_nick (server, alternate_nick);
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
@@ -4196,7 +4184,7 @@ IRC_PROTOCOL_CALLBACK(433)
IRC_PROTOCOL_CALLBACK(437)
{
- int nick_index;
+ const char *alternate_nick;
struct t_gui_buffer *ptr_buffer;
/*
@@ -4216,13 +4204,8 @@ IRC_PROTOCOL_CALLBACK(437)
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
- nick_index = irc_server_get_nick_index (server);
- if (nick_index < 0)
- nick_index = 0;
- else
- nick_index = (nick_index + 1) % server->nicks_count;
-
- if (nick_index == server->nick_first_tried)
+ alternate_nick = irc_server_get_alternate_nick (server);
+ if (!alternate_nick)
{
weechat_printf (ptr_buffer,
_("%s%s: all declared nicknames are "
@@ -4236,12 +4219,11 @@ IRC_PROTOCOL_CALLBACK(437)
weechat_printf (ptr_buffer,
_("%s%s: nickname \"%s\" is unavailable, "
- "trying nickname #%d (\"%s\")"),
+ "trying nickname \"%s\""),
weechat_prefix ("error"),
- IRC_PLUGIN_NAME, server->nick, nick_index + 1,
- server->nicks_array[nick_index]);
+ IRC_PLUGIN_NAME, server->nick, alternate_nick);
- irc_server_set_nick (server, server->nicks_array[nick_index]);
+ irc_server_set_nick (server, alternate_nick);
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 1ae2f0347..8db5f9150 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -486,6 +486,100 @@ irc_server_get_nick_index (struct t_irc_server *server)
}
/*
+ * irc_server_get_alternate_nick: get an alternate nick when the nick is
+ * already used on server
+ * We first try all declared nicks, then we
+ * build nicks by adding "_", until length of 9.
+ * If all nicks are still used, build 99
+ * alternate nicks by using number at the end.
+ * Example: nicks = "abcde,fghi,jkl"
+ * Nicks tried: abcde
+ * fghi
+ * jkl
+ * abcde_
+ * abcde__
+ * abcde___
+ * abcde____
+ * abcde___1
+ * abcde___2
+ * ...
+ * abcde__99
+ * Return NULL if no more alternate nick is
+ * available
+ */
+
+const char *
+irc_server_get_alternate_nick (struct t_irc_server *server)
+{
+ static char nick[64];
+ char str_number[64];
+ int nick_index, length_nick, length_number;
+
+ nick[0] = '\0';
+
+ /* we are still trying nicks from option "nicks" */
+ if (server->nick_alternate_number < 0)
+ {
+ nick_index = irc_server_get_nick_index (server);
+ if (nick_index < 0)
+ nick_index = 0;
+ else
+ {
+ nick_index = (nick_index + 1) % server->nicks_count;
+ /* stop loop if first nick tried was not in the list of nicks */
+ if ((nick_index == 0) && (server->nick_first_tried < 0))
+ server->nick_first_tried = 0;
+ }
+
+ if (nick_index != server->nick_first_tried)
+ {
+ snprintf (nick, sizeof (nick),
+ "%s", server->nicks_array[nick_index]);
+ return nick;
+ }
+
+ /*
+ * we have tried all nicks in list, then 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]);
+ }
+ else
+ snprintf (nick, sizeof (nick), "%s", server->nick);
+
+ /* if length is < 9, just add a "_" */
+ if (strlen (nick) < 9)
+ {
+ strcat (nick, "_");
+ return nick;
+ }
+
+ server->nick_alternate_number++;
+
+ /* number is max 99 */
+ if (server->nick_alternate_number > 99)
+ return NULL;
+
+ /* be sure the nick has 9 chars max */
+ nick[9] = '\0';
+
+ /* generate number */
+ snprintf (str_number, sizeof (str_number),
+ "%d", server->nick_alternate_number);
+
+ /* copy number in nick */
+ length_nick = strlen (nick);
+ length_number = strlen (str_number);
+ if (length_number > length_nick)
+ return NULL;
+ memcpy (nick + length_nick - length_number, str_number, length_number);
+
+ /* return alternate nick */
+ return nick;
+}
+
+/*
* irc_server_get_isupport_value: return value of an item in "isupport" (copy
* of IRC message 005)
* if feature is found but has no value, empty
@@ -782,6 +876,7 @@ irc_server_alloc (const char *name)
new_server->nicks_count = 0;
new_server->nicks_array = NULL;
new_server->nick_first_tried = 0;
+ new_server->nick_alternate_number = -1;
new_server->nick = NULL;
new_server->nick_modes = NULL;
new_server->isupport = NULL;
@@ -2811,6 +2906,8 @@ irc_server_login (struct t_irc_server *server)
else
server->nick_first_tried = irc_server_get_nick_index (server);
+ server->nick_alternate_number = -1;
+
if (irc_server_sasl_enabled (server) || (capabilities && capabilities[0]))
{
irc_server_sendf (server, 0, NULL, "CAP LS");
@@ -4290,6 +4387,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, "nicks_count", NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, NULL, NULL);
@@ -4800,6 +4898,7 @@ irc_server_print_log ()
weechat_log_printf (" nicks_count. . . . . : %d", ptr_server->nicks_count);
weechat_log_printf (" nicks_array. . . . . : 0x%lx", ptr_server->nicks_array);
weechat_log_printf (" nick_first_tried . . : %d", ptr_server->nick_first_tried);
+ 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 (" isupport . . . . . . : '%s'", ptr_server->isupport);
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 32bebe921..09856a160 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -161,6 +161,8 @@ struct t_irc_server
char **nicks_array; /* nicknames (after split) */
int nick_first_tried; /* first nick tried in list of nicks */
/* when (re-)connecting to server */
+ int nick_alternate_number; /* number used to build alternate nicks */
+ /* (nick____1, nick____2, ...) */
char *nick; /* current nickname */
char *nick_modes; /* nick modes */
char *isupport; /* copy of message 005 (ISUPPORT) */
@@ -237,7 +239,7 @@ extern void irc_server_set_addresses (struct t_irc_server *server,
const char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks);
extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
-extern int irc_server_get_nick_index (struct t_irc_server *server);
+extern const char *irc_server_get_alternate_nick (struct t_irc_server *server);
extern const char *irc_server_get_isupport_value (struct t_irc_server *server,
const char *feature);
extern void irc_server_set_prefix_modes_chars (struct t_irc_server *server,