properly reply to iq requests. reply to disco

This commit is contained in:
Daniel Gultsch 2014-05-03 17:42:44 +02:00
parent 4822d4dce7
commit 2df57f38a0
2 changed files with 19 additions and 1 deletions

View File

@ -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);
}
}
}
};

View File

@ -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;
}