changeset 8858:d7b5fbc451da

[gaim-migrate @ 9626] fix a couple things. a bug with topic changing when there was no topic, a bug with /commands in jabber when you had formatting turned on, and fix some warning in gtkimhtml, i forget what committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 02 May 2004 18:12:08 +0000
parents 15ddfb03f4c7
children 5989b8abed57
files src/gtkconv.c src/gtkimhtml.c src/protocols/jabber/message.c
diffstat 3 files changed, 41 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Sun May 02 17:57:10 2004 +0000
+++ b/src/gtkconv.c	Sun May 02 18:12:08 2004 +0000
@@ -3483,7 +3483,8 @@
 	GaimConnection *gc;
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
-	const char *topic;
+	const char *new_topic;
+	const char *current_topic;
 
 	gc      = gaim_conversation_get_gc(conv);
 
@@ -3495,12 +3496,14 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 	gtkchat = gtkconv->u.chat;
-	topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text));
-
-	if(!g_utf8_collate(topic, gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv))))
+	new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text));
+	current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv));
+
+	if(current_topic && !g_utf8_collate(new_topic, current_topic))
 		return;
 
-	prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), topic);
+	prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)),
+			new_topic);
 }
 
 static GtkWidget *
--- a/src/gtkimhtml.c	Sun May 02 17:57:10 2004 +0000
+++ b/src/gtkimhtml.c	Sun May 02 18:12:08 2004 +0000
@@ -2246,6 +2246,7 @@
 						    font->underline = oldfont->underline;
 						}
 						if (textdec && font->underline != 1
+							&& size
 							&& g_ascii_strcasecmp(size, "underline") == 0
 							&& (imhtml->format_functions & GTK_IMHTML_UNDERLINE))
 						{
--- a/src/protocols/jabber/message.c	Sun May 02 17:57:10 2004 +0000
+++ b/src/protocols/jabber/message.c	Sun May 02 18:12:08 2004 +0000
@@ -482,7 +482,7 @@
 	JabberChat *chat;
 	JabberMessage *jm;
 	JabberStream *js;
-	char *buf, *xhtml;
+	char *buf, *body, *xhtml;
 
 	if(!msg || !gc)
 		return 0;
@@ -493,41 +493,42 @@
 	if(!chat)
 		return 0;
 
-	if(!strcmp(msg, "/configure") || !strcmp(msg, "/config")) {
+	buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", msg);
+	gaim_markup_html_to_xhtml(buf, &xhtml, &body);
+	g_free(buf);
+
+	if(!strcmp(body, "/configure") || !strcmp(body, "/config")) {
 		jabber_chat_request_room_configure(chat);
-		return 1;
-	} else if(!strcmp(msg, "/register")) {
+	} else if(!strcmp(body, "/register")) {
 		jabber_chat_register(chat);
-		return 1;
-	} else if(!strncmp(msg, "/topic", 6)) {
-		jabber_chat_change_topic(chat, strlen(msg) > 7 ? msg+7 : NULL);
-		return 1;
-	} else if(!strncmp(msg, "/nick", 5)) {
-		if(strlen(msg) > 6)
-			jabber_chat_change_nick(chat, msg+6);
-		return 1;
-	} else if(!strncmp(msg, "/part", 5)) {
-		jabber_chat_part(chat, strlen(msg) > 6 ? msg+6 : NULL);
+	} else if(!strncmp(body, "/topic", 6)) {
+		jabber_chat_change_topic(chat, strlen(body) > 7 ? body+7 : NULL);
+	} else if(!strncmp(body, "/nick", 5)) {
+		if(strlen(body) > 6)
+			jabber_chat_change_nick(chat, body+6);
+	} else if(!strncmp(body, "/part", 5)) {
+		jabber_chat_part(chat, strlen(body) > 6 ? body+6 : NULL);
+	} else {
+		jm = g_new0(JabberMessage, 1);
+		jm->js = gc->proto_data;
+		jm->type = JABBER_MESSAGE_GROUPCHAT;
+		jm->to = g_strdup_printf("%s@%s", chat->room, chat->server);
+
+
+		if(chat->xhtml)
+			jm->xhtml = xhtml;
+		else
+			g_free(xhtml);
+
+		jm->body = body;
+
+		jabber_message_send(jm);
+		jabber_message_free(jm);
 		return 1;
 	}
 
-	jm = g_new0(JabberMessage, 1);
-	jm->js = gc->proto_data;
-	jm->type = JABBER_MESSAGE_GROUPCHAT;
-	jm->to = g_strdup_printf("%s@%s", chat->room, chat->server);
-
-	buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", msg);
-
-	gaim_markup_html_to_xhtml(buf, &xhtml, &jm->body);
-	g_free(buf);
-
-	if(chat->xhtml)
-		jm->xhtml = xhtml;
-	else
-		g_free(xhtml);
-
-	jabber_message_send(jm);
-	jabber_message_free(jm);
+	g_free(body);
+	g_free(xhtml);
 	return 1;
 }