I'm using an XMPP server that implements XEP-0313 for retrieving conversation history. I would like to fetch only the last message of each conversation, so that I can build a list of your most recent conversations previewing the last message.
I've managed to fetch all messages of all conversations and based on that I could build the list, but it's a big waste of data and not an option. I'm not sure this is the right extension for accomplishing this, so if there is another extension I should be looking at, please guide me in the right direction.
One thing you can do easily is first retrieve the user's roster and then for each contact retrieve the latest message.
Result:
Retrieve the last message from or to nurse@example.com:
Of course users can have conversations with people not on their roster, but in practice this is quite rare on XMPP.