include RSM max in mam query in case server doesn't specify own max

This commit is contained in:
Daniel Gultsch 2017-04-12 20:53:19 +02:00
parent d4c2b12f95
commit 4bbf2dab99

View File

@ -250,11 +250,13 @@ public class IqGenerator extends AbstractGenerator {
data.put("end", getTimestamp(mam.getEnd())); data.put("end", getTimestamp(mam.getEnd()));
data.submit(); data.submit();
query.addChild(data); query.addChild(data);
Element set = query.addChild("set", "http://jabber.org/protocol/rsm");
if (mam.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) { if (mam.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) {
query.addChild("set", "http://jabber.org/protocol/rsm").addChild("before").setContent(mam.getReference()); set.addChild("before").setContent(mam.getReference());
} else if (mam.getReference() != null) { } else if (mam.getReference() != null) {
query.addChild("set", "http://jabber.org/protocol/rsm").addChild("after").setContent(mam.getReference()); set.addChild("after").setContent(mam.getReference());
} }
set.addChild("max").setContent(String.valueOf(Config.PAGE_SIZE));
return packet; return packet;
} }
public IqPacket generateGetBlockList() { public IqPacket generateGetBlockList() {