From 7f13bdb51ab8f7b4ac0ad092fc45d72c214312ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 14 Sep 2023 20:22:43 +0200 Subject: [PATCH] irc: add option irc.look.open_pv_buffer_echo_msg (issue #2016) --- ChangeLog.adoc | 2 +- po/cs.po | 6 +++++- po/de.po | 6 +++++- po/es.po | 6 +++++- po/fr.po | 10 ++++++++-- po/hu.po | 6 +++++- po/it.po | 6 +++++- po/ja.po | 6 +++++- po/pl.po | 6 +++++- po/pt.po | 6 +++++- po/pt_BR.po | 6 +++++- po/ru.po | 6 +++++- po/sr.po | 6 +++++- po/tr.po | 6 +++++- po/weechat.pot | 6 +++++- src/plugins/irc/irc-config.c | 8 ++++++++ src/plugins/irc/irc-config.h | 1 + src/plugins/irc/irc-protocol.c | 3 ++- tests/unit/plugins/irc/test-irc-protocol.cpp | 16 ++++++++++++++++ 19 files changed, 101 insertions(+), 17 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index ac1377b57..5dc8b2742 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -21,7 +21,7 @@ New features:: Bug fixes:: - * irc: don't open a new private buffer on `/msg` command when capability echo-message is enabled (issue #2016) + irc: add option irc.look.open_pv_buffer_echo_msg to open private buffer on self message when capability echo-message is enabled (issue #2016) * irc: fix title of private buffers wrongly set to own address when capability echo-message is enabled (issue #2016) * irc: fix autojoin of channels when private buffers are opened (issue #2012) * irc: fix string comparison when CASEMAPPING is set to "ascii" diff --git a/po/cs.po b/po/cs.po index c1e7c389f..c9509ce57 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-25 00:48+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -9223,6 +9223,10 @@ msgstr "" "když se změní status nepřítomnosti přezdívky (výsledek příkazu whois), " "například: \"notify_highlight\", \"notify_message\" or \"notify_private\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "zavřít buffer, když je na kanálu spuštěn /part" diff --git a/po/de.po b/po/de.po index de36d6709..84d90dfa0 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-07-05 21:25+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -11460,6 +11460,10 @@ msgstr "" "(Rückgabe durch Befehl whois), zum Beispiel: \"notify_message\", " "\"notify_private\" oder \"notify_highlight\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "schließt den Buffer wenn \"/part\" im Kanal ausgeführt wird" diff --git a/po/es.po b/po/es.po index 8a8e091e1..1ba743353 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -9922,6 +9922,10 @@ msgstr "" "cuando un apodo cambia su estado de ausencia (resultado del comando whois), " "por ejemplo: \"notify_highlight\", \"notify_message\" o \"notify_private\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "cerrar el buffer cuando /part es usado en un canal" diff --git a/po/fr.po b/po/fr.po index 29cec3d03..a7c951876 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" -"PO-Revision-Date: 2023-09-12 15:11+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" +"PO-Revision-Date: 2023-09-14 20:21+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -11242,6 +11242,12 @@ msgstr "" "de la commande whois), par exemple : \"notify_message\", \"notify_private\" " "ou \"notify_highlight\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" +"ouvrir un tampon privé sur son propre message quand la capacité echo-message " +"est activée" + msgid "close buffer when /part is issued on a channel" msgstr "fermer le tampon lorsque /part est exécuté sur un canal" diff --git a/po/hu.po b/po/hu.po index d91b6a488..606af7052 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -8680,6 +8680,10 @@ msgid "" "\"notify_message\", \"notify_private\" or \"notify_highlight\"" msgstr "" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "" diff --git a/po/it.po b/po/it.po index fed5af908..1c515ef96 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -9647,6 +9647,10 @@ msgstr "" "whois), ad esempio: \"notify_message\", \"notify_private\" o " "\"notify_highlight\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "chiude buffer quando viene digitato /part nel canale" diff --git a/po/ja.po b/po/ja.po index c1db28041..22fd90d4c 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -11823,6 +11823,10 @@ msgstr "" "komendy whois), na przykład: \"notify_message\", \"notify_private\" or " "\"notify_highlight\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "zamyka bufor, kiedy na kanale wykonamy /part" diff --git a/po/pt.po b/po/pt.po index 405940be9..e84a20bc8 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -10594,6 +10594,10 @@ msgstr "" "whois), por exemplo: \"notify_message\", \"notify_private\" ou " "\"notify_highlight\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "fechar o buffer ao executar /part num canal" diff --git a/po/pt_BR.po b/po/pt_BR.po index fbf208bf6..a57139258 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: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -9225,6 +9225,10 @@ msgid "" "\"notify_message\", \"notify_private\" or \"notify_highlight\"" msgstr "" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "fechar buffer quando o comando /part é executado em um canal" diff --git a/po/ru.po b/po/ru.po index fb45e5996..ae9de94ab 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -8712,6 +8712,10 @@ msgid "" "\"notify_message\", \"notify_private\" or \"notify_highlight\"" msgstr "" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "" diff --git a/po/sr.po b/po/sr.po index 1e12743d7..b5d8a1f21 100644 --- a/po/sr.po +++ b/po/sr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -11028,6 +11028,10 @@ msgstr "" "се статус одсуства надимка промени (резултат команде whois), на пример: " "„notify_message”, „notify_private” или „notify_highlight”" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "затварање бафера када се на каналу изврши /part" diff --git a/po/tr.po b/po/tr.po index 72c8a563d..a084e60d7 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -11393,6 +11393,10 @@ msgstr "" "kullanılan etiketlerin virgülle ayrılmış listesi (komut whois'inin sonucu); " "örneğin: \"notify_message\", \"notify_private\" veya \"notify_highlight\"" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "bir kanalda /part verildiğinde arabelleği kapat" diff --git a/po/weechat.pot b/po/weechat.pot index 3929215dd..93b5c1792 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: 2023-09-12 15:10+0200\n" +"POT-Creation-Date: 2023-09-14 20:21+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -7789,6 +7789,10 @@ msgid "" "\"notify_message\", \"notify_private\" or \"notify_highlight\"" msgstr "" +msgid "" +"open a private buffer on self message when capability echo-message is enabled" +msgstr "" + msgid "close buffer when /part is issued on a channel" msgstr "" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 0c40f86c7..79a054c0f 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -103,6 +103,7 @@ struct t_config_option *irc_config_look_notice_welcome_redirect = NULL; struct t_config_option *irc_config_look_notice_welcome_tags = NULL; struct t_config_option *irc_config_look_notify_tags_ison = NULL; struct t_config_option *irc_config_look_notify_tags_whois = NULL; +struct t_config_option *irc_config_look_open_pv_buffer_echo_msg = NULL; struct t_config_option *irc_config_look_part_closes_buffer = NULL; struct t_config_option *irc_config_look_pv_buffer = NULL; struct t_config_option *irc_config_look_pv_tags = NULL; @@ -3266,6 +3267,13 @@ irc_config_init () "\"notify_highlight\""), NULL, 0, 0, "notify_message", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_open_pv_buffer_echo_msg = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "open_pv_buffer_echo_msg", "boolean", + N_("open a private buffer on self message when capability " + "echo-message is enabled"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_part_closes_buffer = weechat_config_new_option ( irc_config_file, irc_config_section_look, "part_closes_buffer", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 51f845f19..a35b3240e 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -139,6 +139,7 @@ extern struct t_config_option *irc_config_look_notice_welcome_redirect; extern struct t_config_option *irc_config_look_notice_welcome_tags; extern struct t_config_option *irc_config_look_notify_tags_ison; extern struct t_config_option *irc_config_look_notify_tags_whois; +extern struct t_config_option *irc_config_look_open_pv_buffer_echo_msg; extern struct t_config_option *irc_config_look_part_closes_buffer; extern struct t_config_option *irc_config_look_pv_buffer; extern struct t_config_option *irc_config_look_pv_tags; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 11a6717dd..dd687d7f6 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3232,7 +3232,8 @@ IRC_PROTOCOL_CALLBACK(privmsg) if (strcmp (ptr_channel->name, remote_nick) != 0) irc_channel_pv_rename (server, ptr_channel, remote_nick); } - else if (!nick_is_me || !cap_echo_message) + else if (!nick_is_me || !cap_echo_message + || weechat_config_boolean (irc_config_look_open_pv_buffer_echo_msg)) { ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_PRIVATE, diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index a8c0b4297..0bdd76d54 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2798,9 +2798,17 @@ TEST(IrcProtocolWithServer, privmsg) { /* with echo-message */ RECV(":alice!user@host PRIVMSG bob :this is the message "); + CHECK_PV_CLOSE("bob", "alice", "this is the message ", + "irc_privmsg,self_msg,notify_none,no_highlight," + "prefix_nick_white,nick_alice,host_user@host,log1"); + /* with echo-message, option irc.look.open_pv_buffer_echo_msg off */ + config_file_option_set (irc_config_look_open_pv_buffer_echo_msg, + "off", 1); + RECV(":alice!user@host PRIVMSG bob :this is the message "); CHECK_SRV("--", "Msg(alice) -> bob: this is the message ", "irc_privmsg,self_msg,notify_none,no_highlight," "nick_alice,host_user@host,log1"); + config_file_option_reset (irc_config_look_open_pv_buffer_echo_msg, 1); } /* @@ -2819,9 +2827,17 @@ TEST(IrcProtocolWithServer, privmsg) { /* with echo-message */ RECV(":alice!user@host PRIVMSG nickserv :identify secret"); + CHECK_PV_CLOSE("nickserv", "alice", "identify ******", + "irc_privmsg,self_msg,notify_none,no_highlight," + "prefix_nick_white,nick_alice,host_user@host,log1"); + /* with echo-message, option irc.look.open_pv_buffer_echo_msg off */ + config_file_option_set (irc_config_look_open_pv_buffer_echo_msg, + "off", 1); + RECV(":alice!user@host PRIVMSG nickserv :identify secret"); CHECK_SRV("--", "Msg(alice) -> nickserv: identify ******", "irc_privmsg,self_msg,notify_none,no_highlight," "nick_alice,host_user@host,log1"); + config_file_option_reset (irc_config_look_open_pv_buffer_echo_msg, 1); } /* broken CTCP to channel */