changeset 8504:534b479692d0

[gaim-migrate @ 9240] Patch to make IRC topics such as "Gaim > Oranges" display correctly in conversation windows. This is from A. C. Li, I think. Right? In any case, thanks to the author committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 25 Mar 2004 22:57:37 +0000
parents 4c3ec649fd7d
children 112f5762a41a
files src/protocols/irc/cmds.c src/protocols/irc/msgs.c
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/cmds.c	Thu Mar 25 06:51:51 2004 +0000
+++ b/src/protocols/irc/cmds.c	Thu Mar 25 22:57:37 2004 +0000
@@ -23,8 +23,10 @@
 #include "internal.h"
 
 #include "conversation.h"
+#include "debug.h"
 #include "notify.h"
-#include "debug.h"
+#include "util.c"
+
 #include "irc.h"
 
 
@@ -462,9 +464,11 @@
 	if (!args[0]) {
 		topic = gaim_conv_chat_get_topic (GAIM_CONV_CHAT(convo));
 
-		if (topic)
-			buf = g_strdup_printf(_("current topic is: %s"), topic);
-		else
+		if (topic) {
+			char *tmp = gaim_escape_html(topic);
+			buf = g_strdup_printf(_("current topic is: %s"), tmp);
+			g_free(tmp);
+		} else
 			buf = g_strdup(_("No topic is set"));
 		gaim_conv_chat_write(GAIM_CONV_CHAT(convo), target, buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 		g_free(buf);
--- a/src/protocols/irc/msgs.c	Thu Mar 25 06:51:51 2004 +0000
+++ b/src/protocols/irc/msgs.c	Thu Mar 25 22:57:37 2004 +0000
@@ -255,7 +255,7 @@
 
 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
-	char *chan, *topic, *msg, *nick;
+	char *chan, *topic, *msg, *nick, *tmp;
 	GaimConversation *convo;
 
 	if (!strcmp(name, "topic")) {
@@ -272,17 +272,19 @@
 	}
 	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);
-		msg = g_strdup_printf(_("%s has changed the topic to: %s"), 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, topic);
+		msg = g_strdup_printf(_("The topic for %s is: %s"), chan, tmp);
 		gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 	}
+	g_free(tmp);
 }
 
 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args)