summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/irc/irc-protocol.c2
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp25
3 files changed, 18 insertions, 10 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 4d9af0386..55f0fefd7 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -26,6 +26,7 @@ New features::
Bug fixes::
* irc: fix duplicated channels in autojoin option when autojoin_dynamic is enabled (issue #1795)
+ * irc: fix display of QUIT message with an empty trailing parameter (issue #1797)
* relay: fix parsing of IRC messages received from clients (issue #1796)
[[v3.6]]
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 15c4428f7..67941d6bb 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2939,7 +2939,7 @@ IRC_PROTOCOL_CALLBACK(quit)
ptr_channel->has_quit_server = 1;
}
display_host = weechat_config_boolean (irc_config_look_display_host_quit);
- if (str_quit_msg)
+ if (str_quit_msg && str_quit_msg[0])
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index dc7079c7a..838a0cb8c 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -1551,14 +1551,23 @@ TEST(IrcProtocolWithServer, part)
CHECK(ptr_server->channels->nicks);
LONGS_EQUAL(0, ptr_server->channels->part);
+ /* without part message */
RECV(":alice!user@host PART #test");
CHECK_CHAN("<-- alice (user@host) has left #test");
STRCMP_EQUAL("#test", ptr_server->channels->name);
POINTERS_EQUAL(NULL, ptr_server->channels->nicks);
LONGS_EQUAL(1, ptr_server->channels->part);
+ /* without part message (but empty trailing parameter) */
RECV(":alice!user@host JOIN #test");
+ RECV(":alice!user@host PART #test :");
+ CHECK_CHAN("<-- alice (user@host) has left #test");
+ STRCMP_EQUAL("#test", ptr_server->channels->name);
+ POINTERS_EQUAL(NULL, ptr_server->channels->nicks);
+ LONGS_EQUAL(1, ptr_server->channels->part);
+ /* with part message */
+ RECV(":alice!user@host JOIN #test");
RECV(":alice!user@host PART #test :part message ");
CHECK_CHAN("<-- alice (user@host) has left #test (part message )");
STRCMP_EQUAL("#test", ptr_server->channels->name);
@@ -1783,26 +1792,24 @@ TEST(IrcProtocolWithServer, quit)
ptr_channel = ptr_server->channels;
- RECV(":bob!user@host JOIN #test");
- CHECK_CHAN("--> bob (user@host) has joined #test");
- LONGS_EQUAL(2, ptr_channel->nicks_count);
- STRCMP_EQUAL("alice", ptr_channel->nicks->name);
- STRCMP_EQUAL("bob", ptr_channel->last_nick->name);
-
/* without quit message */
+ RECV(":bob!user@host JOIN #test");
RECV(":bob!user@host QUIT");
CHECK_CHAN("<-- bob (user@host) has quit");
LONGS_EQUAL(1, ptr_channel->nicks_count);
STRCMP_EQUAL("alice", ptr_channel->nicks->name);
POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick);
+ /* without quit message (but empty trailing parameter) */
RECV(":bob!user@host JOIN #test");
- CHECK_CHAN("--> bob (user@host) has joined #test");
- LONGS_EQUAL(2, ptr_channel->nicks_count);
+ RECV(":bob!user@host QUIT :");
+ CHECK_CHAN("<-- bob (user@host) has quit");
+ LONGS_EQUAL(1, ptr_channel->nicks_count);
STRCMP_EQUAL("alice", ptr_channel->nicks->name);
- STRCMP_EQUAL("bob", ptr_channel->last_nick->name);
+ POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick);
/* with quit message */
+ RECV(":bob!user@host JOIN #test");
RECV(":bob!user@host QUIT :quit message ");
CHECK_CHAN("<-- bob (user@host) has quit (quit message )");
LONGS_EQUAL(1, ptr_channel->nicks_count);