diff src/protocols/jabber/message.c @ 9130:933a19e3a6b3

[gaim-migrate @ 9908] This puts the core in charge of irc-style /commands, which is way cool. Tim did most of the work, I've just been keeping it in sync with CVS, and slowly adding more commands to jabber. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 30 May 2004 19:34:21 +0000
parents d7b5fbc451da
children fe35f55ee984
line wrap: on
line diff
--- a/src/protocols/jabber/message.c	Sun May 30 19:30:14 2004 +0000
+++ b/src/protocols/jabber/message.c	Sun May 30 19:34:21 2004 +0000
@@ -482,7 +482,7 @@
 	JabberChat *chat;
 	JabberMessage *jm;
 	JabberStream *js;
-	char *buf, *body, *xhtml;
+	char *buf;
 
 	if(!msg || !gc)
 		return 0;
@@ -493,42 +493,23 @@
 	if(!chat)
 		return 0;
 
+	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, &body);
+	gaim_markup_html_to_xhtml(buf, &jm->xhtml, &jm->body);
 	g_free(buf);
 
-	if(!strcmp(body, "/configure") || !strcmp(body, "/config")) {
-		jabber_chat_request_room_configure(chat);
-	} else if(!strcmp(body, "/register")) {
-		jabber_chat_register(chat);
-	} 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;
+	if(!chat->xhtml) {
+		g_free(jm->xhtml);
+		jm->xhtml = NULL;
 	}
 
-	g_free(body);
-	g_free(xhtml);
+	jabber_message_send(jm);
+	jabber_message_free(jm);
+
 	return 1;
 }