mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 19:23:13 +02:00
irc: use parsed command parameters in "338" command callback
This commit is contained in:
@@ -4797,28 +4797,35 @@ IRC_PROTOCOL_CALLBACK(333)
|
||||
* Callback for the IRC command "338": whois, host.
|
||||
*
|
||||
* Command looks like:
|
||||
* :server 338 mynick nick host :actually using host
|
||||
* 338 mynick nick host :actually using host
|
||||
*/
|
||||
|
||||
IRC_PROTOCOL_CALLBACK(338)
|
||||
{
|
||||
IRC_PROTOCOL_MIN_ARGS(6);
|
||||
char *str_text;
|
||||
|
||||
IRC_PROTOCOL_MIN_PARAMS(4);
|
||||
|
||||
str_text = 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",
|
||||
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_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
|
||||
str_text,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
argv[4]);
|
||||
params[2]);
|
||||
|
||||
if (str_text)
|
||||
free (str_text);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -2869,15 +2869,15 @@ TEST(IrcProtocolWithServer, 338)
|
||||
{
|
||||
SRV_INIT;
|
||||
|
||||
/* not enough arguments */
|
||||
/* not enough parameters */
|
||||
RECV(":server 338");
|
||||
CHECK_ERROR_ARGS("338", 2, 6);
|
||||
CHECK_ERROR_PARAMS("338", 0, 4);
|
||||
RECV(":server 338 alice");
|
||||
CHECK_ERROR_ARGS("338", 3, 6);
|
||||
CHECK_ERROR_PARAMS("338", 1, 4);
|
||||
RECV(":server 338 alice bob");
|
||||
CHECK_ERROR_ARGS("338", 4, 6);
|
||||
RECV(":server 338 alice bob host");
|
||||
CHECK_ERROR_ARGS("338", 5, 6);
|
||||
CHECK_ERROR_PARAMS("338", 2, 4);
|
||||
RECV(":server 338 alice bob hostname");
|
||||
CHECK_ERROR_PARAMS("338", 3, 4);
|
||||
|
||||
RECV(":server 338 alice bob hostname :actually using host");
|
||||
CHECK_SRV("-- [bob] actually using host hostname");
|
||||
|
||||
Reference in New Issue
Block a user