aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/generator/IqGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/generator/IqGenerator.java')
-rw-r--r--src/eu/siacs/conversations/generator/IqGenerator.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/generator/IqGenerator.java b/src/eu/siacs/conversations/generator/IqGenerator.java
index 1a38347b..c4d84020 100644
--- a/src/eu/siacs/conversations/generator/IqGenerator.java
+++ b/src/eu/siacs/conversations/generator/IqGenerator.java
@@ -39,6 +39,15 @@ public class IqGenerator extends AbstractGenerator {
return packet;
}
+ protected IqPacket retrieve(String node, Element item) {
+ IqPacket packet = new IqPacket(IqPacket.TYPE_GET);
+ Element pubsub = packet.addChild("pubsub", "http://jabber.org/protocol/pubsub");
+ Element items = pubsub.addChild("items");
+ items.setAttribute("node", node);
+ items.addChild(item);
+ return packet;
+ }
+
public IqPacket publishAvatar(Avatar avatar) {
Element item = new Element("item");
item.setAttribute("id", avatar.sha1sum);
@@ -59,4 +68,12 @@ public class IqGenerator extends AbstractGenerator {
info.setAttribute("type", avatar.type);
return publish("urn:xmpp:avatar:metadata",item);
}
+
+ public IqPacket retrieveAvatar(Avatar avatar) {
+ Element item = new Element("item");
+ item.setAttribute("id", avatar.sha1sum);
+ IqPacket packet = retrieve("urn:xmpp:avatar:data", item);
+ packet.setTo(avatar.owner);
+ return packet;
+ }
}