diff libpurple/protocols/jabber/bosh.c @ 29017:f521dd7c75b5

jabber: Handle non-compliant servers that don't put stanzas in the right namespace. Closes #11315
author Paul Aurich <paul@darkrain42.org>
date Wed, 10 Feb 2010 07:09:52 +0000
parents 931d6906291b
children 618c4165d4f8
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c	Wed Feb 10 06:43:51 2010 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Wed Feb 10 07:09:52 2010 +0000
@@ -476,6 +476,18 @@
 		/* jabber_process_packet might free child */
 		xmlnode *next = child->next;
 		if (child->type == XMLNODE_TYPE_TAG) {
+			const char *xmlns = xmlnode_get_namespace(child);
+			/*
+			 * Workaround for non-compliant servers that don't stamp
+			 * the right xmlns on these packets.  See #11315.
+			 */
+			if ((xmlns == NULL /* shouldn't happen, but is equally wrong */ ||
+					g_str_equal(xmlns, NS_BOSH)) &&
+				(g_str_equal(child->name, "iq") ||
+				 g_str_equal(child->name, "message") ||
+				 g_str_equal(child->name, "presence"))) {
+				xmlnode_set_namespace(child, NS_XMPP_CLIENT);
+			}
 			jabber_process_packet(js, &child);
 		}