1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

irc: use parsed command parameters in "001" command callback

This commit is contained in:
Sébastien Helleu
2021-10-15 19:58:19 +02:00
parent ec816b4be5
commit 0ea0b24563
2 changed files with 8 additions and 4 deletions
+4 -4
View File
@@ -3379,7 +3379,7 @@ IRC_PROTOCOL_CALLBACK(warn)
* Callback for the IRC command "001": connected to IRC server.
*
* Command looks like:
* :server 001 mynick :Welcome to the dancer-ircd Network
* 001 mynick :Welcome to the dancer-ircd Network
*/
IRC_PROTOCOL_CALLBACK(001)
@@ -3389,10 +3389,10 @@ IRC_PROTOCOL_CALLBACK(001)
const char *ptr_server_command;
int length;
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_MIN_PARAMS(1);
if (irc_server_strcasecmp (server, server->nick, argv[2]) != 0)
irc_server_set_nick (server, argv[2]);
if (irc_server_strcasecmp (server, server->nick, params[0]) != 0)
irc_server_set_nick (server, params[0]);
irc_protocol_cb_numeric (server, date, irc_message,
tags, nick, address, host, command,
@@ -1984,6 +1984,10 @@ TEST(IrcProtocolWithServer, 001_empty)
LONGS_EQUAL(0, ptr_server->is_connected);
STRCMP_EQUAL("nick1", ptr_server->nick);
/* not enough parameters */
RECV(":server 001");
CHECK_ERROR_PARAMS("001", 0, 1);
RECV(":server 001 alice");
CHECK_NO_MSG;
LONGS_EQUAL(1, ptr_server->is_connected);