Commit 23366527 authored by Tom Evans's avatar Tom Evans

OF-938: Use correct namespace for BOSH packets

Append XMPP client namespace to outbound BOSH packets only when needed.
parent dd0f2440
...@@ -1173,19 +1173,11 @@ public class HttpSession extends LocalClientSession { ...@@ -1173,19 +1173,11 @@ public class HttpSession extends LocalClientSession {
this.text = null; this.text = null;
this.packets = new ArrayList<String>(); this.packets = new ArrayList<String>();
for (Packet packet : elements) { for (Packet packet : elements) {
// Rewrite packet namespace according XEP-0206 // Append packet namespace according XEP-0206 if needed
if (packet instanceof Presence) { if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) {
this.packets.add("<presence xmlns=\"jabber:client\"" + packet.toXML().substring(9)); packet.getElement().add(Namespace.get("jabber:client"));
} }
else if (packet instanceof IQ) { this.packets.add(packet.toXML());
this.packets.add("<iq xmlns=\"jabber:client\"" + packet.toXML().substring(3));
}
else if (packet instanceof Message) {
this.packets.add("<message xmlns=\"jabber:client\"" + packet.toXML().substring(8));
}
else {
this.packets.add(packet.toXML());
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment