0

I'm writing an xmpp messenger. By my design it stores local message history. When the user comes online and opens the dialog with someone my program requests archive (XEP-313) from the last locally stored message to the last message the server archive has, using "after" tag. However it isn't working the way I expected it to.

The request

<iq id="qxmpp21" type="set">
    <query xmlns="urn:xmpp:mam:1" queryid="qxmpp21">
        <x xmlns="jabber:x:data" type="submit">
            <field type="hidden" var="FORM_TYPE"><value>urn:xmpp:mam:1</value></field>
            <field type="text-single" var="with"><value>user1@domain.org</value></field>
        </x>
        <set xmlns="http://jabber.org/protocol/rsm">
            <max>100</max>
            <after>5d10ba97-9ce8-46d4-9547-4f5e91e4ac19</after>
        </set>
    </query>
</iq>

The response

<iq xmlns="jabber:client" id="qxmpp21" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" type="result" from="user2@domain.org" to="user2@domain.org/QXmpp">
    <fin xmlns="urn:xmpp:mam:1" queryid="qxmpp21" complete="true">
        <set xmlns="http://jabber.org/protocol/rsm">
            <count xmlns="http://jabber.org/protocol/rsm">465</count>
        </set>
    </fin>
</iq>

I use qxmpp library and ejabberd as a server.

Am I doing anything wrong? Thanks in advance!

Blue
  • 355
  • 1
  • 9
  • 1
    The response looks good on a quick glance. What do you expect? – Flow Jun 29 '19 at 07:47
  • I expect to receive those messages that actually are after that id. They are there, I checked the database dump. This response is the only thing I see, so, I'm not even sure what this 465 is supposed to mean... – Blue Jun 29 '19 at 09:24
  • 1
    It means that your result set contains 465 messages. The MAM archive should have send the first page of 100 messages to you, see XEP-0313. Does that not happen? Do you have a full XMPP starting from the IQ request to the response? Aren't there any messages showing up in between? – Flow Jun 29 '19 at 09:39
  • Nopes, it doesn't. It just sends me that result. According to XEP-0313 server also is supposed to include "first" and "last" tags, but it doesn't. Peculiar detail - it always sends count == 465 regardless of the ID I request. – Blue Jun 29 '19 at 09:46
  • 1
    I'd also expect that there are message stanzas between the IQ request-response pair. In this case I would suggest to debug the MAM archive implementation and/or ask the vendor thereof for assistance (post to their forum, create an issue/bug report, ...) – Flow Jun 29 '19 at 10:04
  • this conversation may lead to something https://github.com/processone/ejabberd/issues/2924 – Blue Jun 29 '19 at 16:57

0 Answers0