1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

irc: fix target buffer for commands 432/433 when the nickname looks like a channel

This commit is contained in:
Sébastien Helleu
2023-03-31 19:52:34 +02:00
parent 7558fe7c1b
commit 10b2fa3a61
3 changed files with 43 additions and 19 deletions
+1
View File
@@ -55,6 +55,7 @@ Bug fixes::
* buflist: do not display keys added in default context on first load
* fset: remove scroll to top of fset buffer when options are added or removed (issue #1892)
* irc: fix join of channels in "autojoin" server option on first connection to server if auto reconnection is performed (issue #1873)
* irc: fix target buffer for commands 432/433 (erroneous nickname/nickname already in use) when the nickname looks like a channel
* spell: check buffer pointer received in info "spell_dict"
* typing: fix crash when pointer buffer is not received in callback for signal "input_text_changed" (issue #1869)
+13 -5
View File
@@ -1395,7 +1395,9 @@ IRC_PROTOCOL_CALLBACK(generic_error)
if (params[arg_error + 1])
{
if (irc_channel_is_channel (server, params[arg_error]))
if ((strcmp (command, "432") != 0)
&& (strcmp (command, "433") != 0)
&& irc_channel_is_channel (server, params[arg_error]))
{
pos_channel = params[arg_error];
ptr_channel = irc_channel_search (server, pos_channel);
@@ -6519,8 +6521,11 @@ IRC_PROTOCOL_CALLBACK(368)
/*
* Callback for the IRC command "432": erroneous nickname.
*
* Command looks like:
* 432 * mynick :Erroneous Nickname
* Command looks like (not connected to server):
* 432 * nick :Erroneous Nickname
*
* Command looks like (connected to server):
* 432 mynick nick :Erroneous Nickname
*/
IRC_PROTOCOL_CALLBACK(432)
@@ -6568,8 +6573,11 @@ IRC_PROTOCOL_CALLBACK(432)
/*
* Callback for the IRC command "433": nickname already in use.
*
* Command looks like:
* 433 * mynick :Nickname is already in use.
* Command looks like (not connected to server):
* 433 * nick :Nickname is already in use.
*
* Command looks like (connected to server):
* 433 mynick nick :Nickname is already in use.
*/
IRC_PROTOCOL_CALLBACK(433)
+29 -14
View File
@@ -3865,7 +3865,7 @@ TEST(IrcProtocolWithServer, 432_not_connected)
TEST(IrcProtocolWithServer, 432_connected)
{
SRV_INIT;
SRV_INIT_JOIN;
/* not enough parameters */
RECV(":server 432");
@@ -3873,12 +3873,19 @@ TEST(IrcProtocolWithServer, 432_connected)
RECV(":server 432 alice");
CHECK_ERROR_PARAMS("432", 1, 2);
RECV(":server 432 * alice");
CHECK_SRV("-- * alice");
RECV(":server 432 * alice error");
CHECK_SRV("-- * alice error");
RECV(":server 432 * alice :Erroneous Nickname");
CHECK_SRV("-- * alice Erroneous Nickname");
RECV(":server 432 alice test%+");
CHECK_SRV("-- test%+");
RECV(":server 432 alice test%+ error");
CHECK_SRV("-- test%+: error");
RECV(":server 432 alice test%+ :Erroneous Nickname");
CHECK_SRV("-- test%+: Erroneous Nickname");
/*
* special case: erroneous nick is a channel: check that the message is
* still displayed on the server buffer
*/
RECV(":server 432 alice #test :Erroneous Nickname");
CHECK_SRV("-- #test: Erroneous Nickname");
}
/*
@@ -3908,7 +3915,7 @@ TEST(IrcProtocolWithServer, 433_not_connected)
TEST(IrcProtocolWithServer, 433_connected)
{
SRV_INIT;
SRV_INIT_JOIN;
/* not enough parameters */
RECV(":server 433");
@@ -3916,12 +3923,20 @@ TEST(IrcProtocolWithServer, 433_connected)
RECV(":server 433 alice");
CHECK_ERROR_PARAMS("433", 1, 2);
RECV(":server 433 * alice");
CHECK_SRV("-- * alice");
RECV(":server 433 * alice error");
CHECK_SRV("-- * alice error");
RECV(":server 433 * alice :Nickname is already in use.");
CHECK_SRV("-- * alice Nickname is already in use.");
RECV(":server 433 alice test");
CHECK_SRV("-- test");
RECV(":server 433 alice test error");
CHECK_SRV("-- test: error");
RECV(":server 433 alice test :Nickname is already in use.");
CHECK_SRV("-- test: Nickname is already in use.");
/*
* special case: nickname already used looks like a channel (it should
* never happen in practice): check that the message is still displayed
* on the server buffer
*/
RECV(":server 433 alice #test :Nickname is already in use.");
CHECK_SRV("-- #test: Nickname is already in use.");
}
/*