changeset 15917:26593bef6568

Minor code cleanup
author Mark Doliner <mark@kingant.net>
date Sun, 25 Mar 2007 07:07:29 +0000
parents 4be5d38ee117
children f33506aa71af
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/message.c
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Mar 25 07:01:57 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Mar 25 07:07:29 2007 +0000
@@ -171,12 +171,16 @@
 
 void jabber_process_packet(JabberStream *js, xmlnode *packet)
 {
+	const char *xmlns;
+
 	purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, &packet);
 
 	/* if the signal leaves us with a null packet, we're done */
 	if(NULL == packet)
 		return;
 
+	xmlns = xmlnode_get_namespace(packet);
+
 	if(!strcmp(packet->name, "iq")) {
 		jabber_iq_parse(js, packet);
 	} else if(!strcmp(packet->name, "presence")) {
@@ -185,13 +189,13 @@
 		jabber_message_parse(js, packet);
 	} else if(!strcmp(packet->name, "stream:features")) {
 		jabber_stream_features_parse(js, packet);
-	} else if (!strcmp(packet->name, "features") && 
-		   !strcmp(xmlnode_get_namespace(packet), "http://etherx.jabber.org/streams")) {
+	} else if (!strcmp(packet->name, "features") &&
+		   !strcmp(xmlns, "http://etherx.jabber.org/streams")) {
 		jabber_stream_features_parse(js, packet);
-	} else if(!strcmp(packet->name, "stream:error")) {
-		jabber_stream_handle_error(js, packet);
-	} else if (!strcmp(packet->name, "error") &&
-		   !strcmp(xmlnode_get_namespace(packet), "http://etherx.jabber.org/streams")) {
+	} else if(!strcmp(packet->name, "stream:error") ||
+			 (!strcmp(packet->name, "error") &&
+				!strcmp(xmlns, "http://etherx.jabber.org/streams")))
+	{
 		jabber_stream_handle_error(js, packet);
 	} else if(!strcmp(packet->name, "challenge")) {
 		if(js->state == JABBER_STREAM_AUTHENTICATING)
@@ -1530,7 +1534,7 @@
 		}
 	} else if(!strcmp(packet->name, "stream:error") ||
 			 (!strcmp(packet->name, "error") &&
-				!strcmp(xmlnode_get_namespace(packet), "http://etherx.jabber.org/streams"))) {
+				!strcmp(xmlns, "http://etherx.jabber.org/streams"))) {
 		if(xmlnode_get_child(packet, "bad-format")) {
 			text = _("Bad Format");
 		} else if(xmlnode_get_child(packet, "bad-namespace-prefix")) {
--- a/libpurple/protocols/jabber/message.c	Sun Mar 25 07:01:57 2007 +0000
+++ b/libpurple/protocols/jabber/message.c	Sun Mar 25 07:07:29 2007 +0000
@@ -33,7 +33,7 @@
 
 void jabber_message_free(JabberMessage *jm)
 {
-        g_free(jm->from);
+	g_free(jm->from);
 	g_free(jm->to);
 	g_free(jm->id);
 	g_free(jm->subject);