[Standards] xep-0313 missing features

Philipp Hörist philipp at hoerist.com
Mon Mar 5 12:48:54 UTC 2018


@Lazar

Maybe it helps to write down how most xmpp devs use MAM

Say your user starts with 0 messages locally

your first query to MAM will only use timestamp say 1 day back from the
current time

<iq type='set' id='juliet1'>
  <query xmlns='urn:xmpp:mam:2'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:mam:2</value>
      </field>
      <field var='start'>
        <value>2018-03-04T00:00:00Z</value>
      </field>
    </x>
  </query>
</iq>

you record now the mam id of the last message you received.

and then whenever user loses connection or you feel you want to sync the
archive you execute

<iq type='set' id='q29302'>
  <query xmlns='urn:xmpp:mam:2'>
    <x xmlns='jabber:x:data' type='submit'>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:mam:2</value>
      </field>
    </x>
   <set xmlns='http://jabber.org/protocol/rsm'>
      <max>100</max>
      <after>SAVED-MAM-ID</after>
    </set>
  </query>
</iq>

thats it, you will request all messages since the last known mam id, there
cant be any holes.

if you want to request into the other direction you have to record the
first timestamp of the first mam message, and request from there back with
timestamps (from 01.03.2018 - 03.04.2018 for example)

if you fetch the messages from your db, you should order first for
timestamp and in a second step for row-id

regards

2018-03-05 13:28 GMT+01:00 Philipp Hörist <philipp at hoerist.com>:

> RSM turns your result set into smaller subsets specified with the page
> size
>
> <max>10</max>
>
> then you can switch one page forward with <after> or one page backwards
> with <before> thats the idea behind RSM
>
> there is no RSM inside a RSM.
>
> 2018-03-05 12:29 GMT+01:00 Edwin Mons <jsf at edwinm.ik.nu>:
>
>> Why would it not be allowed?  The only confusing thing there would be if
>> your (possibly server-mandated) page size is smaller than the number of
>> items between before and after, as before and after have conflicting
>> indicators of which part of the items you'd want to receive.
>>
>> Edwin
>>
>>
>>
>>
>> On 05/03/2018 12:11, Lazar Otasevic wrote:
>>
>> Kevin says we can :) I asked him to clarify... we'll see.
>>
>> On Mon, Mar 5, 2018 at 11:45 AM, Philipp Hörist <philipp at hoerist.com>
>> wrote:
>>
>>>
>>>>
>>>> You can already fill holes with the current spec, by specifying both
>>>> <before/> and <after/> on the RSM query can’t you? If that doesn’t
>>>> obviously follow from the text, that’s something we should clarify.
>>>>
>>>>
>>>>
>>> No i dont think you can do that. You can either specify <before> OR
>>> <after>.
>>> RSM is for going one page further or backwards with <after> and <before>
>>> inside a already filtered result, you cannot filter the result again with
>>> upper and lower limits.
>>>
>>>
>>> _______________________________________________
>>> Standards mailing list
>>> Info: https://mail.jabber.org/mailman/listinfo/standards
>>> Unsubscribe: Standards-unsubscribe at xmpp.org
>>> _______________________________________________
>>>
>>>
>>
>>
>> _______________________________________________
>> Standards mailing list
>> Info: https://mail.jabber.org/mailman/listinfo/standards
>> Unsubscribe: Standards-unsubscribe at xmpp.org
>> _______________________________________________
>>
>>
>>
>> _______________________________________________
>> Standards mailing list
>> Info: https://mail.jabber.org/mailman/listinfo/standards
>> Unsubscribe: Standards-unsubscribe at xmpp.org
>> _______________________________________________
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/standards/attachments/20180305/8bf89d30/attachment-0001.html>


More information about the Standards mailing list