mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 22:36:38 +02:00
irc: use parsed command parameters in "312" command callback
This commit is contained in:
@@ -3980,31 +3980,38 @@ IRC_PROTOCOL_CALLBACK(311)
|
||||
* Callback for the IRC command "312": whois, server.
|
||||
*
|
||||
* Command looks like:
|
||||
* :server 312 mynick nick tungsten.libera.chat :Umeå, SE
|
||||
* 312 mynick nick tungsten.libera.chat :Umeå, SE
|
||||
*/
|
||||
|
||||
IRC_PROTOCOL_CALLBACK(312)
|
||||
{
|
||||
IRC_PROTOCOL_MIN_ARGS(6);
|
||||
char *str_params;
|
||||
|
||||
IRC_PROTOCOL_MIN_PARAMS(4);
|
||||
|
||||
str_params = irc_protocol_string_params (params, 3, num_params - 1);
|
||||
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
server, argv[3], command, "whois", NULL),
|
||||
server, params[1], command, "whois", NULL),
|
||||
date,
|
||||
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
|
||||
"%s%s[%s%s%s] %s%s %s(%s%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,
|
||||
argv[4],
|
||||
params[2],
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
IRC_COLOR_RESET,
|
||||
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
|
||||
str_params,
|
||||
IRC_COLOR_CHAT_DELIMITERS);
|
||||
|
||||
if (str_params)
|
||||
free (str_params);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2456,15 +2456,15 @@ TEST(IrcProtocolWithServer, 312)
|
||||
{
|
||||
SRV_INIT;
|
||||
|
||||
/* not enough arguments */
|
||||
/* not enough parameters */
|
||||
RECV(":server 312");
|
||||
CHECK_ERROR_ARGS("312", 2, 6);
|
||||
CHECK_ERROR_PARAMS("312", 0, 4);
|
||||
RECV(":server 312 alice");
|
||||
CHECK_ERROR_ARGS("312", 3, 6);
|
||||
CHECK_ERROR_PARAMS("312", 1, 4);
|
||||
RECV(":server 312 alice bob");
|
||||
CHECK_ERROR_ARGS("312", 4, 6);
|
||||
CHECK_ERROR_PARAMS("312", 2, 4);
|
||||
RECV(":server 312 alice bob server");
|
||||
CHECK_ERROR_ARGS("312", 5, 6);
|
||||
CHECK_ERROR_PARAMS("312", 3, 4);
|
||||
|
||||
RECV(":server 312 alice bob server :https://example.com/");
|
||||
CHECK_SRV("-- [bob] server (https://example.com/)");
|
||||
|
||||
Reference in New Issue
Block a user