获取XMPP聊天记录OpenFire

时间:2016-03-11 08:25:13

标签: ios swift xmpp openfire xmppframework

我正在尝试使用OpenFire服务器在iOS中使用XMPPFramework实现聊天应用程序。我的聊天工作正常,我正在尝试从服务器检索聊天记录。当然,我已在服务器上启用了消息存档。这是我发送的请求

<iq type="get">
   <retrieve xmlns="urn:xmpp:archive" with="dev_user80@mydomain">
       <set xmlns="http://jabber.org/protocol/rsm">
           <max>100</max>
       </set>
   </retrieve>
</iq>

这是我得到的回应。

<iq xmlns="jabber:client" type="error" to="dev_user103@mydomain/6i0qoo9tek">
    <retrieve xmlns="urn:xmpp:archive" with="dev_user80@mydomain">
        <set xmlns="http://jabber.org/protocol/rsm">
            <max>100</max>
        </set>
    </retrieve>
    <error code="503" type="cancel">
        <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
        </service-unavailable>
    </error>
</iq>

我已经完成了我在互联网上找到的所有解决方案,但找不到令人满意的解决方案

1 个答案:

答案 0 :(得分:0)

urn:xmpp:archive更改为urn:xmpp:archive:auto

我遇到了同样的问题,并通过运行发现请求来确定:http://xmpp.org/extensions/xep-0136.html#disco

我发了这个智商:

<iq from='user@mydomain.com'
    id='disco1' 
    to='mydomain.com'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

启用了监控插件的我的Openfire服务器返回了以下结果:

<iq xmlns="jabber:client" type="result" id="disco1" from="mydomain.com" to="user@mydomain.com/resource">
   <query xmlns="http://jabber.org/protocol/disco#info">
      <identity category="server" name="Openfire Server" type="im" />
      <identity category="pubsub" type="pep" />
      <feature var="http://jabber.org/protocol/pubsub#retrieve-default" />
      <feature var="http://jabber.org/protocol/pubsub#purge-nodes" />
      <feature var="vcard-temp" />
      <feature var="http://jabber.org/protocol/pubsub#subscribe" />
      <feature var="http://jabber.org/protocol/pubsub#subscription-options" />
      <feature var="http://jabber.org/protocol/pubsub#create-nodes" />
      <feature var="http://jabber.org/protocol/pubsub#outcast-affiliation" />
      <feature var="msgoffline" />
      <feature var="http://jabber.org/protocol/pubsub#get-pending" />
      <feature var="http://jabber.org/protocol/pubsub#multi-subscribe" />
      <feature var="http://jabber.org/protocol/pubsub#presence-notifications" />
      <feature var="urn:xmpp:ping" />
      <feature var="jabber:iq:register" />
      <feature var="http://jabber.org/protocol/pubsub#delete-nodes" />
      <feature var="http://jabber.org/protocol/pubsub#config-node" />
      <feature var="urn:xmpp:archive:manage" />
      <feature var="http://jabber.org/protocol/pubsub#retrieve-items" />
      <feature var="http://jabber.org/protocol/pubsub#auto-create" />
      <feature var="http://jabber.org/protocol/disco#items" />
      <feature var="http://jabber.org/protocol/pubsub#item-ids" />
      <feature var="http://jabber.org/protocol/pubsub#meta-data" />
      <feature var="urn:xmpp:mam:0" />
      <feature var="jabber:iq:roster" />
      <feature var="http://jabber.org/protocol/pubsub#instant-nodes" />
      <feature var="http://jabber.org/protocol/pubsub#modify-affiliations" />
      <feature var="http://jabber.org/protocol/pubsub#persistent-items" />
      <feature var="http://jabber.org/protocol/pubsub#create-and-configure" />
      <feature var="http://jabber.org/protocol/pubsub" />
      <feature var="http://jabber.org/protocol/pubsub#publisher-affiliation" />
      <feature var="http://jabber.org/protocol/pubsub#access-open" />
      <feature var="http://jabber.org/protocol/pubsub#retrieve-affiliations" />
      <feature var="jabber:iq:version" />
      <feature var="http://jabber.org/protocol/pubsub#retract-items" />
      <feature var="urn:xmpp:time" />
      <feature var="http://jabber.org/protocol/pubsub#manage-subscriptions" />
      <feature var="jabber:iq:privacy" />
      <feature var="jabber:iq:last" />
      <feature var="http://jabber.org/protocol/commands" />
      <feature var="http://jabber.org/protocol/offline" />
      <feature var="urn:xmpp:carbons:2" />
      <feature var="http://jabber.org/protocol/address" />
      <feature var="http://jabber.org/protocol/pubsub#publish" />
      <feature var="http://jabber.org/protocol/pubsub#collections" />
      <feature var="http://jabber.org/protocol/pubsub#retrieve-subscriptions" />
      <feature var="urn:xmpp:archive:auto" />
      <feature var="http://jabber.org/protocol/disco#info" />
      <feature var="jabber:iq:private" />
      <feature var="http://jabber.org/protocol/rsm" />
   </query>
</iq>

您可以看到支持自动存档(urn:xmpp:archive:auto)和存档管理(urn:xmpp:archive:manage),但手动存档(urn:xmpp:archive:manual)和存档首选项(urn:xmpp:archive:pref)是不

XEP-0313也受支持(列为urn:xmpp:mam:0),可以检索已归档的消息:http://xmpp.org/extensions/xep-0313.html