Commit 7745e413 authored by Tom Evans's avatar Tom Evans Committed by Christian Schudt

OF-938: Use correct namespace for BOSH packets

Append XMPP client namespace to outbound BOSH packets only when needed.
parent 4866cd46
......@@ -1173,21 +1173,13 @@ public class HttpSession extends LocalClientSession {
this.text = null;
this.packets = new ArrayList<String>();
for (Packet packet : elements) {
// Rewrite packet namespace according XEP-0206
if (packet instanceof Presence) {
this.packets.add("<presence xmlns=\"jabber:client\"" + packet.toXML().substring(9));
// Append packet namespace according XEP-0206 if needed
if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) {
packet.getElement().add(Namespace.get("jabber:client"));
}
else if (packet instanceof IQ) {
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());
}
}
}
public String getDeliverable() {
if (text == null) {
......
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