Project

General

Profile

Retrieve archived message list

Łukasz Soszyński
Added about 5 years ago

The problem is that we can not traverse list of messages using standard XMPP paging mechanism http://www.xmpp.org/extensions/xep-0059.html.

We are unable to use element. Id used in element should uniqually identify last received message.

When we use id of message (in element) provided by tigase server mechanism, paging doesn't work.

(We have to use alternative pagging using element)

EXAMPLE:

Quering for two first messages:

<iq id='kot1' type='get'>
    <retrieve xmlns='urn:xmpp:archive' start='2014-03-13T08:56:06.000+0000' with='000000000115@localhost'>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <max>2</max>
        </set>
    </retrieve>
</iq>

Server answer with list of messages:

<iq xmlns='jabber:client' type='result' id='kot1' to='000000000112@localhost/Mac-mini-waw-mini1'>
    <chat xmlns='urn:xmpp:archive' with='000000000115@localhost' start='2014-03-13T08:56:06+0000'>
        <to secs='0'>
            <body>hi</body>
        </to>
        <to secs='5'>
            <body>jol</body>
        </to>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <first index='0'>0</first>
            <last>5</last>
            <count>31</count>
        </set>
    </chat>
</iq>

As we can see in above answer we received list of two messages. First message is identified by id 0 and last message by id 5.

As we can see element and element tell us ids of first and last element of received list of messages.

We can also see that in whole conversation there are 31 messages ( element) and that received list of messages starts from 0 index ().

When we want to ask for list of next two messages, we send to server:

<iq id='kot2' type='get'>
    <retrieve xmlns='urn:xmpp:archive' start='2014-03-13T08:56:06.000+0000' with='000000000115@localhost'>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <max>2</max>
            <after>5</after>
        </set>
    </retrieve>
</iq>

We should receive:

<iq xmlns='jabber:client' type='result' id='kot2' to='000000000112@localhost/Mac-mini-waw-mini1'>
    <chat xmlns='urn:xmpp:archive' with='000000000115@localhost' start='2014-03-13T08:56:06+0000'>
        <to secs='435'>
            <body>yo</body>
        </to>
        <to secs='450'>
            <body>yi yo</body>
        </to>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <first index='2'>435</first>
            <last>450</last>
            <count>31</count>
        </set>
    </chat>
</iq>

element contains id of first message in received list.

element contains id of last message in received list.

tells us that from whole list of messages we received part of list containing messages starting from index 2

Actually we receive following server answer:

<iq xmlns='jabber:client' type='result' id='kot2' to='000000000112@localhost/Mac-mini-waw-mini1'>
    <chat xmlns='urn:xmpp:archive' with='000000000115@localhost' start='2014-03-13T08:56:06+0000'>
        <to secs='0'>
            <body>hi</body>
        </to>
        <to secs='5'>
            <body>jol</body>
        </to>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <first index='0'>0</first>
            <last>5</last>
            <count>31</count>
        </set>
    </chat>
</iq>

As we can see we received the same answer as in first query. This might be an error and we are unable to download whole list of messages using this paging mechanism.

Second thing is:

Why id of message is seconds number? According to message archiving XEP http://xmpp.org/extensions/xep-0136.html Id should uniqually identify message.

What to do in situation when two messages were sent in the same second? How to uniqually identify them?

Why not to use message index as suggested in message archiving XEP?


Replies (4)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 5 years ago

Message Archiving component is basic message archiving component which implementation was based on XEP-0136 but it is not as strict as XEP-0136 requires. Due to this fact, for now this component supports pagination using XEP-0059 only partially - (using index). But you can also change subsets returned by Message Archiving component by changing start and end attribute added to retrieve attribute of request. Each message contains a sec attribute which will allow you to adjust timestamps passed to request.

As for a question about id of a message - for now there is no using id of a message and seconds where used as id as it is only value which appears in each message. But you are right it may be problematic if two messages where sent in the same second. We will need to think about generation of unique identifiers for a messages. We will consider use of message index as suggested in XEP.

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 5 years ago

I've changed implementation of XEP-0059 RSM which was used by Message Archiving component. Now it will report id of message as message index in collection. I've also updated implementation which handles of after/before elements to comply with XEPs.

This new version will be available tomorrow in SNAPSHOT build.

Added by Łukasz Soszyński about 5 years ago

It still doesn't work, but i wonder if I carried out test on proper Tigase version (5.3.0-SNAPSHOT b3491 2014-04-01).

I expected something like this:

<first index='0'>0</first>
<last>2</last>

REQUEST:

<iq id='ala7' type='get'>
                <retrieve xmlns='urn:xmpp:archive' start='2014-03-31T12:38:55.000+0000' with='000000000131@localhost'>
                                <set xmlns='http://jabber.org/protocol/rsm'>
                                                <max>8</max>
                </set>
        </retrieve>
</iq>

RESPONSE:

<iq type='result' id='ala7' to='000000000101@localhost/localhost'>
    <chat xmlns='urn:xmpp:archive' with='000000000131@localhost' start='2014-03-31T12:38:55+0000'>
        <to secs='0'>
            <body>3</body>
        </to>
        <to secs='0'>
            <body>2</body>
        </to>
        <to secs='1'>
            <body>42</body>
        </to>
        <to secs='1'>
            <body>42</body>
        </to>
        <from secs='158'>
            <body>fdsdf</body>
        </from>
        <to secs='2'>
            <body>4</body>
        </to>
        <to secs='2'>
            <body>2</body>
        </to>
        <to secs='2'>
            <body>42</body>
        </to>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <first index='0'>0</first>
            <last>2</last>
            <count>38</count>
        </set>
    </chat>
</iq>

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 5 years ago

Please verify that you properly upgraded installation to snapshot version. I just used tigase-message-archiving.jar from a build you mentioned and I received correct results.

How you upgraded this installation?

Did you changed all files or just a single file?

Did you used files from -dist archive or from -dist-max archive?

    (1-4/4)