2015-08-03 201 views
1

我使用Strophe库连接到OpenFire XMPP服务器。如何获取openfire聊天室消息历史

如何接收聊天室消息历史记录?

var o = {to:'[email protected]/youNick'}; 
var m = $pres(o); 
m.c('x', {xmlns : 'http://jabber.org/protocol/muc#user'}, null); 
connection.send(m.tree()); 

我加入房间时只收到25封邮件。如何获得聊天室的25条消息?

回答

2

您应该添加<history/>元素:https://xmpp.org/extensions/xep-0045.html#enter-managehistory

<x xmlns='http://jabber.org/protocol/muc'> 
    <history maxstanzas='100'/> 
</x> 
+0

我在群聊 - >群聊设置 - > Openfire Administrator控制台中选择了“显示完整聊天记录”。 即使我只收到来自聊天室的25条消息。 如何获取整个聊天记录? –

+0

改为添加''。 – xnyhps

+0

谢谢xnyhps。这解决了我的问题。 –

相关问题