From feb51fbca4e9d8a7635d10f5675638991c4e7b0c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 14 Mar 2010 16:48:15 +0100 Subject: Fix display of host in IRC message 333 (channel topic) --- src/plugins/irc/irc-protocol.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 0341ccdba..b3361b5ce 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2800,25 +2800,35 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command, struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; time_t datetime; + const char *nick, *address; /* 333 message looks like: - :server 333 mynick #channel nick 1205428096 + :server 333 mynick #channel nick!user@host 1205428096 */ IRC_PROTOCOL_MIN_ARGS(6); + nick = irc_protocol_get_nick_from_host (argv[4]); + address = irc_protocol_get_address_from_host (argv[4]); + ptr_channel = irc_channel_search (server, argv[3]); - ptr_nick = irc_nick_search (ptr_channel, argv[4]); + ptr_nick = (ptr_channel) ? irc_nick_search (ptr_channel, nick) : NULL; datetime = (time_t)(atol ((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5])); if (ptr_channel && ptr_channel->nicks) { weechat_printf_tags (ptr_channel->buffer, irc_protocol_tags (command, "irc_numeric"), - _("%sTopic set by %s%s%s on %s"), + _("%sTopic set by %s%s%s%s%s%s%s%s%s on %s"), weechat_prefix ("network"), IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), - argv[4], + nick, + IRC_COLOR_CHAT_DELIMITERS, + (address && address[0]) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (address) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + (address && address[0]) ? ")" : "", IRC_COLOR_CHAT, weechat_util_get_time_string (&datetime)); } @@ -2826,13 +2836,19 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command, { weechat_printf_tags (server->buffer, irc_protocol_tags (command, "irc_numeric"), - _("%sTopic for %s%s%s set by %s%s%s on %s"), + _("%sTopic for %s%s%s set by %s%s%s%s%s%s%s%s%s on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, argv[3], IRC_COLOR_CHAT, IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), - argv[4], + nick, + IRC_COLOR_CHAT_DELIMITERS, + (address && address[0]) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (address) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + (address && address[0]) ? ")" : "", IRC_COLOR_CHAT, weechat_util_get_time_string (&datetime)); } -- cgit v1.2.3