# HG changeset patch # User Richard Laager # Date 1142902053 0 # Node ID 95f4372e63aa6fc3baafd9ccd48444d96d9a6673 # Parent 153434dc60ad7ec1cc7ad602f02ee54af052898b [gaim-migrate @ 15910] If someone changes the topic to the empty string, make the notice say "USER has cleared the topic." instead of "USER has changed the topic to: " Also, only print a message if the topic has actually changed. committer: Tailor Script diff -r 153434dc60ad -r 95f4372e63aa src/protocols/irc/msgs.c --- a/src/protocols/irc/msgs.c Mon Mar 20 21:52:43 2006 +0000 +++ b/src/protocols/irc/msgs.c Tue Mar 21 00:47:33 2006 +0000 @@ -315,15 +315,22 @@ tmp2 = gaim_markup_linkify(tmp); g_free(tmp); if (!strcmp(name, "topic")) { - char *nick_esc; - nick = irc_mask_nick(from); - nick_esc = g_markup_escape_text(nick, -1); - gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic); - msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2); - g_free(nick_esc); - g_free(nick); - gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); + const char *current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(convo)); + if (!(current_topic != NULL && strcmp(tmp2, current_topic) == 0)) + { + char *nick_esc; + nick = irc_mask_nick(from); + nick_esc = g_markup_escape_text(nick, -1); + gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic); + if (*tmp2) + msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2); + else + msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc); + g_free(nick_esc); + g_free(nick); + gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); + g_free(msg); + } } else { char *chan_esc = g_markup_escape_text(chan, -1); msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2);