summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--doc/de/autogen/user/irc_options.txt5
-rw-r--r--doc/en/autogen/user/irc_options.txt5
-rw-r--r--doc/fr/autogen/user/irc_options.txt7
-rw-r--r--doc/it/autogen/user/irc_options.txt5
-rw-r--r--doc/ja/autogen/user/irc_options.txt5
-rw-r--r--po/cs.po6
-rw-r--r--po/de.po6
-rw-r--r--po/es.po6
-rw-r--r--po/fr.po9
-rw-r--r--po/hu.po6
-rw-r--r--po/it.po6
-rw-r--r--po/ja.po6
-rw-r--r--po/pl.po6
-rw-r--r--po/pt_BR.po6
-rw-r--r--po/ru.po6
-rw-r--r--po/weechat.pot5
-rw-r--r--src/plugins/irc/irc-buffer.c47
-rw-r--r--src/plugins/irc/irc-buffer.h3
-rw-r--r--src/plugins/irc/irc-channel.c19
-rw-r--r--src/plugins/irc/irc-config.c74
-rw-r--r--src/plugins/irc/irc-config.h8
-rw-r--r--src/plugins/irc/irc-server.c2
23 files changed, 229 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index a6dd8e83b..be230b9d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,8 @@ Version 0.4.1 (under dev!)
list with arguments inside), guile >= 2.0 is now required (bug #38350)
* guile: fix crash on calls to callbacks during load of script (bug #38343)
* guile: fix compilation with guile 2.0
+* irc: add option irc.look.pv_buffer: automatically merge private buffers
+ (optionally by server) (task #11924)
* irc: rename option irc.network.lag_disconnect to irc.network.lag_reconnect,
value is now a number of seconds
* irc: hide passwords in commands or messages sent to nickserv (/msg nickserv)
diff --git a/doc/de/autogen/user/irc_options.txt b/doc/de/autogen/user/irc_options.txt
index 42a1a1846..2515c1a5d 100644
--- a/doc/de/autogen/user/irc_options.txt
+++ b/doc/de/autogen/user/irc_options.txt
@@ -278,6 +278,11 @@
** Typ: boolesch
** Werte: on, off (Standardwert: `off`)
+* [[option_irc.look.pv_buffer]] *irc.look.pv_buffer*
+** Beschreibung: `merge private buffers`
+** Typ: integer
+** Werte: independent, merge_by_server, merge_all (Standardwert: `independent`)
+
* [[option_irc.look.raw_messages]] *irc.look.raw_messages*
** Beschreibung: `Anzahl der IRC-RAW-Nachrichten die im Speicher gehalten werden sollen falls der RAW-Daten-Buffer geschlossen ist (die Nachrichten werden umgehend angezeigt sobald der RAW-Daten-Buffer geöffnet wird)`
** Typ: integer
diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt
index ab31167d7..22db79c64 100644
--- a/doc/en/autogen/user/irc_options.txt
+++ b/doc/en/autogen/user/irc_options.txt
@@ -278,6 +278,11 @@
** type: boolean
** values: on, off (default value: `off`)
+* [[option_irc.look.pv_buffer]] *irc.look.pv_buffer*
+** description: `merge private buffers`
+** type: integer
+** values: independent, merge_by_server, merge_all (default value: `independent`)
+
* [[option_irc.look.raw_messages]] *irc.look.raw_messages*
** description: `number of raw messages to save in memory when raw data buffer is closed (messages will be displayed when opening raw data buffer)`
** type: integer
diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt
index d77f6783b..f00b7bba0 100644
--- a/doc/fr/autogen/user/irc_options.txt
+++ b/doc/fr/autogen/user/irc_options.txt
@@ -278,13 +278,18 @@
** type: booléen
** valeurs: on, off (valeur par défaut: `off`)
+* [[option_irc.look.pv_buffer]] *irc.look.pv_buffer*
+** description: `mélanger les tampons privés`
+** type: entier
+** valeurs: independent, merge_by_server, merge_all (valeur par défaut: `independent`)
+
* [[option_irc.look.raw_messages]] *irc.look.raw_messages*
** description: `nombre de messages bruts à sauvegarder en mémoire lorsque le tampon des données brutes est fermé (ces messages seront affichés lors de l'ouverture du tampon des données brutes)`
** type: entier
** valeurs: 0 .. 65535 (valeur par défaut: `256`)
* [[option_irc.look.server_buffer]] *irc.look.server_buffer*
-** description: `mélange des tampons de serveur`
+** description: `mélanger les tampons de serveur`
** type: entier
** valeurs: merge_with_core, merge_without_core, independent (valeur par défaut: `merge_with_core`)
diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt
index b374a3e1f..a85e1529b 100644
--- a/doc/it/autogen/user/irc_options.txt
+++ b/doc/it/autogen/user/irc_options.txt
@@ -278,6 +278,11 @@
** tipo: bool
** valori: on, off (valore predefinito: `off`)
+* [[option_irc.look.pv_buffer]] *irc.look.pv_buffer*
+** descrizione: `merge private buffers`
+** tipo: intero
+** valori: independent, merge_by_server, merge_all (valore predefinito: `independent`)
+
* [[option_irc.look.raw_messages]] *irc.look.raw_messages*
** descrizione: `numero di messaggi raw da salvare in memoria quando il buffer dei dati raw viene chiuso (i messaggi verranno visualizzati all'apertura del buffer dei dati raw)`
** tipo: intero
diff --git a/doc/ja/autogen/user/irc_options.txt b/doc/ja/autogen/user/irc_options.txt
index 344dd3ab5..6a52b7532 100644
--- a/doc/ja/autogen/user/irc_options.txt
+++ b/doc/ja/autogen/user/irc_options.txt
@@ -278,6 +278,11 @@
** タイプ: ブール
** 値: on, off (デフォルト値: `off`)
+* [[option_irc.look.pv_buffer]] *irc.look.pv_buffer*
+** 説明: `merge private buffers`
+** タイプ: 整数
+** 値: independent, merge_by_server, merge_all (デフォルト値: `independent`)
+
* [[option_irc.look.raw_messages]] *irc.look.raw_messages*
** 説明: `生データバッファが閉じられた時にメモリに保存する生メッセージの数 (生データバッファを開いたときに表示されるメッセージ)`
** タイプ: 整数
diff --git a/po/cs.po b/po/cs.po
index 81e8ed584..49e680d46 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-16 17:49+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5907,6 +5907,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "spojit buffery serverů"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "spojit buffery serverů"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/de.po b/po/de.po
index e8ca07485..5db2a65bd 100644
--- a/po/de.po
+++ b/po/de.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-17 08:20+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -6480,6 +6480,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "Server-Buffer zusammenfügen"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "Server-Buffer zusammenfügen"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/es.po b/po/es.po
index a8b31f242..85ea080db 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-17 08:20+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6127,6 +6127,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "unir buffers de los servidores"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "unir buffers de los servidores"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/fr.po b/po/fr.po
index afba37d81..2876e04af 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
-"PO-Revision-Date: 2013-03-17 14:32+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
+"PO-Revision-Date: 2013-03-17 22:02+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -6302,7 +6302,10 @@ msgstr ""
"strftime pour le format de date/heure)"
msgid "merge server buffers"
-msgstr "mélange des tampons de serveur"
+msgstr "mélanger les tampons de serveur"
+
+msgid "merge private buffers"
+msgstr "mélanger les tampons privés"
msgid ""
"force position of new channel in list of buffers (none = default position "
diff --git a/po/hu.po b/po/hu.po
index 9b1d3ee65..ef6a3059b 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-16 17:50+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5469,6 +5469,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "pufferek kezelése"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "pufferek kezelése"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/it.po b/po/it.po
index f991b947f..ac6af2d6c 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-17 08:20+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6130,6 +6130,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "unisci i buffer dei server"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "unisci i buffer dei server"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/ja.po b/po/ja.po
index e8cbe585d..197837a4a 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-17 08:20+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -6088,6 +6088,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "サーババッファをマージ"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "サーババッファをマージ"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/pl.po b/po/pl.po
index 1ee7225ed..399882b58 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-17 08:20+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6213,6 +6213,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "połącz bufory serwerów"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "połącz bufory serwerów"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 4f16464e6..c06eba288 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-17 08:20+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5647,6 +5647,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "mesclar buffers de servidores"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "mesclar buffers de servidores"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/ru.po b/po/ru.po
index b5550755e..1d8f3e736 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-03-16 17:50+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5491,6 +5491,10 @@ msgstr ""
msgid "merge server buffers"
msgstr "управление буферами"
+#, fuzzy
+msgid "merge private buffers"
+msgstr "управление буферами"
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/po/weechat.pot b/po/weechat.pot
index a2e4bec59..c614a2faa 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2013-03-17 13:00+0100\n"
+"POT-Creation-Date: 2013-03-17 22:01+0100\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4753,6 +4753,9 @@ msgstr ""
msgid "merge server buffers"
msgstr ""
+msgid "merge private buffers"
+msgstr ""
+
msgid ""
"force position of new channel in list of buffers (none = default position "
"(should be last buffer), next = current buffer + 1, near_server = after last "
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index c29a1f050..24789ecc2 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -184,14 +184,13 @@ irc_buffer_nickcmp_cb (void *data,
}
/*
- * Searches for first server buffer that will be used to merge all IRC server
- * buffers.
+ * Searches for the server buffer with the lowest number.
*
* Returns pointer to buffer found, NULL if not found.
*/
struct t_gui_buffer *
-irc_buffer_search_first_for_all_servers ()
+irc_buffer_search_server_lowest_number ()
{
struct t_gui_buffer *ptr_buffer;
struct t_irc_server *ptr_server;
@@ -215,3 +214,45 @@ irc_buffer_search_first_for_all_servers ()
}
return ptr_buffer;
}
+
+/*
+ * Searches for the private buffer with the lowest number.
+ * If server is not NULL, searches only for this server.
+ *
+ * Returns pointer to buffer found, NULL if not found.
+ */
+
+struct t_gui_buffer *
+irc_buffer_search_private_lowest_number (struct t_irc_server *server)
+{
+ struct t_gui_buffer *ptr_buffer;
+ struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
+ int number, number_found;
+
+ ptr_buffer = NULL;
+ number_found = INT_MAX;
+
+ for (ptr_server = (server) ? server : irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)
+ && ptr_channel->buffer)
+ {
+ number = weechat_buffer_get_integer (ptr_channel->buffer,
+ "number");
+ if (number < number_found)
+ {
+ number_found = number;
+ ptr_buffer = ptr_channel->buffer;
+ }
+ }
+ }
+ if (server)
+ break;
+ }
+ return ptr_buffer;
+}
diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h
index 4ed76e6dc..c8204d1bd 100644
--- a/src/plugins/irc/irc-buffer.h
+++ b/src/plugins/irc/irc-buffer.h
@@ -57,6 +57,7 @@ extern int irc_buffer_nickcmp_cb (void *data,
struct t_gui_buffer *buffer,
const char *nick1,
const char *nick2);
-extern struct t_gui_buffer *irc_buffer_search_first_for_all_servers ();
+extern struct t_gui_buffer *irc_buffer_search_server_lowest_number ();
+extern struct t_gui_buffer *irc_buffer_search_private_lowest_number (struct t_irc_server *server);
#endif /* __WEECHAT_IRC_BUFFER_H */
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 8e18bee04..7d2f518f8 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -151,7 +151,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
int auto_switch)
{
struct t_irc_channel *new_channel;
- struct t_gui_buffer *new_buffer;
+ struct t_gui_buffer *new_buffer, *ptr_buffer_for_merge;
int i, buffer_created, current_buffer_number, buffer_position, manual_join;
int noswitch;
char *buffer_name, str_number[32], str_group[32], *channel_name_lower;
@@ -174,6 +174,21 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_nicklist_remove_all (new_buffer);
else
{
+ ptr_buffer_for_merge = NULL;
+ if (channel_type == IRC_CHANNEL_TYPE_PRIVATE)
+ {
+ switch (weechat_config_integer (irc_config_look_pv_buffer))
+ {
+ case IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER:
+ /* merge private buffers by server */
+ ptr_buffer_for_merge = irc_buffer_search_private_lowest_number (server);
+ break;
+ case IRC_CONFIG_LOOK_PV_BUFFER_MERGE_ALL:
+ /* merge *ALL* private buffers */
+ ptr_buffer_for_merge = irc_buffer_search_private_lowest_number (NULL);
+ break;
+ }
+ }
current_buffer_number = weechat_buffer_get_integer (weechat_current_buffer (),
"number");
new_buffer = weechat_buffer_new (buffer_name,
@@ -205,6 +220,8 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
irc_channel_move_near_server (server, channel_type, new_buffer);
break;
}
+ if (ptr_buffer_for_merge)
+ weechat_buffer_merge (new_buffer, ptr_buffer_for_merge);
}
buffer_created = 1;
}
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 97dd98214..cdadf97cd 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -56,6 +56,7 @@ struct t_config_option *irc_config_look_color_nicks_in_server_messages;
struct t_config_option *irc_config_look_color_pv_nick_like_channel;
struct t_config_option *irc_config_look_ctcp_time_format;
struct t_config_option *irc_config_look_server_buffer;
+struct t_config_option *irc_config_look_pv_buffer;
struct t_config_option *irc_config_look_new_channel_position;
struct t_config_option *irc_config_look_new_pv_position;
struct t_config_option *irc_config_look_nick_prefix;
@@ -305,7 +306,7 @@ irc_config_change_look_server_buffer (void *data,
ptr_buffer =
(weechat_config_integer (irc_config_look_server_buffer) ==
IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE) ?
- weechat_buffer_search_main () : irc_buffer_search_first_for_all_servers ();
+ weechat_buffer_search_main () : irc_buffer_search_server_lowest_number ();
if (ptr_buffer)
{
@@ -320,6 +321,70 @@ irc_config_change_look_server_buffer (void *data,
}
/*
+ * Callback for changes on option "irc.look.pv_buffer".
+ */
+
+void
+irc_config_change_look_pv_buffer (void *data,
+ struct t_config_option *option)
+{
+ struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *ptr_buffer;
+
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ /* first unmerge all IRC private buffers */
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)
+ && ptr_channel->buffer)
+ {
+ weechat_buffer_unmerge (ptr_channel->buffer, -1);
+ }
+ }
+ }
+
+ /* merge IRC private buffers */
+ if ((weechat_config_integer (irc_config_look_pv_buffer) == IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER)
+ || (weechat_config_integer (irc_config_look_pv_buffer) == IRC_CONFIG_LOOK_PV_BUFFER_MERGE_ALL))
+ {
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)
+ && ptr_channel->buffer)
+ {
+ ptr_buffer = NULL;
+ switch (weechat_config_integer (irc_config_look_pv_buffer))
+ {
+ case IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER:
+ /* merge private buffers by server */
+ ptr_buffer = irc_buffer_search_private_lowest_number (ptr_server);
+ break;
+ case IRC_CONFIG_LOOK_PV_BUFFER_MERGE_ALL:
+ /* merge *ALL* private buffers */
+ ptr_buffer = irc_buffer_search_private_lowest_number (NULL);
+ break;
+ }
+ if (ptr_buffer && (ptr_channel->buffer != ptr_buffer))
+ weechat_buffer_merge (ptr_channel->buffer, ptr_buffer);
+ }
+ }
+ }
+ }
+}
+
+/*
* Callback for changes on option "irc.look.item_away_message".
*/
@@ -2072,6 +2137,13 @@ irc_config_init ()
"merge_with_core|merge_without_core|independent", 0, 0, "merge_with_core",
NULL, 0, NULL, NULL,
&irc_config_change_look_server_buffer, NULL, NULL, NULL);
+ irc_config_look_pv_buffer = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "pv_buffer", "integer",
+ N_("merge private buffers"),
+ "independent|merge_by_server|merge_all", 0, 0, "independent",
+ NULL, 0, NULL, NULL,
+ &irc_config_change_look_pv_buffer, NULL, NULL, NULL);
irc_config_look_new_channel_position = weechat_config_new_option (
irc_config_file, ptr_section,
"new_channel_position", "integer",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 47ea1bee6..9b28e2ed0 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -29,6 +29,13 @@ enum t_irc_config_look_server_buffer
IRC_CONFIG_LOOK_SERVER_BUFFER_INDEPENDENT,
};
+enum t_irc_config_look_pv_buffer
+{
+ IRC_CONFIG_LOOK_PV_BUFFER_INDEPENDENT = 0,
+ IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER,
+ IRC_CONFIG_LOOK_PV_BUFFER_MERGE_ALL,
+};
+
enum t_irc_config_look_buffer_position
{
IRC_CONFIG_LOOK_BUFFER_POSITION_NONE = 0,
@@ -91,6 +98,7 @@ extern struct t_config_option *irc_config_look_color_nicks_in_server_messages;
extern struct t_config_option *irc_config_look_color_pv_nick_like_channel;
extern struct t_config_option *irc_config_look_ctcp_time_format;
extern struct t_config_option *irc_config_look_server_buffer;
+extern struct t_config_option *irc_config_look_pv_buffer;
extern struct t_config_option *irc_config_look_new_channel_position;
extern struct t_config_option *irc_config_look_new_pv_position;
extern struct t_config_option *irc_config_look_nick_prefix;
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index eb024e4fe..419d73565 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -3383,7 +3383,7 @@ irc_server_create_buffer (struct t_irc_server *server)
break;
case IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITHOUT_CORE:
/* find buffer used to merge all IRC server buffers */
- ptr_buffer_for_merge = irc_buffer_search_first_for_all_servers ();
+ ptr_buffer_for_merge = irc_buffer_search_server_lowest_number ();
break;
}