diff libpurple/protocols/jabber/presence.c @ 24672:bba38f03085d

Remove a double call to xmlnode_get_namespace and multiple tests for xmlns != NULL. I'm not sure about the one case in jabber_message_parse if child->name=="x" and xmlns == NULL which fell through in the previous code. I've put that in the new version, but I don't know if that's correct.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 14 Dec 2008 04:09:23 +0000
parents 61e0924de04a
children 5f9a24d1c25e 9100b9176a16 1d1d1829de11 0fa91206cf5a 54dcfe059dd4 68f4edb42f39
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Sun Dec 14 03:09:51 2008 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Dec 14 04:09:23 2008 +0000
@@ -502,17 +502,19 @@
 				priority = atoi(p);
 				g_free(p);
 			}
+		} else if(xmlns == NULL) {
+			/* The rest of the cases used to check xmlns individually. */
+			continue;
 		} else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) {
 			/* XXX: compare the time.  jabber:x:delay can happen on presence packets that aren't really and truly delayed */
 			delayed = TRUE;
-		} else if(xmlns && !strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) {
+		} else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) {
 			caps = y; /* store for later, when creating buddy resource */
 		} else if(!strcmp(y->name, "x")) {
-			const char *xmlns = xmlnode_get_namespace(y);
-			if(xmlns && !strcmp(xmlns, "jabber:x:delay")) {
+			if(!strcmp(xmlns, "jabber:x:delay")) {
 				/* XXX: compare the time.  jabber:x:delay can happen on presence packets that aren't really and truly delayed */
 				delayed = TRUE;
-			} else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) {
+			} else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) {
 				xmlnode *z;
 
 				muc = TRUE;
@@ -555,7 +557,7 @@
 							flags |= PURPLE_CBFLAGS_VOICE;
 					}
 				}
-			} else if(xmlns && !strcmp(xmlns, "vcard-temp:x:update")) {
+			} else if(!strcmp(xmlns, "vcard-temp:x:update")) {
 				xmlnode *photo = xmlnode_get_child(y, "photo");
 				if(photo) {
 					g_free(avatar_hash);