diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-09-17 16:22:07 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-09-17 16:22:07 +0200 |
commit | 13ec5f368337e55dc1e57c411cbb80777fda06a9 (patch) | |
tree | 1e30674a463187e9e4f63d38bd9194ed8de4304a /src | |
parent | 348d74b470761d9230449325b5df9289ce58db69 (diff) | |
download | weechat-13ec5f368337e55dc1e57c411cbb80777fda06a9.zip |
Fix crash when parsing IRC CTCP ACTION or DCC without argument
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-ctcp.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index d3af58e03..088411aa6 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -119,7 +119,7 @@ irc_ctcp_display_request (struct t_irc_server *server, IRC_COLOR_CHAT, IRC_COLOR_CHAT_CHANNEL, ctcp, - IRC_COLOR_CHAT, + (arguments) ? IRC_COLOR_CHAT : "", (arguments) ? " " : "", (arguments) ? arguments : ""); } @@ -253,7 +253,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server, IRC_COLOR_CHAT, IRC_COLOR_CHAT_CHANNEL, ctcp, - IRC_COLOR_CHAT, + (arguments) ? IRC_COLOR_CHAT : "", (arguments) ? " " : "", (arguments) ? arguments : ""); } @@ -370,6 +370,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, struct t_infolist_item *item; char plugin_id[128]; + if (!arguments || !arguments[0]) + return; + if (strncmp (arguments, "SEND ", 5) == 0) { arguments += 5; @@ -828,8 +831,9 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command, irc_channel_nick_speaking_add (channel, nick, + (pos_args) ? weechat_string_has_highlight (pos_args, - server->nick)); + server->nick) : 0); irc_channel_nick_speaking_time_remove_old (channel); irc_channel_nick_speaking_time_add (channel, nick, time (NULL)); @@ -837,12 +841,13 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command, weechat_printf_tags (channel->buffer, irc_protocol_tags (command, "irc_action,notify_message"), - "%s%s%s %s%s", + "%s%s%s%s%s%s", weechat_prefix ("action"), (ptr_nick) ? ptr_nick->color : IRC_COLOR_CHAT_NICK, nick, - IRC_COLOR_CHAT, - pos_args); + (pos_args) ? IRC_COLOR_CHAT : "", + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); } else { @@ -872,13 +877,14 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command, (nick_is_me) ? "irc_action,notify_private,no_highlight" : "irc_action,notify_private"), - "%s%s%s %s%s", + "%s%s%s%s%s%s", weechat_prefix ("action"), (nick_is_me) ? IRC_COLOR_CHAT_NICK_SELF : IRC_COLOR_CHAT_NICK_OTHER, nick, - IRC_COLOR_CHAT, - pos_args); + (pos_args) ? IRC_COLOR_CHAT : "", + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); weechat_hook_signal_send ("irc_pv", WEECHAT_HOOK_SIGNAL_STRING, message); @@ -906,7 +912,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command, { irc_ctcp_display_request (server, command, channel, nick, arguments + 1, pos_args); - + if (reply[0]) { decoded_reply = irc_ctcp_replace_variables (server, reply); @@ -930,7 +936,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command, IRC_COLOR_CHAT, IRC_COLOR_CHAT_CHANNEL, arguments + 1, - IRC_COLOR_CHAT, + (pos_args) ? IRC_COLOR_CHAT : "", (pos_args) ? " " : "", (pos_args) ? pos_args : ""); } |