changeset 29409: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 1d58c44c87f4
children 6288bbd53f44
files ChangeLog libpurple/protocols/jabber/bosh.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 10 06:43:51 2010 +0000
+++ b/ChangeLog	Wed Feb 10 07:09:52 2010 +0000
@@ -56,6 +56,8 @@
 	* Don't send custom smileys larger than the recommended maximum object size
 	  specified in the BoB XEP.   This prevents a client from being
 	  disconnected by servers that dislike overly-large stanzas.
+	* Fix receiving messages without markup over an Openfire BOSH connection
+	  (forcibly put the stanzas in the jabber:client namespace).
 
 	Yahoo:
 	* Don't send <span> and </span> tags.  (Fartash Faghri)
--- 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);
 		}