From e6d5d791cd2edd907eecb205f5c05a5e23d8df27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 19 Feb 2017 08:12:25 +0100 Subject: [PATCH] irc: fix parsing of message 324 (modes) when there is a colon before the modes (closes #913) --- ChangeLog.adoc | 1 + src/plugins/irc/irc-protocol.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 7381e45fa..e49dc1a97 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -32,6 +32,7 @@ Improvements:: Bug fixes:: * core: fix delayed refresh when the signal SIGWINCH is received (terminal resized) (issue #902) + * irc: fix parsing of message 324 (modes) when there is a colon before the modes (issue #913) Build:: diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index e4ccb4a0f..55a3b35a5 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3278,14 +3278,18 @@ IRC_PROTOCOL_CALLBACK(323) IRC_PROTOCOL_CALLBACK(324) { + const char *ptr_modes; struct t_irc_channel *ptr_channel; + ptr_modes = (argc > 4) ? + ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL; + IRC_PROTOCOL_MIN_ARGS(4); ptr_channel = irc_channel_search (server, argv[3]); if (ptr_channel) { - irc_channel_set_modes (ptr_channel, ((argc > 4) ? argv_eol[4] : NULL)); + irc_channel_set_modes (ptr_channel, ptr_modes); if (argc > 4) { (void) irc_mode_channel_set (server, ptr_channel, @@ -3308,8 +3312,7 @@ IRC_PROTOCOL_CALLBACK(324) argv[3], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (argc > 4) ? - ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : "", + (ptr_modes) ? ptr_modes : "", IRC_COLOR_CHAT_DELIMITERS); }