1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

irc: fix display of QUIT message with an empty trailing parameter (closes #1797)

The regression was introduced with the new way to parse IRC message parameters,
in version 3.4.
This commit is contained in:
Sébastien Helleu
2022-07-21 11:10:29 +02:00
parent 96ed471261
commit 569c93c6fb
3 changed files with 18 additions and 10 deletions
+1
View File
@@ -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]]
+1 -1
View File
@@ -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 (
+16 -9
View File
@@ -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);