1
votes

I have gotten the last 10 messages from archive, and trying to get the 10 before that on request and so on.

On the XMPP doc. it said i set the before with my UID??

http://xmpp.org/extensions/xep-0059.html#backwards

<iq type='set' from='[email protected]/roundabout' to='users.jabber.org' id='back1'>
  <query xmlns='jabber:iq:search'>
    <nick>Pete</nick>
    <set xmlns='http://jabber.org/protocol/rsm'>
      <max>10</max>
      <before>[email protected]</before>
    </set>
  </query>
</iq>

or this?? http://xmpp.org/extensions/xep-0313.html#query-paging

with some ID in the after tag? I am very confused, can anyone give me some pointer, thanks!

<iq type='set' id='q29303'>
  <query xmlns='urn:xmpp:mam:1'>
      <x xmlns='jabber:x:data' type='submit'>
        <field var='FORM_TYPE' type='hidden'><value>urn:xmpp:mam:1</value></field>>
        <field var='start'><value>2010-08-07T00:00:00Z</value></field>
      </x>
      <set xmlns='http://jabber.org/protocol/rsm'>
         <max>10</max>
         <after>09af3-cc343-b409f</after>
      </set>
  </query>
</iq>

I tried putting in before with my UID and it didnt work <before>[email protected]</before>

ANd i have an error <error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq></body>

I am using strophe.js mam plugin and rsm plugin

1

1 Answers

2
votes

When you receive first page limited by RSM with max=10, you will receive first and last UIDs:

<iq type='result' id='q29302'>
  <fin xmlns='urn:xmpp:mam:1'>
    <set xmlns='http://jabber.org/protocol/rsm'>
      <first index='0'>28482-98726-73623</first>
      <last>09af3-cc343-b409f</last>
      <count>10</count>
    </set>
  </fin>
</iq>

These are UIDs of messages, which you can use in before and after subsequent queries.