gpt4 book ai didi

iOS:XMPP:群聊消息的消息归档

转载 作者:行者123 更新时间:2023-12-02 03:06:02 24 4
gpt4 key购买 nike

所有一对一聊天均以消息类型作为聊天发送。因此,消息归档技术(如下所示)对我来说可以很好地保存/检索聊天历史记录。

// Setup message archiving
xmppMessageArchivingStorage = [XMPPMessageArchivingCoreDataStorage sharedInstance];
xmppMessageArchiving = [[XMPPMessageArchiving alloc] initWithMessageArchivingStorage:xmppMessageArchivingStorage];
[xmppMessageArchiving setClientSideMessageArchivingOnly:YES];

// Activate xmpp modules
[xmppMessageArchiving activate:xmppStream];
// Add delegate
[xmppMessageArchiving addDelegate:self delegateQueue:dispatch_get_main_queue()];
<小时/>

但是对于群聊,发送的消息类型是“groupchat”这不会由 XMPPMessageArchivingCoreDataStorage 存档

<小时/>

有人可以指导我如何实现群聊消息的消息存档吗?

最佳答案

这是您需要发送以获得存档消息的一系列节。欲了解更多详情,您可以查看http://xmpp.org/extensions/xep-0136.html

请求

<iq type='get' id='mrug_sender@staging.openfire.com'>
<list xmlns='urn:xmpp:archive'
with='mrug_target_155@staging.openfire.com'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>6900</max>
</set>
</list>
</iq>

RES

<iq type="result" id="mrug_sender@staging.openfire.com" to="mrug_sender@staging.openfire.com/Psi">
<list xmlns="urn:xmpp:archive">
<chat with="mrug_target_155@staging.openfire.com" start="2014-06-07T06:52:26.041Z"/>
<chat with="mrug_target_155@staging.openfire.com" start="2014-06-07T07:06:53.372Z"/>
<set xmlns="http://jabber.org/protocol/rsm">
<first index="0">866</first>
<last>867</last>
<count>2</count>
</set>
</list>
</iq>

请求

<iq type='get' id='mrug_sender@staging.openfire.com'>
<retrieve xmlns='urn:xmpp:archive' with='mrug_target_155@staging.openfire.com' start='2014-06-07T06:52:26.041Z'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>8000</max>
</set>
</retrieve>
</iq>

RES

 <iq type="result" id="mrug_sender@staging.openfire.com" to="mrug_sender@staging.openfire.com/Psi">
<chat xmlns="urn:xmpp:archive" with="mrug_target_155@staging.openfire.com" start="2014-06-07T06:52:26.041Z">
<from secs="0" jid="mrug_target_155@staging.openfire.com">
<body>Wow !! This is Archived Message</body>
</from>
<set xmlns="http://jabber.org/protocol/rsm">
<first index="0">0</first>
<last>0</last>
<count>1</count>
</set>
</chat>
</iq>

获取所有对话的列表

<iq type='get' id='mrug_sender@staging.openfire.com'>
<list xmlns='urn:xmpp:archive'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>6900</max>
</set>
</list>
</iq>

关于iOS:XMPP:群聊消息的消息归档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25199359/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com