From b38b2abe3b397af1133951fb5326cc5cbb80807e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 29 Jan 2019 21:10:49 +0100 Subject: [PATCH] irc: fix parsing of MODE, 341 (invite) and CHGHOST commands when there are colons (closes #1296) --- ChangeLog.adoc | 1 + po/cs.po | 8 ++++---- po/de.po | 8 ++++---- po/es.po | 8 ++++---- po/fr.po | 8 ++++---- po/hu.po | 4 ++-- po/it.po | 8 ++++---- po/ja.po | 6 +++--- po/pl.po | 8 ++++---- po/pt.po | 8 ++++---- po/pt_BR.po | 8 ++++---- po/ru.po | 4 ++-- po/tr.po | 6 +++--- po/weechat.pot | 4 ++-- src/plugins/irc/irc-protocol.c | 28 +++++++++++++++++++++------- 15 files changed, 66 insertions(+), 51 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 77a2be615..5d2262040 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -38,6 +38,7 @@ Bug fixes:: * aspell: look for suggestions only if the misspelled word has changed (issue #1175) * buflist: add alternate key codes for kbd:[F1]/kbd:[F2] and kbd:[Alt+F1]/kbd:[Alt+F2] (compatibility with terminals) * buflist: fix warning displayed when script buffers.pl is loaded (issue #1274) + * irc: fix parsing of MODE, 341 (invite) and CHGHOST commands when there are colons (issue #1296) * irc: return IRC color code instead of WeeChat color code when decoding a too short ANSI color sequence * irc: fix encoding of italic attribute when colors are removed * irc: fix parsing of "time" message tag on FreeBSD (issue #1289) diff --git a/po/cs.po b/po/cs.po index cab5ddab8..22357a7be 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2018-11-17 10:36+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:01+0100\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" "Language: cs\n" @@ -9139,8 +9139,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sByl jste zabit uživatelem %s%s%s" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sMód %s%s %s[%s%s%s]%s od %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sMód %s%s %s[%s%s%s%s%s]%s od %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/de.po b/po/de.po index 88e39830b..13d524c68 100644 --- a/po/de.po +++ b/po/de.po @@ -24,8 +24,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2019-01-26 10:05+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:02+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" "Language: de\n" @@ -10932,8 +10932,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sDu wurdest durch %s%s%s gekillt" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sModus %s%s %s[%s%s%s]%s durch %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sModus %s%s %s[%s%s%s%s%s]%s durch %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/es.po b/po/es.po index 243b790e4..6982e37ba 100644 --- a/po/es.po +++ b/po/es.po @@ -22,8 +22,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2018-11-17 10:36+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:02+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" "Language: es\n" @@ -9462,8 +9462,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sFuiste desconectado por %s%s%s" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sModo %s%s %s[%s%s%s]%s por %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sModo %s%s %s[%s%s%s%s%s]%s por %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/fr.po b/po/fr.po index 04c674dd0..fc68cd41e 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: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2019-01-26 10:05+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:01+0100\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -10676,8 +10676,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sVous avez été tué par %s%s%s" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sMode %s%s %s[%s%s%s]%s par %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sMode %s%s %s[%s%s%s%s%s]%s par %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/hu.po b/po/hu.po index f7398fd49..7f2ddcd68 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: 2019-01-26 09:58+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" "PO-Revision-Date: 2018-11-17 10:36+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -8537,7 +8537,7 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "Az új neved: %s%s\n" #, fuzzy, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" msgstr "A %s%s %s[%s%s%s]%s üzemmódot bekapcsolta: %s%s\n" #, fuzzy, c-format diff --git a/po/it.po b/po/it.po index d437b8d0d..5b167c73b 100644 --- a/po/it.po +++ b/po/it.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2018-11-17 10:36+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:03+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" "Language: it\n" @@ -9658,8 +9658,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sSei stato ucciso da %s%s%s" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sModalità %s%s %s[%s%s%s]%s da %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sModalità %s%s %s[%s%s%s%s%s]%s da %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/ja.po b/po/ja.po index de7b278df..001359360 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: 2019-01-26 09:58+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" "PO-Revision-Date: 2019-01-26 10:06+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" "Language: pl\n" @@ -10426,8 +10426,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sZostałeś zabity przez %s%s%s" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sTryb %s%s %s[%s%s%s]%s ustawiony przez %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sTryb %s%s %s[%s%s%s%s%s]%s ustawiony przez %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/pt.po b/po/pt.po index 543073c0f..b9250e406 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2019-01-20 18:45+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:04+0100\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" "Language: pt\n" @@ -10119,8 +10119,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "%s%sFoi morto por %s%s%s" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sModo %s%s %s[%s%s%s]%s por %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sModo %s%s %s[%s%s%s%s%s]%s por %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/pt_BR.po b/po/pt_BR.po index 08d4fcdef..594107390 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2018-11-17 10:36+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:05+0100\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" "Language: pt_BR\n" @@ -8978,8 +8978,8 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" -msgstr "%sModo %s%s %s[%s%s%s]%s por %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" +msgstr "%sModo %s%s %s[%s%s%s%s%s]%s por %s%s" #, c-format msgid "%sUser mode %s[%s%s%s]%s by %s%s" diff --git a/po/ru.po b/po/ru.po index a3f8cdb4c..f0ef758a2 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: 2019-01-26 09:58+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" "PO-Revision-Date: 2018-11-17 10:36+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -8574,7 +8574,7 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "Теперь вы известны как %s%s\n" #, fuzzy, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" msgstr "Режим %s%s %s[%s%s%s]%s установлен пользователем %s%s\n" #, fuzzy, c-format diff --git a/po/tr.po b/po/tr.po index 4c1286be5..c95afe693 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-01-26 09:58+0100\n" -"PO-Revision-Date: 2018-11-17 10:36+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" +"PO-Revision-Date: 2019-01-29 21:05+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" "Language: tr\n" @@ -7765,7 +7765,7 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" msgstr "" #, c-format diff --git a/po/weechat.pot b/po/weechat.pot index f19e8fba4..626d3f0c6 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: 2019-01-26 09:58+0100\n" +"POT-Creation-Date: 2019-01-29 17:06+0100\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -7627,7 +7627,7 @@ msgid "%s%sYou were killed by %s%s%s" msgstr "" #, c-format -msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" +msgid "%sMode %s%s %s[%s%s%s%s%s]%s by %s%s" msgstr "" #, c-format diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 9403d6d5a..eca3c59aa 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -767,12 +767,13 @@ IRC_PROTOCOL_CALLBACK(cap) * :nick!user@host CHGHOST user new.host.goes.here * :nick!user@host CHGHOST newuser host * :nick!user@host CHGHOST newuser new.host.goes.here + * :nick!user@host CHGHOST newuser :new.host.goes.here */ IRC_PROTOCOL_CALLBACK(chghost) { int length, local_chghost, smart_filter; - char *str_host; + char *str_host, *pos_new_host; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; struct t_irc_channel_speaking *ptr_nick_speaking; @@ -782,7 +783,9 @@ IRC_PROTOCOL_CALLBACK(chghost) local_chghost = (irc_server_strcasecmp (server, nick, server->nick) == 0); - length = strlen (argv[2]) + 1 + strlen (argv[3]) + 1; + pos_new_host = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]; + + length = strlen (argv[2]) + 1 + strlen (pos_new_host) + 1; str_host = malloc (length); if (!str_host) { @@ -793,7 +796,7 @@ IRC_PROTOCOL_CALLBACK(chghost) return WEECHAT_RC_OK; } - snprintf (str_host, length, "%s@%s", argv[2], argv[3]); + snprintf (str_host, length, "%s@%s", argv[2], pos_new_host); for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { @@ -1380,11 +1383,12 @@ IRC_PROTOCOL_CALLBACK(kill) * * Message looks like: * :nick!user@host MODE #test +o nick + * :nick!user@host MODE #test :+o :nick */ IRC_PROTOCOL_CALLBACK(mode) { - char *pos_modes; + char *pos_modes, *pos_modes_args; int smart_filter, local_mode; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; @@ -1393,7 +1397,10 @@ IRC_PROTOCOL_CALLBACK(mode) IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; - pos_modes = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]; + pos_modes = (argv[3][0] == ':') ? argv[3] + 1 : argv[3]; + pos_modes_args = NULL; + if (argc > 4) + pos_modes_args = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; if (irc_channel_is_channel (server, argv[2])) { @@ -1415,13 +1422,15 @@ IRC_PROTOCOL_CALLBACK(mode) (smart_filter && !local_mode) ? "irc_smart_filter" : NULL, NULL, address), - _("%sMode %s%s %s[%s%s%s]%s by %s%s"), + _("%sMode %s%s %s[%s%s%s%s%s]%s by %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, (ptr_channel) ? ptr_channel->name : argv[2], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, pos_modes, + (pos_modes_args) ? " " : "", + (pos_modes_args) ? pos_modes_args : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, irc_nick_color_for_msg (server, 1, ptr_nick, nick), @@ -4032,12 +4041,17 @@ IRC_PROTOCOL_CALLBACK(338) * * Message looks like: * :server 341 mynick nick #channel + * :server 341 mynick nick :#channel */ IRC_PROTOCOL_CALLBACK(341) { + char *pos_channel; + IRC_PROTOCOL_MIN_ARGS(5); + pos_channel = (argv[4][0] == ':') ? argv[4] + 1 : argv[4]; + weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL), date, @@ -4051,7 +4065,7 @@ IRC_PROTOCOL_CALLBACK(341) argv[3], IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - argv[4], + pos_channel, IRC_COLOR_RESET); return WEECHAT_RC_OK;