diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 183d24719..5d1a10645 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3673,34 +3673,36 @@ IRC_PROTOCOL_CALLBACK(008) * Callback for the IRC command "221": user mode string. * * Command looks like: - * :server 221 nick :+s + * 221 nick :+s */ IRC_PROTOCOL_CALLBACK(221) { - IRC_PROTOCOL_MIN_ARGS(4); + char *str_params; + + IRC_PROTOCOL_MIN_PARAMS(2); + + str_params = irc_protocol_string_params (params, 1, num_params - 1); weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL), + irc_msgbuffer_get_target_buffer (server, params[0], command, NULL, NULL), date, irc_protocol_tags (command, "irc_numeric", NULL, address), _("%sUser mode for %s%s%s is %s[%s%s%s]"), weechat_prefix ("network"), - irc_nick_color_for_msg (server, 1, NULL, argv[2]), - argv[2], + irc_nick_color_for_msg (server, 1, NULL, params[0]), + params[0], IRC_COLOR_RESET, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3], + str_params, IRC_COLOR_CHAT_DELIMITERS); - if (irc_server_strcasecmp (server, argv[2], server->nick) == 0) - { - irc_mode_user_set ( - server, - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3], - 1); - } + if (irc_server_strcasecmp (server, params[0], server->nick) == 0) + irc_mode_user_set (server, str_params, 1); + + if (str_params) + free (str_params); return WEECHAT_RC_OK; } |