From 2df57f38a066c5a3c26a0fe799ad81b7ef3958cd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 3 May 2014 17:42:44 +0200 Subject: [PATCH] properly reply to iq requests. reply to disco --- .../services/XmppConnectionService.java | 17 ++++++++++++++++- .../conversations/xmpp/stanzas/IqPacket.java | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index d554c5041..15c828a7c 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -392,8 +392,23 @@ public class XmppConnectionService extends Service { .hasChild("data", "http://jabber.org/protocol/ibb")) { XmppConnectionService.this.mJingleConnectionManager .deliverIbbPacket(account, packet); + } else if (packet.hasChild("query","http://jabber.org/protocol/disco#info")) { + IqPacket iqResponse = packet.generateRespone(IqPacket.TYPE_RESULT); + Element query = iqResponse.addChild("query", "http://jabber.org/protocol/disco#info"); + query.addChild("feature").setAttribute("var", "urn:xmpp:jingle:1"); + query.addChild("feature").setAttribute("var", "urn:xmpp:jingle:apps:file-transfer:3"); + query.addChild("feature").setAttribute("var", "urn:xmpp:jingle:transports:s5b:1"); + query.addChild("feature").setAttribute("var", "urn:xmpp:jingle:transports:ibb:1"); + Log.d(LOGTAG,"replying to disco from "+packet.getFrom()+"with: "+iqResponse); + account.getXmppConnection().sendIqPacket(iqResponse, null); } else { - Log.d(LOGTAG, "iq packet arrived " + packet.toString()); + if ((packet.getType() == IqPacket.TYPE_GET)||(packet.getType() == IqPacket.TYPE_SET)) { + IqPacket response = packet.generateRespone(IqPacket.TYPE_ERROR); + Element error = response.addChild("error"); + error.setAttribute("type","cancel"); + error.addChild("feature-not-implemented","urn:ietf:params:xml:ns:xmpp-stanzas"); + account.getXmppConnection().sendIqPacket(response, null); + } } } }; diff --git a/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java b/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java index 9e2884540..48e5c0ecd 100644 --- a/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java +++ b/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java @@ -26,6 +26,9 @@ public class IqPacket extends AbstractStanza { case TYPE_RESULT: this.setAttribute("type", "result"); break; + case TYPE_ERROR: + this.setAttribute("type", "error"); + break; default: break; }