ios – 在获取聊天记录时,我没有从Openfire获取用户历史记录

ios – 在获取聊天记录时,我没有从Openfire获取用户历史记录,第1张

概述我从openfire中获取历史记录,通过在开火中安装打开的fire plugin并尝试这个代码. let iq1 = DDXMLElement(name: "iq") iq1.addAttribute(withName: "type", stringValue: "get") iq1.addAttribute(withName: "id", stringValue: "0") 我从openfire中获取历史记录,通过在开火中安装打开的fire plugin并尝试这个代码.
let iq1 = DDXMLElement(name: "iq")    iq1.addAttribute(withname: "type",stringValue: "get")    iq1.addAttribute(withname: "ID",stringValue: "0")    let retrIEve = DDXMLElement(name: "retrIEve",xmlns: "urn:xmpp:archive")    retrIEve?.addAttribute(withname: "with",stringValue: "[email protected]")    let set = DDXMLElement(name: "set",xmlns: "http://jabber.org/protocol/rsm")    let max = DDXMLElement(name: "max",stringValue: "50")    iq1.addChild(retrIEve!)    retrIEve?.addChild(set!)    set?.addChild(max)    stream?.send(iq1 )

现在我没有从双方得到历史.这是我得到的结果.

<iq xmlns="jabber:clIEnt" type="result" ID="0" to="[email protected]/5qsinh1syg"><chat xmlns="urn:xmpp:archive" with="[email protected]" start="2017-02-07T06:28:33.691Z">	<from secs="0">	<body>hello</body>	</from>	<from secs="405">	<body>hiii</body>	</from>	<from secs="580">	<body>hey</body>	</from>	<from secs="599">	<body>HooooE</body>	</from>	<from secs="628">	<body>hOo</body>	</from>	<from secs="907">	<body>Raman here</body>	</from>		<from secs="931">	<body>Raman here ONE</body>	</from>	<from secs="1273">	<body>Raman here</body>	</from>	<from secs="1558">	<body> Raman from SPark </body>	</from>	<from secs="1571">	<body> Raman from SPark One</body>	</from>	<from secs="1782">	<body>Raman from SPark </body>	</from>	<from secs="2651">	<body>Raman FiVE</body>	</from>	<from secs="2810">	<body>Raman Three</body>	</from>	<from secs="2810">	<body>Raman FOur</body>	</from>	<from secs="3534">	<body>RAMAN SIX</body>	</from>	<from secs="4105">	<body>Raman OKK</body>	</from>	<from secs="4113">	<body>OKKK l</body>	</from>	<from secs="4130">	<body>UST</body>	</from>	<set xmlns="http://jabber.org/protocol/rsm">		<first index="0">0</first>		<last>17</last>		<count>18</count>	</set></chat></iq>

这是RAMAN不是BENTICK的所有消息,因为这两个用户参与聊天,同时获得历史,我只得到RAMAN的消息.不是BENTICk
如何从双方用户获取历史.

请帮忙.

解决方法 我已经实现了相同的方式来通过发送给定的iq来获取消息
我得到了正确的结果.
let iQ = DDXMLElement.element(withname: "iq") as! DDXMLElement        iQ.addAttribute(withname: "type",stringValue: "get")                iQ.addAttribute(withname: "ID",stringValue: (xmppHandler.xmppStream?.generateUUID())!)        let retrIEve = DDXMLElement(name: "retrIEve",xmlns: "urn:xmpp:archive")        retrIEve?.addAttribute(withname: "with",stringValue: "\(JID!)@\(Utility.hostname)")        let set = DDXMLElement.element(withname: "set") as! DDXMLElement        set.addAttribute(withname: "xmlns",stringValue: "http://jabber.org/protocol/rsm")        let max = DDXMLElement.element(withname: "max") as! DDXMLElement        max.stringValue = "10"        max.addAttribute(withname:"xmlns",stringValue: "http://jabber.org/protocol/rsm")        iQ.addChild(retrIEve!)        retrIEve?.addChild(set)        set.addChild(max as DDXMLNode)        xmppHandler.xmppStream?.send(iQ)<iq type="get" ID="7705EEC5-3385-42D4-B748-B39C204ADB90"><retrIEve xmlns="urn:xmpp:archive" with="[email protected]"><set xmlns="http://jabber.org/protocol/rsm"><max xmlns="http://jabber.org/protocol/rsm">10</max></set></retrIEve></iq>

响应

<iq xmlns="jabber:clIEnt" type="result" ID="7705EEC5-3385-42D4-B748-B39C204ADB90" to="[email protected]/Smack">  <chat xmlns="urn:xmpp:archive" with="[email protected]" start="2017-02-28T09:55:27.068Z">    <from secs="0" jID="[email protected]">      <body>Hiii rajeev</body>    </from>    <to secs="52">      <body>Hi        How r u</body>    </to>   <from secs="15" jID="[email protected]"><body>I am good</body></from>   <to secs="8"><body>What abt u</body></to>   <to secs="169"><body>Hello testing chat</body></to>   <from secs="10" jID="[email protected]"><body>Good</body></from>   <from secs="5" jID="[email protected]"><body>Continue </body></from>   <to secs="834"><body>Ok    </body></to>   <to secs="8"><body>Nice chat    </body></to>   <from secs="232" jID="[email protected]"><body>Heelo</body></from>   <set xmlns="http://jabber.org/protocol/rsm"><first index="0">0</first>     <last>9</last><count>574</count></set></chat></iq>
总结

以上是内存溢出为你收集整理的ios – 在获取聊天记录时,我没有从Openfire获取用户历史记录全部内容,希望文章能够帮你解决ios – 在获取聊天记录时,我没有从Openfire获取用户历史记录所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1097043.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存