irc: open channel buffers before the JOIN is received from server (autojoin and manual joins) (closes #216)

New options:
- irc.look.buffer_open_before_autojoin
- irc.look.buffer_open_before_join
v2.8-utf8proc
Sébastien Helleu 2014-12-14 20:23:45 +01:00
parent 8d3a55c6be
commit 624083f41a
27 changed files with 628 additions and 141 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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" と共に使用)`
** タイプ: ブール

View File

@ -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

View File

@ -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"
@ -6835,6 +6835,20 @@ msgstr "%s%s: chyba při vytváření serveru \"%s\""
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\")"

View File

@ -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"
@ -7819,6 +7819,20 @@ msgstr "%s%s: Fehler bei der Erstellung des Servers \"%s\""
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\")"

View File

@ -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"
@ -7089,6 +7089,20 @@ msgstr "%s%s: error al crear el servidor \"%s\""
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\")"

View File

@ -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"
@ -7640,6 +7640,21 @@ msgstr "%s%s : erreur de création du serveur \"%s\""
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\")"

View File

@ -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"
@ -6325,6 +6325,17 @@ msgstr "%s nincs elég memória az információs pult üzenethez\n"
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\")"

View File

@ -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"
@ -7234,6 +7234,20 @@ msgstr "%s%s: errore durante la creazione del server \"%s\""
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\")"

View File

@ -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"
@ -7330,6 +7330,20 @@ msgstr "%s%s: サーバ \"%s\" 作成中のエラー"
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\")"

View File

@ -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"
@ -7483,6 +7483,20 @@ msgstr "%s%s: błąd podczas tworzenia serwera \"%s\""
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\")"

View File

@ -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"
@ -6581,6 +6581,20 @@ msgstr "%s%s: erro ao criar servidor \"%s\""
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\")"

View File

@ -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"
@ -6348,6 +6348,17 @@ msgstr "%s недостаточно памяти для сообщения в с
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\")"

View File

@ -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"
@ -5650,6 +5650,17 @@ msgstr ""
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\")"

View File

@ -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"
@ -5587,6 +5587,17 @@ msgstr ""
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\")"

View File

@ -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))
if (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
{
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",

View File

@ -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);
}
/* create buffer for channel (or use existing one) */
/* 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;
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)
{
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 (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);
}
(void) weechat_hook_signal_send (
(channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
"irc_channel_opened" : "irc_pv_opened",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
WEECHAT_HOOK_SIGNAL_POINTER, ptr_buffer);
/* all is OK, return address of new channel */
return new_channel;
}
/*
* Add groups in nicklist for a 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)
{
if ((ptr_channel != channel)
&& (strcmp (ptr_channel->name, new_name) == 0))
{
return;
}
}
/* rename the channel in buffer */
if (channel->buffer)
{
short_name = weechat_buffer_get_string (channel->buffer, "short_name");
if (!short_name || (strcmp (short_name, channel->name) == 0))
{
/* update the short_name only if it was not changed by the user */
weechat_buffer_set (channel->buffer, "short_name", new_name);
}
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);
}
/* rename the irc channel */
if (channel->name)
free (channel->name);
channel->name = strdup (new_name);
}
/*
* Adds groups in nicklist for a channel.
*/
void
@ -445,29 +602,6 @@ irc_channel_set_modes (struct t_irc_channel *channel, const char *modes)
channel->modes = (modes) ? strdup (modes) : NULL;
}
/*
* 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.
*

View File

@ -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);

View File

@ -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);

View File

@ -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",

View File

@ -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;

View File

@ -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
{

View File

@ -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
@ -4483,6 +4488,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.
*/