我现在正在开发一个基于Openfire Server的基于XEP-0136的消息历史检索应用程序。
我读过消息历史检索可以与结果集管理(RSM)-XEP-0059相结合。
我们可以通过设置RSM的max属性来分隔消息检索请求的数量,如下所示:
<iq type='get' id='juliet1'>
<list xmlns='urn:xmpp:archive'
with='juliet@capulet.com'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>5</max>
</set>
</list>
</iq>这将从顶部的返回前5个聊天列表(按聊天时间升序排列)。
我的问题是如何从底部的中检索最后5个聊天列表,这样我就可以在第一次聊天时获得最新的聊天消息而不是。
我看到了一个反向RSM标准建议,如下所示:
<iq type='get' id='juliet1'>
<list xmlns='urn:xmpp:archive'
with='juliet@capulet.com'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>5</max>
<before />
<reversed />
</set>
</list>
</iq>但这一标准似乎尚未实施。
提前感谢
发布于 2013-12-28 09:30:02
基于这,该节如下所示:
<iq type='get' id='juliet1'>
<list xmlns='urn:xmpp:archive'
with='juliet@capulet.com'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>5</max>
<before />
</set>
</list>
</iq>您可以通过RSM从底部检索集合。
但是看起来Openfire消息归档插件在这个RSM中有一些But。
参考资料:http://community.igniterealtime.org/message/230389#230389
因此,可能的解决方案是对我的收藏进行计数:
<iq type='get' id='juliet1'>
<list xmlns='urn:xmpp:archive'
with='juliet@capulet.com'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>0</max>
</set>
</list>
</iq>它将返回:
<iq xmlns='jabber:client' type='result' id='juliet1' to='admin@somehost'>
<list xmlns='urn:xmpp:archive'>
<set xmlns='http://jabber.org/protocol/rsm'>
<count>10</count>
</set>
</list>
</iq>我按索引选择集合:
<iq type='get' id='juliet1'>
<list xmlns='urn:xmpp:archive'
with='juliet@capulet.com'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>5</max>
<index>4</index>
</set>
</list>
</iq>https://stackoverflow.com/questions/20812198
复制相似问题