From f8f7c04633a37c627b4cca6aba7f65e78960adea Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 24 Oct 2008 12:39:52 +0200 Subject: [PATCH] Display IRC server errors in appropriate buffer (channel or private if found) --- src/plugins/irc/irc-protocol.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 0b938c6d6..09fa4bc60 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -181,6 +181,7 @@ irc_protocol_cmd_error (struct t_irc_server *server, const char *command, { int first_arg; char *chan_nick, *args; + struct t_irc_channel *ptr_channel; IRC_PROTOCOL_MIN_ARGS(4); @@ -202,10 +203,14 @@ irc_protocol_cmd_error (struct t_irc_server *server, const char *command, if (args[0] == ':') args++; - weechat_printf_tags (server->buffer, + ptr_channel = NULL; + if (chan_nick) + ptr_channel = irc_channel_search (server, chan_nick); + + weechat_printf_tags ((ptr_channel) ? ptr_channel->buffer : server->buffer, irc_protocol_tags (command, "irc_error"), "%s%s%s%s", - irc_buffer_get_server_prefix (server, "network"), + (ptr_channel) ? weechat_prefix ("network") : irc_buffer_get_server_prefix (server, "network"), (chan_nick) ? chan_nick : "", (chan_nick) ? ": " : "", args);