diff src/protocols/jabber/message.c @ 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 599d6ac9bbfe
children 933a19e3a6b3
line wrap: on
line diff
--- 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;
 }