diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-07-23 14:30:27 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-07-23 14:30:27 +0200 |
commit | 5c118f6dd751905ccab2d9d65f28ec8e210c484a (patch) | |
tree | 474e0ba6acd64d82abcfb6cae139ac27112c857e /src/eu/siacs/conversations/generator/IqGenerator.java | |
parent | 04156e945cc832e83c0f12e4ed6ebe06b3070b53 (diff) |
more disco. fixed chat markers with jappix
Diffstat (limited to 'src/eu/siacs/conversations/generator/IqGenerator.java')
-rw-r--r-- | src/eu/siacs/conversations/generator/IqGenerator.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/generator/IqGenerator.java b/src/eu/siacs/conversations/generator/IqGenerator.java new file mode 100644 index 00000000..7b3350d4 --- /dev/null +++ b/src/eu/siacs/conversations/generator/IqGenerator.java @@ -0,0 +1,31 @@ +package eu.siacs.conversations.generator; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + +public class IqGenerator extends AbstractGenerator { + + + + public IqPacket discoResponse(IqPacket request) { + IqPacket packet = new IqPacket(IqPacket.TYPE_RESULT); + packet.setId(request.getId()); + packet.setTo(request.getFrom()); + Element query = packet.addChild("query","http://jabber.org/protocol/disco#info"); + query.setAttribute("node", request.query().getAttribute("node")); + Element identity = query.addChild("identity"); + identity.setAttribute("category","client"); + identity.setAttribute("type", this.IDENTITY_TYPE); + identity.setAttribute("name", IDENTITY_NAME); + List<String> features = Arrays.asList(FEATURES); + Collections.sort(features); + for(String feature : features) { + query.addChild("feature").setAttribute("var",feature); + } + return packet; + } +} |