changeset 9518:6c24a6f07256

[gaim-migrate @ 10345] " Updates irc and silc to pass the topic setter to gaim_conv_chat_set_topic. Theres more code duplication in here than I would like, but it's better than adding another var and adding more conditionals.." --Gary Kramlich committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 12 Jul 2004 19:38:05 +0000
parents 0524b36c701a
children 8cd47267c5bd
files src/protocols/irc/msgs.c src/protocols/silc/ops.c
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/msgs.c	Mon Jul 12 19:37:07 2004 +0000
+++ b/src/protocols/irc/msgs.c	Mon Jul 12 19:38:05 2004 +0000
@@ -270,17 +270,19 @@
 	if (!convo) {
 		gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan);
 	}
-	gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic);
+
 	/* If this is an interactive update, print it out */
 	tmp = gaim_escape_html(topic);
 	if (!strcmp(name, "topic")) {
 		nick = irc_mask_nick(from);
+		gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic);
 		msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick, tmp);
 		g_free(nick);
 		gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 	} else {
 		msg = g_strdup_printf(_("The topic for %s is: %s"), chan, tmp);
+		gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic);
 		gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 	}
--- a/src/protocols/silc/ops.c	Mon Jul 12 19:37:07 2004 +0000
+++ b/src/protocols/silc/ops.c	Mon Jul 12 19:38:05 2004 +0000
@@ -334,6 +334,8 @@
 				   client_entry->nickname, channel->channel_name, tmp);
 			gaim_conv_chat_write(GAIM_CONV_CHAT(convo), client_entry->nickname,
 					     buf, GAIM_MESSAGE_SYSTEM, time(NULL));
+			gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo),
+									 client_entry->nickname, tmp);
 		} else if (idtype == SILC_ID_SERVER) {
 			server_entry = (SilcServerEntry)entry;
 			g_snprintf(buf, sizeof(buf),
@@ -341,6 +343,8 @@
 				   server_entry->server_name, channel->channel_name, tmp);
 			gaim_conv_chat_write(GAIM_CONV_CHAT(convo), server_entry->server_name,
 					     buf, GAIM_MESSAGE_SYSTEM, time(NULL));
+			gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo),
+									 server_entry->server_name, tmp);
 		} else if (idtype == SILC_ID_CHANNEL) {
 			channel = (SilcChannelEntry)entry;
 			g_snprintf(buf, sizeof(buf),
@@ -348,10 +352,12 @@
 				   channel->channel_name, channel->channel_name, tmp);
 			gaim_conv_chat_write(GAIM_CONV_CHAT(convo), channel->channel_name,
 					     buf, GAIM_MESSAGE_SYSTEM, time(NULL));
+			gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo),
+									 channel->channel_name, tmp);
+		} else {
+			gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, tmp);
 		}
 
-		gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, tmp);
-
 		break;
 
 	case SILC_NOTIFY_TYPE_NICK_CHANGE: