comparison src/protocols/irc/msgs.c @ 13533:95f4372e63aa

[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 <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 21 Mar 2006 00:47:33 +0000
parents 57bde2deabcb
children cfc2f7fcb3dd
comparison
equal deleted inserted replaced
13532:153434dc60ad 13533:95f4372e63aa
313 /* If this is an interactive update, print it out */ 313 /* If this is an interactive update, print it out */
314 tmp = g_markup_escape_text(topic, -1); 314 tmp = g_markup_escape_text(topic, -1);
315 tmp2 = gaim_markup_linkify(tmp); 315 tmp2 = gaim_markup_linkify(tmp);
316 g_free(tmp); 316 g_free(tmp);
317 if (!strcmp(name, "topic")) { 317 if (!strcmp(name, "topic")) {
318 char *nick_esc; 318 const char *current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(convo));
319 nick = irc_mask_nick(from); 319 if (!(current_topic != NULL && strcmp(tmp2, current_topic) == 0))
320 nick_esc = g_markup_escape_text(nick, -1); 320 {
321 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic); 321 char *nick_esc;
322 msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2); 322 nick = irc_mask_nick(from);
323 g_free(nick_esc); 323 nick_esc = g_markup_escape_text(nick, -1);
324 g_free(nick); 324 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic);
325 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); 325 if (*tmp2)
326 g_free(msg); 326 msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2);
327 else
328 msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc);
329 g_free(nick_esc);
330 g_free(nick);
331 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
332 g_free(msg);
333 }
327 } else { 334 } else {
328 char *chan_esc = g_markup_escape_text(chan, -1); 335 char *chan_esc = g_markup_escape_text(chan, -1);
329 msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2); 336 msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2);
330 g_free(chan_esc); 337 g_free(chan_esc);
331 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic); 338 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic);