Get the latest message from every conversation with XEP-0313?

I am using an XMPP server that implements XEP-0313 to get a conversation history. I would like to receive only the last message of each conversation, so that I can create a list of your last conversations by looking at the last message.

I managed to get all the messages from all the conversations and based on this I could create a list, but this is a big waste of data, not an option. I'm not sure if this is the right extension for this, so if there is another extension that I should look at, please direct me in the right direction.

+4
source share
1 answer

, , - , .

<iq from='juliet@example.com/balcony'
    id='bv1bs71f'
    type='get'>
  <query xmlns='jabber:iq:roster'/>
</iq>

:

<iq id='bv1bs71f'
    to='juliet@example.com/chamber'
    type='result'>
   <query xmlns='jabber:iq:roster' ver='ver7'>
     <item jid='nurse@example.com'/>
     <item jid='romeo@example.net'/>
   </query>
 </iq>

nurse@example.com:

<iq type='set' id='juliet1'>
  <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='with'>
        <value>nurse@example.com</value>
      </field>
    </x>
    <set xmlns='http://jabber.org/protocol/rsm'>
      <max>1</max>
      <before/>
    </set>
  </query>
</iq>

, , , XMPP.

+2

Source: https://habr.com/ru/post/1626848/


All Articles