1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

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

This commit is contained in:
Sébastien Helleu
2021-10-16 10:06:28 +02:00
parent 31b15c1423
commit b3ce8b5282
2 changed files with 9 additions and 10 deletions
+5 -6
View File
@@ -4452,7 +4452,7 @@ IRC_PROTOCOL_CALLBACK(328)
* Callback for the IRC command "329": channel creation date.
*
* Command looks like:
* :server 329 mynick #channel 1205327894
* 329 mynick #channel 1205327894
*/
IRC_PROTOCOL_CALLBACK(329)
@@ -4460,12 +4460,11 @@ IRC_PROTOCOL_CALLBACK(329)
struct t_irc_channel *ptr_channel;
time_t datetime;
IRC_PROTOCOL_MIN_ARGS(5);
IRC_PROTOCOL_MIN_PARAMS(3);
ptr_channel = irc_channel_search (server, argv[3]);
ptr_channel = irc_channel_search (server, params[1]);
datetime = (time_t)(atol ((argv_eol[4][0] == ':') ?
argv_eol[4] + 1 : argv_eol[4]));
datetime = (time_t)(atol (params[2]));
if (ptr_channel)
{
@@ -4494,7 +4493,7 @@ IRC_PROTOCOL_CALLBACK(329)
_("%sChannel %s%s%s created on %s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
argv[3],
params[1],
IRC_COLOR_RESET,
weechat_util_get_time_string (&datetime));
}
+4 -4
View File
@@ -2721,13 +2721,13 @@ TEST(IrcProtocolWithServer, 329)
{
SRV_INIT_JOIN;
/* not enough arguments */
/* not enough parameters */
RECV(":server 329");
CHECK_ERROR_ARGS("329", 2, 5);
CHECK_ERROR_PARAMS("329", 0, 3);
RECV(":server 329 alice");
CHECK_ERROR_ARGS("329", 3, 5);
CHECK_ERROR_PARAMS("329", 1, 3);
RECV(":server 329 alice #test");
CHECK_ERROR_ARGS("329", 4, 5);
CHECK_ERROR_PARAMS("329", 2, 3);
RECV(":server 329 alice #test 1205327894");
CHECK_CHAN("-- Channel created on Wed, 12 Mar 2008 13:18:14");