检索历史聊天Openfire XMPP框架 [英] Retrieve history chat Openfire XMPP framework
问题描述
我已经使用Robbie Hanson的XMPPframwork和Openfire服务器开发了一个聊天应用程序. 我可以一对一聊天,并且可以成功聊天.但是当我获得聊天记录时,我无法获得全部历史记录.我使用XEP-0136来存档历史记录:
I've developed a chat app using XMPPframwork of Robbie Hanson and Openfire server. I can chat one to one and chat group successfully. But when I get history of chat, I can't get whole history. I use XEP-0136 to archieve history:
发送IQ:
<iq type="get" id="hichic@macintosh">
<retrieve
xmlns="urn:xmpp:archive" with="group12@conference.macintosh">
<set
xmlns="http://jabber.org/protocol/rsm">
<max>100</max>
</set>
</retrieve>
</iq>
接收:
<iq type="result" id="hichic@macintosh" to="admin@macintosh/Macintosh">
<chat
xmlns="urn:xmpp:archive" with="group12@conference.macintosh" start="2016-08-23T08:42:55.777Z">
<to secs="0">
<body>asdf</body>
</to>
<to secs="5">
<body>aafs</body>
</to>
<from secs="2" jid="haha@macintosh">
<body>sax</body>
</from>
<set
xmlns="http://jabber.org/protocol/rsm">
<first index="0">0</first>
<last>2</last>
<count>3</count>
</set>
</chat>
</iq>
但是当我打开数据库的MessageArchive表时,我可以看到更多的带有group12的消息(〜20条消息),而结果只有3条.我可能会错过什么吗?
But when I open the database, ofMessageArchive table, I can see much more messages with group12 (~20 messages) while in the result, I only got 3. May I miss something?
推荐答案
遵循这种格式,对我来说效果很好,
Follow this format, it works for me perfectly,
<iq id='a5sV8-21' type='set'>
<query xmlns='urn:xmpp:mam:0' queryid="12345678">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden"><value>urn:xmpp:mam:0</value></field>
<field var="with"><value>id@domain</value></field>
</x>
<set xmlns="http://jabber.org/protocol/rsm">
<max>message_count</max>
</set>
</query>
</iq>
**如果 xmpp:mam:0 不起作用,请使用 xmpp:mam:1
** If xmpp:mam:0 doesn't work use xmpp:mam:1
这篇关于检索历史聊天Openfire XMPP框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!