diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-01-15 21:57:36 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-01-15 21:57:36 +0100 |
commit | d44debab6726edbac07901a2b94a07f2ef4771ee (patch) | |
tree | dda34feb85f53996cb5aa68063365ae3e8403195 /src/main/java/de/thedevstack/conversationsplus/generator | |
parent | 1f40166b3105ab78ce02339b16c9cb9eea921ec7 (diff) |
Introducing some specialized IqPacketGenerators
- IqPacketGenerator
- PubSubPacketGenerator
- AvatarPacketGenerator
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/generator')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java b/src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java index 2fd9071e..8f6b128f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java @@ -42,58 +42,6 @@ public class IqGenerator extends AbstractGenerator { return packet; } - protected static IqPacket publish(final String node, final Element item) { - final IqPacket packet = new IqPacket(IqPacket.TYPE.SET); - final Element pubsub = packet.addChild("pubsub", - "http://jabber.org/protocol/pubsub"); - final Element publish = pubsub.addChild("publish"); - publish.setAttribute("node", node); - publish.addChild(item); - return packet; - } - - protected static IqPacket retrieve(String node, Element item) { - final IqPacket packet = new IqPacket(IqPacket.TYPE.GET); - final Element pubsub = packet.addChild("pubsub", - "http://jabber.org/protocol/pubsub"); - final Element items = pubsub.addChild("items"); - items.setAttribute("node", node); - if (item != null) { - items.addChild(item); - } - return packet; - } - - public static IqPacket publishAvatar(Avatar avatar) { - final Element item = new Element("item"); - item.setAttribute("id", avatar.sha1sum); - final Element data = item.addChild("data", "urn:xmpp:avatar:data"); - data.setContent(avatar.image); - return publish("urn:xmpp:avatar:data", item); - } - - public static IqPacket publishAvatarMetadata(final Avatar avatar) { - final Element item = new Element("item"); - item.setAttribute("id", avatar.sha1sum); - final Element metadata = item - .addChild("metadata", "urn:xmpp:avatar:metadata"); - final Element info = metadata.addChild("info"); - info.setAttribute("bytes", avatar.size); - info.setAttribute("id", avatar.sha1sum); - info.setAttribute("height", avatar.height); - info.setAttribute("width", avatar.height); - info.setAttribute("type", avatar.type); - return publish("urn:xmpp:avatar:metadata", item); - } - - public static IqPacket retrievePepAvatar(final Avatar avatar) { - final Element item = new Element("item"); - item.setAttribute("id", avatar.sha1sum); - final IqPacket packet = retrieve("urn:xmpp:avatar:data", item); - packet.setTo(avatar.owner); - return packet; - } - public static IqPacket retrieveVcardAvatar(final Avatar avatar) { final IqPacket packet = new IqPacket(IqPacket.TYPE.GET); packet.setTo(avatar.owner); @@ -101,14 +49,6 @@ public class IqGenerator extends AbstractGenerator { return packet; } - public static IqPacket retrieveAvatarMetaData(final Jid to) { - final IqPacket packet = retrieve("urn:xmpp:avatar:metadata", null); - if (to != null) { - packet.setTo(to); - } - return packet; - } - public IqPacket queryMessageArchiveManagement(final MessageArchiveService.Query mam) { final IqPacket packet = new IqPacket(IqPacket.TYPE.SET); final Element query = packet.query("urn:xmpp:mam:0"); |