diff options
-rw-r--r-- | ChangeLog.asciidoc | 3 | ||||
-rw-r--r-- | doc/de/autogen/user/irc_options.asciidoc | 10 | ||||
-rw-r--r-- | doc/en/autogen/user/irc_options.asciidoc | 10 | ||||
-rw-r--r-- | doc/fr/autogen/user/irc_options.asciidoc | 10 | ||||
-rw-r--r-- | doc/it/autogen/user/irc_options.asciidoc | 10 | ||||
-rw-r--r-- | doc/ja/autogen/user/irc_options.asciidoc | 10 | ||||
-rw-r--r-- | doc/pl/autogen/user/irc_options.asciidoc | 10 | ||||
-rw-r--r-- | po/cs.po | 16 | ||||
-rw-r--r-- | po/de.po | 16 | ||||
-rw-r--r-- | po/es.po | 16 | ||||
-rw-r--r-- | po/fr.po | 19 | ||||
-rw-r--r-- | po/hu.po | 13 | ||||
-rw-r--r-- | po/it.po | 16 | ||||
-rw-r--r-- | po/ja.po | 16 | ||||
-rw-r--r-- | po/pl.po | 16 | ||||
-rw-r--r-- | po/pt_BR.po | 16 | ||||
-rw-r--r-- | po/ru.po | 13 | ||||
-rw-r--r-- | po/tr.po | 13 | ||||
-rw-r--r-- | po/weechat.pot | 13 | ||||
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 71 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.c | 350 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.h | 8 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.c | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 18 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 54 |
27 files changed, 624 insertions, 137 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 5b24aa871..23804e88f 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -32,6 +32,9 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * api: add regex replace feature in function string_eval_expression() * api: use microseconds instead of milliseconds in functions util_timeval_diff() and util_timeval_add() +* irc: open channel buffers before the JOIN is received from server (autojoin + and manual joins), new options irc.look.buffer_open_before_{autojoin|join} + (closes #216) * irc: add server option "sasl_fail" (continue/reconnect/disconnect if SASL fails) (closes #265, task #12204) * irc: add support for color codes 16-99 in IRC messages (closes #228), add diff --git a/doc/de/autogen/user/irc_options.asciidoc b/doc/de/autogen/user/irc_options.asciidoc index 818a9b6aa..98860cae6 100644 --- a/doc/de/autogen/user/irc_options.asciidoc +++ b/doc/de/autogen/user/irc_options.asciidoc @@ -68,6 +68,16 @@ ** Typ: Farbe ** Werte: ein Farbname für WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), eine Terminal-Farbnummer oder ein Alias; Attribute können vor eine Farbe gesetzt werden (gilt ausschließlich für die Textfarbe und nicht für den Hintergrund): "*" für fett, "!" für invertiert, "/" für kursiv, "_" für unterstrichen (Standardwert: `default`) +* [[option_irc.look.buffer_open_before_autojoin]] *irc.look.buffer_open_before_autojoin* +** Beschreibung: `open channel buffer before the JOIN is received from server when it is auto joined (with server option "autojoin"); this is useful to open channels with always the same buffer numbers on startup` +** Typ: boolesch +** Werte: on, off (Standardwert: `on`) + +* [[option_irc.look.buffer_open_before_join]] *irc.look.buffer_open_before_join* +** Beschreibung: `open channel buffer before the JOIN is received from server when it is manually joined (with /join command)` +** Typ: boolesch +** Werte: on, off (Standardwert: `off`) + * [[option_irc.look.buffer_switch_autojoin]] *irc.look.buffer_switch_autojoin* ** Beschreibung: `wechselt automatisch zum Channel-Buffer falls dieser automatisch betreten wurde (mittels der Serveroption "autojoin")` ** Typ: boolesch diff --git a/doc/en/autogen/user/irc_options.asciidoc b/doc/en/autogen/user/irc_options.asciidoc index 2799c4210..c8389533a 100644 --- a/doc/en/autogen/user/irc_options.asciidoc +++ b/doc/en/autogen/user/irc_options.asciidoc @@ -68,6 +68,16 @@ ** type: color ** values: a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal color number or an alias; attributes are allowed before color (for text color only, not background): "*" for bold, "!" for reverse, "/" for italic, "_" for underline (default value: `default`) +* [[option_irc.look.buffer_open_before_autojoin]] *irc.look.buffer_open_before_autojoin* +** description: `open channel buffer before the JOIN is received from server when it is auto joined (with server option "autojoin"); this is useful to open channels with always the same buffer numbers on startup` +** type: boolean +** values: on, off (default value: `on`) + +* [[option_irc.look.buffer_open_before_join]] *irc.look.buffer_open_before_join* +** description: `open channel buffer before the JOIN is received from server when it is manually joined (with /join command)` +** type: boolean +** values: on, off (default value: `off`) + * [[option_irc.look.buffer_switch_autojoin]] *irc.look.buffer_switch_autojoin* ** description: `auto switch to channel buffer when it is auto joined (with server option "autojoin")` ** type: boolean diff --git a/doc/fr/autogen/user/irc_options.asciidoc b/doc/fr/autogen/user/irc_options.asciidoc index 44eb193b7..62f2e408a 100644 --- a/doc/fr/autogen/user/irc_options.asciidoc +++ b/doc/fr/autogen/user/irc_options.asciidoc @@ -68,6 +68,16 @@ ** type: couleur ** valeurs: un nom de couleur WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), un numéro de couleur du terminal ou un alias ; des attributs sont autorisés avant la couleur (seulement pour la couleur du texte, pas le fond) : "*" pour le gras, "!" pour la vidéo inverse, "/" pour l'italique, "_" pour le souligné (valeur par défaut: `default`) +* [[option_irc.look.buffer_open_before_autojoin]] *irc.look.buffer_open_before_autojoin* +** description: `ouvrir le tampon du canal avant que le JOIN soit reçu du serveur lorsqu'il est automatiquement rejoint (avec l'option du serveur "autojoin")` +** type: booléen +** valeurs: on, off (valeur par défaut: `on`) + +* [[option_irc.look.buffer_open_before_join]] *irc.look.buffer_open_before_join* +** description: `ouvrir le tampon du canal avant que le JOIN soit reçu du serveur lorsqu'il est manuellement rejoint (avec la commande /join)` +** type: booléen +** valeurs: on, off (valeur par défaut: `off`) + * [[option_irc.look.buffer_switch_autojoin]] *irc.look.buffer_switch_autojoin* ** description: `basculer automatiquement vers le tampon du canal lorsqu'il est automatiquement rejoint (avec l'option du serveur "autojoin")` ** type: booléen diff --git a/doc/it/autogen/user/irc_options.asciidoc b/doc/it/autogen/user/irc_options.asciidoc index 66215be82..9f425da24 100644 --- a/doc/it/autogen/user/irc_options.asciidoc +++ b/doc/it/autogen/user/irc_options.asciidoc @@ -68,6 +68,16 @@ ** tipo: colore ** valori: a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal color number or an alias; attributes are allowed before color (for text color only, not background): "*" for bold, "!" for reverse, "/" for italic, "_" for underline (valore predefinito: `default`) +* [[option_irc.look.buffer_open_before_autojoin]] *irc.look.buffer_open_before_autojoin* +** descrizione: `open channel buffer before the JOIN is received from server when it is auto joined (with server option "autojoin"); this is useful to open channels with always the same buffer numbers on startup` +** tipo: bool +** valori: on, off (valore predefinito: `on`) + +* [[option_irc.look.buffer_open_before_join]] *irc.look.buffer_open_before_join* +** descrizione: `open channel buffer before the JOIN is received from server when it is manually joined (with /join command)` +** tipo: bool +** valori: on, off (valore predefinito: `off`) + * [[option_irc.look.buffer_switch_autojoin]] *irc.look.buffer_switch_autojoin* ** descrizione: `passa automaticamente al buffer del canale con l'ingresso automatico abilitato (con l'opzione del server "autojoin")` ** tipo: bool diff --git a/doc/ja/autogen/user/irc_options.asciidoc b/doc/ja/autogen/user/irc_options.asciidoc index c84e6b636..3c2677182 100644 --- a/doc/ja/autogen/user/irc_options.asciidoc +++ b/doc/ja/autogen/user/irc_options.asciidoc @@ -68,6 +68,16 @@ ** タイプ: 色 ** 値: WeeChat の色名 (default、black、(dark)gray、white、(light)red、(light)green、brown、yellow、(light)blue、(light)magenta、(light)cyan) 、ターミナル色番号またはその別名; 色の前に属性を置くことができます (テキスト前景色のみ、背景色は出来ません): 太字は "*"、反転は "!"、イタリックは "/"、下線は "_" (デフォルト値: `default`) +* [[option_irc.look.buffer_open_before_autojoin]] *irc.look.buffer_open_before_autojoin* +** 説明: `open channel buffer before the JOIN is received from server when it is auto joined (with server option "autojoin"); this is useful to open channels with always the same buffer numbers on startup` +** タイプ: ブール +** 値: on, off (デフォルト値: `on`) + +* [[option_irc.look.buffer_open_before_join]] *irc.look.buffer_open_before_join* +** 説明: `open channel buffer before the JOIN is received from server when it is manually joined (with /join command)` +** タイプ: ブール +** 値: on, off (デフォルト値: `off`) + * [[option_irc.look.buffer_switch_autojoin]] *irc.look.buffer_switch_autojoin* ** 説明: `自動で参加した場合に、自動的にチャンネルバッファを移動 (サーバオプション "autojoin" と共に使用)` ** タイプ: ブール diff --git a/doc/pl/autogen/user/irc_options.asciidoc b/doc/pl/autogen/user/irc_options.asciidoc index cfd71f21e..18e9c7e05 100644 --- a/doc/pl/autogen/user/irc_options.asciidoc +++ b/doc/pl/autogen/user/irc_options.asciidoc @@ -68,6 +68,16 @@ ** typ: kolor ** wartości: nazwa koloru WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), numer koloru terminala albo alias; atrybuty dozwolone przed kolorem (tylko dla kolorów testu, nie tła): "*" pogrubienie, "!" odwrócenie, "/" pochylenie, "_" podkreślenie (domyślna wartość: `default`) +* [[option_irc.look.buffer_open_before_autojoin]] *irc.look.buffer_open_before_autojoin* +** opis: `open channel buffer before the JOIN is received from server when it is auto joined (with server option "autojoin"); this is useful to open channels with always the same buffer numbers on startup` +** typ: bool +** wartości: on, off (domyślna wartość: `on`) + +* [[option_irc.look.buffer_open_before_join]] *irc.look.buffer_open_before_join* +** opis: `open channel buffer before the JOIN is received from server when it is manually joined (with /join command)` +** typ: bool +** wartości: on, off (domyślna wartość: `off`) + * [[option_irc.look.buffer_switch_autojoin]] *irc.look.buffer_switch_autojoin* ** opis: `automatycznie przełącz się na bufor kanału po automatycznym wejściu (opcja serwera "autojoin")` ** typ: bool @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6836,6 +6836,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: chyba při vytváření volby serveru \"%s\"" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"automaticky zobrazit buffer kanálu, když je připojen manuálně (pomocí " +"příkazu /join)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-12-13 09:10+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -7820,6 +7820,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: Fehler bei der Erstellung der Serveroption \"%s\"" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"wechselt automatisch zum Channel-Buffer falls dieser manuell betreten wurde " +"(mittels dem /join Befehl)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7090,6 +7090,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: error al crear la opción \"%s\" del servidor" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"cambiar automáticamente al canal cuando se entra manualmente (con el " +"comando /join)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" -"PO-Revision-Date: 2014-12-13 09:09+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" +"PO-Revision-Date: 2014-12-14 20:16+0100\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -7641,6 +7641,21 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s : erreur de création de l'option serveur \"%s\"" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" +"ouvrir le tampon du canal avant que le JOIN soit reçu du serveur lorsqu'il " +"est automatiquement rejoint (avec l'option du serveur \"autojoin\")" + +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"ouvrir le tampon du canal avant que le JOIN soit reçu du serveur lorsqu'il " +"est manuellement rejoint (avec la commande /join)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6326,6 +6326,17 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s nincs elég memória az információs pult üzenethez\n" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7235,6 +7235,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: errore durante la creazione dell'opzione del server \"%s\"" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"passa automaticamente al buffer del canale quando si entra manualmente (con " +"il comando /join)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-12-13 09:11+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" @@ -7331,6 +7331,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: サーバオプション \"%s\" 作成中にエラー" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"手動で参加した場合に、自動的にチャンネルバッファを移動 (/join コマンドを実行" +"したとき)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-12-13 09:13+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7484,6 +7484,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: błąd podczas tworzenia opcji dla serwera \"%s\"" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"automatycznie przełącz się na bufor kanału po ręcznym wejściu (za pomocą " +"komendy /join)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index b84ca0513..2b365b3c3 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-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6582,6 +6582,20 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: erro ao criar opção do servidor \"%s\"" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +#, fuzzy +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" +"alternar automaticamente para o buffer do canal quando entrar manualmente " +"nele (com o comando /join)" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6349,6 +6349,17 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "%s недостаточно памяти для сообщения в строке информации\n" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5651,6 +5651,17 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 531b42614..5ec9d48f8 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-12-13 09:08+0100\n" +"POT-Creation-Date: 2014-12-14 20:12+0100\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5588,6 +5588,17 @@ msgid "%s%s: error creating server option \"%s\"" msgstr "" msgid "" +"open channel buffer before the JOIN is received from server when it is auto " +"joined (with server option \"autojoin\"); this is useful to open channels " +"with always the same buffer numbers on startup" +msgstr "" + +msgid "" +"open channel buffer before the JOIN is received from server when it is " +"manually joined (with /join command)" +msgstr "" + +msgid "" "auto switch to channel buffer when it is auto joined (with server option " "\"autojoin\")" msgstr "" diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index f4dcf1d43..52bcb72fb 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -99,7 +99,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, { char buf[512]; struct t_weechat_plugin *ptr_plugin; - const char *name; + const char *name, *localvar_server, *localvar_channel; struct t_irc_server *server; struct t_irc_channel *channel; @@ -112,29 +112,50 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, if (!buffer) return NULL; + buf[0] = '\0'; + ptr_plugin = weechat_buffer_get_pointer (buffer, "plugin"); name = weechat_plugin_get_name (ptr_plugin); if (ptr_plugin == weechat_irc_plugin) { irc_buffer_get_server_and_channel (buffer, &server, &channel); - if (server && channel - && (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN)) - { - snprintf (buf, sizeof (buf), "%s%s/%s%s", - name, - IRC_COLOR_BAR_DELIM, - IRC_COLOR_BAR_FG, - server->name); - } - else + if (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN) { - snprintf (buf, sizeof (buf), "%s", name); + if (server && channel) + { + snprintf (buf, sizeof (buf), "%s%s/%s%s", + name, + IRC_COLOR_BAR_DELIM, + IRC_COLOR_BAR_FG, + server->name); + } + else + { + localvar_server = weechat_buffer_get_string (buffer, + "localvar_server"); + localvar_channel = weechat_buffer_get_string (buffer, + "localvar_channel"); + if (localvar_server && localvar_channel) + { + server = irc_server_search (localvar_server); + if (server) + { + snprintf (buf, sizeof (buf), "%s%s/%s%s", + name, + IRC_COLOR_BAR_DELIM, + IRC_COLOR_BAR_FG, + server->name); + } + } + } } } - else + + if (!buf[0]) { snprintf (buf, sizeof (buf), "%s", name); } + return strdup (buf); } @@ -146,8 +167,8 @@ char * irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) { char buf[512], buf_name[256], modes[128]; - const char *name; - int part_from_channel, display_server; + const char *name, *localvar_type; + int part_from_channel, display_server, is_channel; struct t_irc_server *server; struct t_irc_channel *channel; @@ -197,7 +218,25 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) name = weechat_buffer_get_string (buffer, (short_name) ? "short_name" : "name"); if (name) - snprintf (buf_name, sizeof (buf_name), "%s", name); + { + localvar_type = weechat_buffer_get_string (buffer, + "localvar_type"); + is_channel = (localvar_type + && (strcmp (localvar_type, "channel") == 0)); + if (is_channel) + { + name = weechat_buffer_get_string (buffer, + "localvar_channel"); + } + snprintf (buf_name, sizeof (buf_name), + "%s%s%s%s%s%s", + (is_channel) ? IRC_COLOR_BAR_DELIM : "", + (is_channel) ? "(" : "", + IRC_COLOR_STATUS_NAME, + name, + (is_channel) ? IRC_COLOR_BAR_DELIM : "", + (is_channel) ? ")" : ""); + } } snprintf (buf, sizeof (buf), "%s%s%s", diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 13ef73e80..fafc3fd88 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -140,37 +140,96 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type, } /* - * Creates a new channel in a server. + * Searches for a channel by name. * - * Returns pointer to new channel, NULL if error. + * Returns pointer to channel found, NULL if not found. */ struct t_irc_channel * -irc_channel_new (struct t_irc_server *server, int channel_type, - const char *channel_name, int switch_to_channel, - int auto_switch) +irc_channel_search (struct t_irc_server *server, const char *channel_name) { - struct t_irc_channel *new_channel; - struct t_gui_buffer *new_buffer, *ptr_buffer_for_merge; - int buffer_created, current_buffer_number, buffer_position, manual_join; - int noswitch; - char *buffer_name, str_number[32], *channel_name_lower; + struct t_irc_channel *ptr_channel; - /* alloc memory for new channel */ - if ((new_channel = malloc (sizeof (*new_channel))) == NULL) - { - weechat_printf (NULL, - _("%s%s: cannot allocate new channel"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + if (!server || !channel_name) return NULL; + + for (ptr_channel = server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) + { + if (irc_server_strcasecmp (server, ptr_channel->name, channel_name) == 0) + return ptr_channel; } + return NULL; +} + +/* + * Searches for a channel buffer by channel name. + * + * Returns pointer to buffer found, NULL if not found. + */ + +struct t_gui_buffer * +irc_channel_search_buffer (struct t_irc_server *server, + const char *channel_name) +{ + struct t_hdata *hdata_buffer; + struct t_gui_buffer *ptr_buffer; + const char *ptr_server_name, *ptr_channel_name; + + hdata_buffer = weechat_hdata_get ("buffer"); + ptr_buffer = weechat_hdata_get_list (hdata_buffer, "gui_buffers"); + + while (ptr_buffer) + { + if (weechat_buffer_get_pointer (ptr_buffer, + "plugin") == weechat_irc_plugin) + { + ptr_server_name = weechat_buffer_get_string (ptr_buffer, + "localvar_server"); + ptr_channel_name = weechat_buffer_get_string (ptr_buffer, + "localvar_channel"); + if (ptr_server_name && ptr_server_name[0] + && ptr_channel_name && ptr_channel_name[0] + && (strcmp (ptr_server_name, server->name) == 0) + && ((irc_server_strcasecmp (server, ptr_channel_name, + channel_name) == 0))) + { + return ptr_buffer; + } + } + + /* move to next buffer */ + ptr_buffer = weechat_hdata_move (hdata_buffer, ptr_buffer, 1); + } + + /* buffer not found */ + return NULL; +} + +/* + * Creates a buffer for a channel. + */ + +struct t_gui_buffer * +irc_channel_create_buffer (struct t_irc_server *server, + int channel_type, + const char *channel_name, + int switch_to_channel, + int auto_switch) +{ + struct t_gui_buffer *ptr_buffer, *ptr_buffer_for_merge; + int buffer_created, current_buffer_number, buffer_position; + int manual_join, noswitch; + char *buffer_name, str_number[32], *channel_name_lower; + const char *short_name, *localvar_channel; - /* create buffer for channel (or use existing one) */ buffer_created = 0; + buffer_name = irc_buffer_build_name (server->name, channel_name); - new_buffer = weechat_buffer_search (IRC_PLUGIN_NAME, buffer_name); - if (new_buffer) - weechat_nicklist_remove_all (new_buffer); + + ptr_buffer = irc_channel_search_buffer (server, channel_name); + if (ptr_buffer) + weechat_nicklist_remove_all (ptr_buffer); else { ptr_buffer_for_merge = NULL; @@ -190,15 +249,14 @@ irc_channel_new (struct t_irc_server *server, int channel_type, } current_buffer_number = weechat_buffer_get_integer ( weechat_current_buffer (), "number"); - new_buffer = weechat_buffer_new (buffer_name, + + ptr_buffer = weechat_buffer_new (buffer_name, &irc_input_data_cb, NULL, &irc_buffer_close_cb, NULL); - if (!new_buffer) - { - free (new_channel); + if (!ptr_buffer) return NULL; - } - if (weechat_buffer_get_integer (new_buffer, "layout_number") < 1) + + if (weechat_buffer_get_integer (ptr_buffer, "layout_number") < 1) { buffer_position = (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? weechat_config_integer (irc_config_look_new_channel_position) : @@ -212,50 +270,73 @@ irc_channel_new (struct t_irc_server *server, int channel_type, /* move buffer to current number + 1 */ snprintf (str_number, sizeof (str_number), "%d", current_buffer_number + 1); - weechat_buffer_set (new_buffer, "number", str_number); + weechat_buffer_set (ptr_buffer, "number", str_number); break; case IRC_CONFIG_LOOK_BUFFER_POSITION_NEAR_SERVER: /* move buffer after last channel/pv of server */ irc_channel_move_near_server (server, channel_type, - new_buffer); + ptr_buffer); break; } if (ptr_buffer_for_merge) - weechat_buffer_merge (new_buffer, ptr_buffer_for_merge); + weechat_buffer_merge (ptr_buffer, ptr_buffer_for_merge); } buffer_created = 1; } if (buffer_created) { - if (!weechat_buffer_get_integer (new_buffer, "short_name_is_set")) - weechat_buffer_set (new_buffer, "short_name", channel_name); - weechat_buffer_set (new_buffer, "localvar_set_type", - (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? "channel" : "private"); - weechat_buffer_set (new_buffer, "localvar_set_nick", server->nick); - weechat_buffer_set (new_buffer, "localvar_set_server", server->name); - weechat_buffer_set (new_buffer, "localvar_set_channel", channel_name); - if (server->is_away && server->away_message) + if (!weechat_buffer_get_integer (ptr_buffer, "short_name_is_set")) + weechat_buffer_set (ptr_buffer, "short_name", channel_name); + } + else + { + short_name = weechat_buffer_get_string (ptr_buffer, "short_name"); + localvar_channel = weechat_buffer_get_string (ptr_buffer, + "localvar_channel"); + if (!short_name + || (localvar_channel + && (strcmp (localvar_channel, short_name) == 0))) { - weechat_buffer_set (new_buffer, "localvar_set_away", - server->away_message); + /* update the short_name only if it was not changed by the user */ + weechat_buffer_set (ptr_buffer, "short_name", channel_name); } + } + + weechat_buffer_set (ptr_buffer, "name", buffer_name); + weechat_buffer_set (ptr_buffer, "localvar_set_type", + (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? "channel" : "private"); + weechat_buffer_set (ptr_buffer, "localvar_set_nick", server->nick); + weechat_buffer_set (ptr_buffer, "localvar_set_server", server->name); + weechat_buffer_set (ptr_buffer, "localvar_set_channel", channel_name); + if (server->is_away && server->away_message) + { + weechat_buffer_set (ptr_buffer, "localvar_set_away", + server->away_message); + } + else + { + weechat_buffer_set (ptr_buffer, "localvar_del_away", ""); + } + + if (buffer_created) + { (void) weechat_hook_signal_send ("logger_backlog", WEECHAT_HOOK_SIGNAL_POINTER, - new_buffer); + ptr_buffer); if (weechat_config_boolean (irc_config_network_send_unknown_commands)) - weechat_buffer_set (new_buffer, "input_get_unknown_commands", "1"); + weechat_buffer_set (ptr_buffer, "input_get_unknown_commands", "1"); if (channel_type == IRC_CHANNEL_TYPE_CHANNEL) { - weechat_buffer_set (new_buffer, "nicklist", "1"); - weechat_buffer_set (new_buffer, "nicklist_display_groups", "0"); - weechat_buffer_set_pointer (new_buffer, "nickcmp_callback", + weechat_buffer_set (ptr_buffer, "nicklist", "1"); + weechat_buffer_set (ptr_buffer, "nicklist_display_groups", "0"); + weechat_buffer_set_pointer (ptr_buffer, "nickcmp_callback", &irc_buffer_nickcmp_cb); } /* set highlights settings on channel buffer */ weechat_buffer_set( - new_buffer, + ptr_buffer, "highlight_words_add", (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? weechat_config_string (irc_config_look_highlight_channel) : @@ -264,10 +345,81 @@ irc_channel_new (struct t_irc_server *server, int channel_type, && weechat_config_string (irc_config_look_highlight_tags_restrict)[0]) { weechat_buffer_set ( - new_buffer, + ptr_buffer, "highlight_tags_restrict", weechat_config_string (irc_config_look_highlight_tags_restrict)); } + + /* switch to new buffer (if needed) */ + manual_join = 0; + noswitch = 0; + channel_name_lower = NULL; + if (channel_type == IRC_CHANNEL_TYPE_CHANNEL) + { + channel_name_lower = strdup (channel_name); + if (channel_name_lower) + { + weechat_string_tolower (channel_name_lower); + manual_join = weechat_hashtable_has_key (server->join_manual, + channel_name_lower); + noswitch = weechat_hashtable_has_key (server->join_noswitch, + channel_name_lower); + } + } + if (switch_to_channel) + { + if (channel_type == IRC_CHANNEL_TYPE_CHANNEL) + { + if (noswitch + || (manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_join)) + || (!manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_autojoin))) + switch_to_channel = 0; + } + if (switch_to_channel) + { + weechat_buffer_set (ptr_buffer, "display", + (auto_switch && !manual_join) ? "auto" : "1"); + } + } + if (channel_name_lower) + { + weechat_hashtable_remove (server->join_manual, channel_name_lower); + weechat_hashtable_remove (server->join_noswitch, channel_name_lower); + free (channel_name_lower); + } + } + + return ptr_buffer; +} + +/* + * Creates a new channel in a server. + * + * Returns pointer to new channel, NULL if error. + */ + +struct t_irc_channel * +irc_channel_new (struct t_irc_server *server, int channel_type, + const char *channel_name, int switch_to_channel, + int auto_switch) +{ + struct t_irc_channel *new_channel; + struct t_gui_buffer *ptr_buffer; + + /* create buffer for channel (or use existing one) */ + ptr_buffer = irc_channel_create_buffer (server, channel_type, + channel_name, switch_to_channel, + auto_switch); + if (!ptr_buffer) + return NULL; + + /* alloc memory for new channel */ + if ((new_channel = malloc (sizeof (*new_channel))) == NULL) + { + weechat_printf (NULL, + _("%s%s: cannot allocate new channel"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); + return NULL; } /* initialize new channel */ @@ -308,7 +460,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type, new_channel->nicks_speaking_time = NULL; new_channel->last_nick_speaking_time = NULL; new_channel->join_smart_filtered = NULL; - new_channel->buffer = new_buffer; + new_channel->buffer = ptr_buffer; new_channel->buffer_as_string = NULL; /* add new channel to channels list */ @@ -320,57 +472,62 @@ irc_channel_new (struct t_irc_server *server, int channel_type, server->channels = new_channel; server->last_channel = new_channel; - manual_join = 0; - noswitch = 0; - channel_name_lower = NULL; - if (channel_type == IRC_CHANNEL_TYPE_CHANNEL) + (void) weechat_hook_signal_send ( + (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? + "irc_channel_opened" : "irc_pv_opened", + WEECHAT_HOOK_SIGNAL_POINTER, ptr_buffer); + + /* all is OK, return address of new channel */ + return new_channel; +} + +/* + * Renames a channel. + */ + +void +irc_channel_rename (struct t_irc_server *server, + struct t_irc_channel *channel, + const char *new_name) +{ + struct t_irc_channel *ptr_channel; + char *buffer_name; + const char *short_name; + + /* check if another channel exists with this exact name */ + for (ptr_channel = server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) { - channel_name_lower = strdup (channel_name); - if (channel_name_lower) + if ((ptr_channel != channel) + && (strcmp (ptr_channel->name, new_name) == 0)) { - weechat_string_tolower (channel_name_lower); - manual_join = weechat_hashtable_has_key (server->join_manual, - channel_name_lower); - noswitch = weechat_hashtable_has_key (server->join_noswitch, - channel_name_lower); + return; } } - if (switch_to_channel) + /* rename the channel in buffer */ + if (channel->buffer) { - if (channel_type == IRC_CHANNEL_TYPE_CHANNEL) + short_name = weechat_buffer_get_string (channel->buffer, "short_name"); + if (!short_name || (strcmp (short_name, channel->name) == 0)) { - if (noswitch - || (manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_join)) - || (!manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_autojoin))) - switch_to_channel = 0; + /* update the short_name only if it was not changed by the user */ + weechat_buffer_set (channel->buffer, "short_name", new_name); } - - if (switch_to_channel) - { - weechat_buffer_set (new_buffer, "display", - (auto_switch && !manual_join) ? "auto" : "1"); - } - } - - if (channel_name_lower) - { - weechat_hashtable_remove (server->join_manual, channel_name_lower); - weechat_hashtable_remove (server->join_noswitch, channel_name_lower); - free (channel_name_lower); + buffer_name = irc_buffer_build_name (server->name, + new_name); + weechat_buffer_set (channel->buffer, "name", buffer_name); + weechat_buffer_set (channel->buffer, "localvar_set_channel", new_name); } - (void) weechat_hook_signal_send ( - (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? - "irc_channel_opened" : "irc_pv_opened", - WEECHAT_HOOK_SIGNAL_POINTER, new_buffer); - - /* all is OK, return address of new channel */ - return new_channel; + /* rename the irc channel */ + if (channel->name) + free (channel->name); + channel->name = strdup (new_name); } /* - * Add groups in nicklist for a channel. + * Adds groups in nicklist for a channel. */ void @@ -446,29 +603,6 @@ irc_channel_set_modes (struct t_irc_channel *channel, const char *modes) } /* - * Searches for a channel by name. - * - * Returns pointer to channel found, NULL if not found. - */ - -struct t_irc_channel * -irc_channel_search (struct t_irc_server *server, const char *channel_name) -{ - struct t_irc_channel *ptr_channel; - - if (!server || !channel_name) - return NULL; - - for (ptr_channel = server->channels; ptr_channel; - ptr_channel = ptr_channel->next_channel) - { - if (irc_server_strcasecmp (server, ptr_channel->name, channel_name) == 0) - return ptr_channel; - } - return NULL; -} - -/* * Checks if a string is a valid channel name. * * Returns: diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h index 2d91e1907..3dbbe18a6 100644 --- a/src/plugins/irc/irc-channel.h +++ b/src/plugins/irc/irc-channel.h @@ -78,11 +78,19 @@ struct t_irc_channel extern int irc_channel_valid (struct t_irc_server *server, struct t_irc_channel *channel); +extern struct t_gui_buffer *irc_channel_create_buffer (struct t_irc_server *server, + int channel_type, + const char *channel_name, + int switch_to_channel, + int auto_switch); extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server, int channel_type, const char *channel_name, int switch_to_channel, int auto_switch); +extern void irc_channel_rename (struct t_irc_server *server, + struct t_irc_channel *channel, + const char *new_name); extern void irc_channel_add_nicklist_groups (struct t_irc_server *server, struct t_irc_channel *channel); extern void irc_channel_set_buffer_title (struct t_irc_channel *channel); diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 96e12d22d..07b816038 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -2298,6 +2298,16 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments, pos_channel, keys[i]); } } + if (manual_join + && weechat_config_boolean (irc_config_look_buffer_open_before_join)) + { + /* + * open the channel buffer immediately (do not wait for the + * JOIN sent by server) + */ + irc_channel_create_buffer ( + server, IRC_CHANNEL_TYPE_CHANNEL, pos_channel, 1, 1); + } } if (pos_space) strcat (new_args, pos_space); diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 3826f40d1..c41d0352f 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -48,6 +48,8 @@ struct t_config_section *irc_config_section_server = NULL; /* IRC config, look section */ +struct t_config_option *irc_config_look_buffer_open_before_autojoin; +struct t_config_option *irc_config_look_buffer_open_before_join; struct t_config_option *irc_config_look_buffer_switch_autojoin; struct t_config_option *irc_config_look_buffer_switch_join; struct t_config_option *irc_config_look_color_nicks_in_names; @@ -2325,6 +2327,22 @@ irc_config_init () return 0; } + irc_config_look_buffer_open_before_autojoin = weechat_config_new_option ( + irc_config_file, ptr_section, + "buffer_open_before_autojoin", "boolean", + N_("open channel buffer before the JOIN is received from server " + "when it is auto joined (with server option \"autojoin\"); " + "this is useful to open channels with always the same buffer " + "numbers on startup"), + NULL, 0, 0, "on", NULL, 0, NULL, NULL, + NULL, NULL, NULL, NULL); + irc_config_look_buffer_open_before_join = weechat_config_new_option ( + irc_config_file, ptr_section, + "buffer_open_before_join", "boolean", + N_("open channel buffer before the JOIN is received from server " + "when it is manually joined (with /join command)"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, + NULL, NULL, NULL, NULL); irc_config_look_buffer_switch_autojoin = weechat_config_new_option ( irc_config_file, ptr_section, "buffer_switch_autojoin", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 75dd374fd..85218b908 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -96,6 +96,8 @@ extern struct t_config_section *irc_config_section_ctcp; extern struct t_config_section *irc_config_section_server_default; extern struct t_config_section *irc_config_section_server; +extern struct t_config_option *irc_config_look_buffer_open_before_autojoin; +extern struct t_config_option *irc_config_look_buffer_open_before_join; extern struct t_config_option *irc_config_look_buffer_switch_autojoin; extern struct t_config_option *irc_config_look_buffer_switch_join; extern struct t_config_option *irc_config_look_color_nicks_in_names; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 3e37e6bc6..c01f12464 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -665,6 +665,8 @@ IRC_PROTOCOL_CALLBACK(join) if (ptr_channel) { ptr_channel->part = 0; + if (strcmp (ptr_channel->name, pos_channel) != 0) + irc_channel_rename (server, ptr_channel, pos_channel); } else { diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 6016b7da0..2061be3ed 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -127,6 +127,7 @@ const char *irc_server_send_default_tags = NULL; /* default tags when */ void irc_server_reconnect (struct t_irc_server *server); void irc_server_free_data (struct t_irc_server *server); +void irc_server_autojoin_create_buffers (struct t_irc_server *server); /* @@ -4292,6 +4293,10 @@ irc_server_connect (struct t_irc_server *server) /* close connection if opened */ irc_server_close_connection (server); + /* open auto-joined channels now (if needed) */ + if (weechat_config_boolean (irc_config_look_buffer_open_before_autojoin)) + irc_server_autojoin_create_buffers (server); + /* init SSL if asked and connect */ server->ssl_connected = 0; #ifdef HAVE_GNUTLS @@ -4484,6 +4489,55 @@ irc_server_disconnect_all () } /* + * Creates buffers for auto-joined channels on a server. + */ + +void +irc_server_autojoin_create_buffers (struct t_irc_server *server) +{ + const char *pos_space; + char *autojoin, *autojoin2, **channels; + int num_channels, i; + + /* buffers are opened only if no channels are currently opened */ + if (server->channels) + return; + + /* evaluate server option "autojoin" */ + autojoin = weechat_string_eval_expression ( + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN), + NULL, NULL, NULL); + + /* extract channel names from autojoin option */ + if (autojoin && autojoin[0]) + { + pos_space = strchr (autojoin, ' '); + autojoin2 = (pos_space) ? + weechat_strndup (autojoin, pos_space - autojoin) : + strdup (autojoin); + if (autojoin2) + { + channels = weechat_string_split (autojoin2, ",", 0, 0, + &num_channels); + if (channels) + { + for (i = 0; i < num_channels; i++) + { + irc_channel_create_buffer ( + server, IRC_CHANNEL_TYPE_CHANNEL, channels[i], + 1, 1); + } + weechat_string_free_split (channels); + } + free (autojoin2); + } + } + + if (autojoin) + free (autojoin); +} + +/* * Autojoins (or auto-rejoins) channels. */ |