ios – XMPPFramework – 从Openfire Server检索归档的消息

ios – XMPPFramework – 从Openfire Server检索归档的消息,第1张

概述我正在使用XMPP和openfire服务器开发iPhone的聊天应用程序,OpenFire服务器正在存储用户之间的所有聊天记录,但是当我尝试检索特定用户的聊天记录时,我只得到聊天消息的日期和数量实际的短信 我已经在openfire上安装了用于邮件归档的打开的归档插件 这是我传递给Openfire Server的节 <iq type='get' id='pk1'> <list xmlns=' 我正在使用XMPP和openfire服务器开发iPhone的聊天应用程序,OpenFire服务器正在存储用户之间的所有聊天记录,但是当我尝试检索特定用户的聊天记录时,我只得到聊天消息的日期和数量实际的短信

我已经在openfire上安装了用于邮件归档的打开的归档插件

这是我传递给Openfire Server的节

<iq type='get' ID='pk1'>    <List xmlns='urn:xmpp:archive'    with='piyush@openfire'>    <set xmlns='http://jabber.org/protocol/rsm'>    <max>30</max>    </set>    </List>    </iq>

这是我从服务器收到的结果

<iq type="result" ID="pk1" to="vivek@openfire/iphone">  <List xmlns="urn:xmpp:archive">  <chat with="piyush@openfire" start="2012-07-04T13:16:12.291Z"/>  <chat with="piyush@openfire" start="2012-07-05T08:25:31.555Z"/>  <chat with="piyush@openfire" start="2012-07-05T12:38:24.098Z"/>  <set xmlns="http://jabber.org/protocol/rsm">  <first index="0">15</first>  <last>25</last>  <count>3</count>  </set>  </List>  </iq>

这是我想要的结果,我预期的结果

<iq type='result' to='vivek@openfire/iphone' ID='page1'> <chat xmlns='urn:xmpp:archive'    with='piyush@openfire'    start='2012-07-04T13:16:12.291Z'    subject='She speaks!'    version='4'><from secs='0'><body>Art thou not Romeo,and a Montague?</body></from><to secs='11'><body>Neither,fair saint,if either thee dislike.</body></to>.[98 more messages].<from secs='9'><body>How cam'st thou hither,tell me,and wherefore?</body></from><set xmlns='http://jabber.org/protocol/rsm'>  <first index='0'>0</first>  <last>99</last>  <count>217</count></set>

请帮我取得理想的结果

谢谢

解决方法 您必须使用< retrIEve>执行请求(见 http://xmpp.org/extensions/xep-0136.html),那么你可以从收到的< List>结果.例如:

发送:

<iq type='get' ID='pk1'>       <List xmlns='urn:xmpp:archive'               with='piyush@openfire'>        <set xmlns='http://jabber.org/protocol/rsm'>            <max>30</max>        </set>      </List>   </iq>

接收:

<iq type="result" ID="pk1" to="vivek@openfire/iphone">     <List xmlns="urn:xmpp:archive">      <chat with="piyush@openfire" start="2012-07-04T13:16:12.291Z"/>      <chat with="piyush@openfire" start="2012-07-05T08:25:31.555Z"/>      <chat with="piyush@openfire" start="2012-07-05T12:38:24.098Z"/>      <set xmlns="http://jabber.org/protocol/rsm">          <first index="0">15</first>           <last>25</last>           <count>3</count>      </set>    </List> </iq>

现在您选择启动和发送之一(日期和时间必须是精确的):

<iq type='get' ID='pk1'>    <retrIEve xmlns='urn:xmpp:archive'        with='piyush@openfire''        start='2012-07-04T13:16:12.291Z'>     <set xmlns='http://jabber.org/protocol/rsm'>       <max>100</max>     </set>    </retrIEve> </iq>

你会收到这样的东西(取决于最大值 – > max = 30,bodIEs = 30):

<iq type='result' to='vivek@openfire/iphone' ID='page1'>      <chat xmlns='urn:xmpp:archive'             with='piyush@openfire'              start='2012-07-04T13:16:12.291Z'            subject='She speaks!'       version='4'>         <from secs='0'><body>Art thou not Romeo,and a Montague?</body></from>         <to secs='11'><body>Neither,if either thee dislike.</body></to>          .          [28 more messages]          .         <from secs='9'><body>How cam'st thou hither,and therefore?           </body>            </from>      <set xmlns='http://jabber.org/protocol/rsm'>       <first index='0'>0</first>       <last>29</last>       <count></count>     </set>  <iq>
总结

以上是内存溢出为你收集整理的ios – XMPPFramework – 从Openfire Server检索归档的消息全部内容,希望文章能够帮你解决ios – XMPPFramework – 从Openfire Server检索归档的消息所遇到的程序开发问题。

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

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

原文地址:https://54852.com/web/1111111.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存