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

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

This commit is contained in:
Sébastien Helleu
2021-10-16 09:36:38 +02:00
parent a1a4f337ff
commit 4e1d40034e
2 changed files with 14 additions and 14 deletions
+9 -9
View File
@@ -4100,7 +4100,7 @@ IRC_PROTOCOL_CALLBACK(315)
* Callback for the IRC command "317": whois, idle.
*
* Command looks like:
* :server 317 mynick nick 122877 1205327880 :seconds idle, signon time
* 317 mynick nick 122877 1205327880 :seconds idle, signon time
*/
IRC_PROTOCOL_CALLBACK(317)
@@ -4109,17 +4109,17 @@ IRC_PROTOCOL_CALLBACK(317)
time_t datetime;
struct t_gui_buffer *ptr_buffer;
IRC_PROTOCOL_MIN_ARGS(6);
IRC_PROTOCOL_MIN_PARAMS(4);
idle_time = atoi (argv[4]);
idle_time = atoi (params[2]);
day = idle_time / (60 * 60 * 24);
hour = (idle_time % (60 * 60 * 24)) / (60 * 60);
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
datetime = (time_t)(atol (argv[5]));
datetime = (time_t)(atol (params[3]));
ptr_buffer = irc_msgbuffer_get_target_buffer (server, argv[3],
ptr_buffer = irc_msgbuffer_get_target_buffer (server, params[1],
command, "whois", NULL);
if (day > 0)
@@ -4132,8 +4132,8 @@ IRC_PROTOCOL_CALLBACK(317)
"%s%s, signon at: %s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
irc_nick_color_for_msg (server, 1, NULL, argv[3]),
argv[3],
irc_nick_color_for_msg (server, 1, NULL, params[1]),
params[1],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
@@ -4165,8 +4165,8 @@ IRC_PROTOCOL_CALLBACK(317)
"signon at: %s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
irc_nick_color_for_msg (server, 1, NULL, argv[3]),
argv[3],
irc_nick_color_for_msg (server, 1, NULL, params[1]),
params[1],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
+5 -5
View File
@@ -2530,15 +2530,15 @@ TEST(IrcProtocolWithServer, 317)
SRV_INIT;
/* not enough arguments */
/* not enough parameters */
RECV(":server 317");
CHECK_ERROR_ARGS("317", 2, 6);
CHECK_ERROR_PARAMS("317", 0, 4);
RECV(":server 317 alice");
CHECK_ERROR_ARGS("317", 3, 6);
CHECK_ERROR_PARAMS("317", 1, 4);
RECV(":server 317 alice bob");
CHECK_ERROR_ARGS("317", 4, 6);
CHECK_ERROR_PARAMS("317", 2, 4);
RECV(":server 317 alice bob 122877");
CHECK_ERROR_ARGS("317", 5, 6);
CHECK_ERROR_PARAMS("317", 3, 4);
/* signon at 03/12/2008 @ 1:18pm (UTC) */
RECV(":server 317 alice bob 122877 1205327880");