diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index e06b3acf..1ea6bd2b 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -222,17 +222,21 @@ static void event_topic_get(IRC_SERVER_REC *server, const char *data) static void event_topic_info(IRC_SERVER_REC *server, const char *data) { - char *params, *timestr, *channel, *topicby, *topictime; + char *params, *timestr, *channel, *bynick, *byhost, *topictime; g_return_if_fail(data != NULL); params = event_get_params(data, 4, NULL, &channel, - &topicby, &topictime); + &bynick, &topictime); timestr = my_asctime((time_t) atol(topictime)); - printformat(server, channel, MSGLEVEL_CRAP, - IRCTXT_TOPIC_INFO, topicby, timestr); + byhost = strchr(bynick, '!'); + if (byhost != NULL) + *byhost++ = '\0'; + + printformat(server, channel, MSGLEVEL_CRAP, IRCTXT_TOPIC_INFO, + bynick, timestr, byhost == NULL ? "" : byhost); g_free(timestr); g_free(params); } diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index dafa3dde..4bbdb96a 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -314,7 +314,7 @@ static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { CHANNEL_REC *channel; - char *timestr; + char *timestr, *bynick, *byhost; g_return_if_fail(data != NULL); @@ -326,10 +326,21 @@ static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item) channel->name, channel->topic); if (channel->topic_time > 0) { + byhost = strchr(channel->topic_by, '!'); + if (byhost == NULL) { + bynick = g_strdup(channel->topic_by); + byhost = ""; + } else { + bynick = g_strndup(channel->topic_by, + (int) (byhost-channel->topic_by)); + byhost++; + } + timestr = my_asctime(channel->topic_time); printformat(server, channel->name, MSGLEVEL_CRAP, - IRCTXT_TOPIC_INFO, channel->topic_by, timestr); + IRCTXT_TOPIC_INFO, bynick, timestr, byhost); g_free(timestr); + g_free(bynick); } signal_stop(); } diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index eb97acea..3e895709 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -62,7 +62,7 @@ FORMAT_REC fecommon_irc_formats[] = { { "url", "Home page for {channelhilight $0}: $1", 2, { 0, 0 } }, { "topic", "Topic for {channelhilight $0}: $1", 2, { 0, 0 } }, { "no_topic", "No topic set for {channelhilight $0}", 1, { 0 } }, - { "topic_info", "Topic set by {nick $0} {comment $1}", 2, { 0, 0 } }, + { "topic_info", "Topic set by {nick $0} {nickhost $2} {comment $1}", 3, { 0, 0, 0 } }, { "chanmode_change", "mode/{channelhilight $0} {mode $1} by {nick $2}", 4, { 0, 0, 0, 0 } }, { "server_chanmode_change", "{netsplit ServerMode}/{channelhilight $0} {mode $1} by {nick $2}", 3, { 0, 0, 0 } }, { "channel_mode", "mode/{channelhilight $0} {mode $1}", 2, { 0, 0 } },