Get XMPP Chat History OpenFire

前端 未结 1 483
太阳男子
太阳男子 2021-01-25 06:21

I am trying to implement a chat application using XMPPFramework in iOS, using OpenFire server. My chat is working fine, I am trying to retrieve chat history from server. Ofcours

相关标签:
1条回答
  • 2021-01-25 06:52

    change urn:xmpp:archive to urn:xmpp:archive:auto

    I had the same issue and determined this by running a discovery request: http://xmpp.org/extensions/xep-0136.html#disco

    I sent this IQ:

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

    My Openfire server with the Monitoring plugin enabled returned this result:

    <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>
    

    You can see that Automatic Archiving (urn:xmpp:archive:auto) and Archive Management (urn:xmpp:archive:manage) are supported, but Manual Archiving (urn:xmpp:archive:manual) and Archiving Preferences (urn:xmpp:archive:pref) are not.

    XEP-0313 is also supported (listed as urn:xmpp:mam:0) and can retrieve archived messages: http://xmpp.org/extensions/xep-0313.html

    0 讨论(0)
提交回复
热议问题