aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/generator
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-12-05 01:54:16 +0100
committeriNPUTmice <daniel@gultsch.de>2014-12-10 14:08:06 +0100
commit4a94389f052afab8b0424bd56af3e0741a9ee430 (patch)
treee1c44117c9f5b2f5a99af300c4dfe3867296df5e /src/main/java/eu/siacs/conversations/generator
parent34558cc2779e5fd3cb8a2afa39be0efcc5314d88 (diff)
very basic mam support
Diffstat (limited to 'src/main/java/eu/siacs/conversations/generator')
-rw-r--r--src/main/java/eu/siacs/conversations/generator/IqGenerator.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java
index 5d674748..56a0776f 100644
--- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java
@@ -4,8 +4,10 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element;
+import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.jid.Jid;
import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
@@ -94,4 +96,20 @@ public class IqGenerator extends AbstractGenerator {
}
return packet;
}
+
+ public IqPacket queryMessageArchiveManagement(MessageArchiveService.Query mam) {
+ final IqPacket packet = new IqPacket(IqPacket.TYPE_SET);
+ Element query = packet.query("urn:xmpp:mam:0");
+ query.setAttribute("queryid",mam.getQueryId());
+ Data data = new Data();
+ data.setFormType("urn:xmpp:mam:0");
+ data.put("with",mam.getWith().toString());
+ data.put("start",getTimestamp(mam.getStart()));
+ data.put("end",getTimestamp(mam.getEnd()));
+ query.addChild(data);
+ if (mam.getAfter() != null) {
+ query.addChild("set", "http://jabber.org/protocol/rsm").addChild("after").setContent(mam.getAfter());
+ }
+ return packet;
+ }
}