aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-05-03 17:42:44 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-05-03 17:42:44 +0200
commit2df57f38a066c5a3c26a0fe799ad81b7ef3958cd (patch)
tree33622e354ae7cf6d8f48bdb24302060ab7bf3663
parent4822d4dce7c8110c76dece28ccc2b3dd98698b97 (diff)
properly reply to iq requests. reply to disco
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java17
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java3
2 files changed, 19 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index d554c504..15c828a7 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 9e288454..48e5c0ec 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;
}