MAM: rough draft
Here is my take on the MAM implementation so far
Good to see the @mcneb10 PR :)
@Ri0n This PR is almost ready. I do have a few questions though.
- How will I test my code?
- Should I write a
Managerwrapper class around the task?
wrt testing Psi part is not ready yet, but Psi can load history from local db. So we need some code in Psi which will sync MAM with local db, It will be the first step. If you want to test something right in iris, I believe you need to write tests yourself. Psi has miniclient which can be ported to some integration tests in iris.
Manager sounds like a good idea, having API most suitable to be used by local db synchronizer. Like querying messages is just the first step and eventually it will have a lot of MAM control methods.
alright, i'll add a MAMManager class that simplifies creating querying the MAM archives. As for the testing, I'll try to write a small plugin or patch or something to test the querying
@Ri0n if it doesn't bother you, can you help me out by modifying a Psi+ plugin or something to test my code? I'm not familiar with the Psi+ codebase, and some other recent changes to Iris are preventing Psi+ from compiling.
@Ri0n: Really important to finish this XEP support...
@mcneb10, that was my plan. I changed my job a few days ago and now completely consume by it. So I can't promise any quick solution. I have some ideas in mind though.
- from UI point of view endless chat scrolling must be supported
- we need a sort of message buffer per chat. A buffer which keeps for example max 200 messages. It becomes a sort of model for chatview
- the model should be signalled from chatview when it needs to loads more messages (more recent or more old)
- the model should signal back its busy status
- the model queries some sort of Psi's storage/archive manager capable to interact with both local database and iris' mam manager
- the manager will detect which exactly time spans are missed in the local db and query iris to retrieve the remaining
- local db itself has to be modified to reflect MAM use case and also to keep track of missed time spans (e.g. a message/event can have a state like "edge event" when it was first or last in the result set unless we query from a boundary of another set)
- wrt iris. it would be nice to have some methods in the manager like for example
loadBeforeStanzaId(string stanzaId, int limit=100)andloadAfterStanzaId. This would secure the endless scrolling more carefully than timestamps.
@mcneb10: What do you think about @Ri0n comment?
@mcneb10: What do you think about @Ri0n comment?
I'm not available to work right now, but i did add some of the changes rion requested. I'll push them in a day or two
@Ri0n i just added the code to iris which should serve the function of what you want in point 8. The two functions getLatestMessagesFromArchive and getMessagesBeforeID i added always scroll backwards, meaning they send the messages in the order of newest to oldest. The other functions have a configurable direction (set both flipPages and backwards to false and it will get messages in oldest to newest order).
As for only fetching messages in a specific time frame, you can simply do getArchiveByTimeRange and set the from to QDateTime() and to to a specific time to get all messages up to a specific point, respecting the order set in the manager constructor.
It also applies the other way, so if you set to to QDateTime() and from to a specific time it will get all messages starting at the time you set until the latest message.
I'm going to be pretty busy for a while. I won't fix these issues for a few weeks
Im going to see if i can finish this up
I will not be able to get anywhere near finishing this code until there is a mechanism added somewhere in Psi+ to call my code
@Ri0n: Can you check?
It's important to know that the latest version of iris does not compile with Psi+ due to some changes to the carbons code
fixed in mam branch
Thank you for the fix! This is very exciting.
@mcneb10: Good job, an important part has been done!
Thanks @Ri0n for merging, but why not in master?
Can wait next parts ^^
I'd say it needs testing first
A new XEP-0313 version has been released - 1.1.2 (2024-09-18):
- https://xmpp.org/extensions/xep-0313.html
- https://www5.aptest.com/standards/htmldiff/htmldiff.pl?oldfile=https://xmpp.org/extensions/attic/xep-0313-1.1.1.html&newfile=https://xmpp.org/extensions/attic/xep-0313-1.1.2.html
It is good?
Since the good work done by @mcneb10:
- https://github.com/psi-im/iris/pull/73
And after XEP-0313 1.1.2 (2024-09-18), a new XEP-0313 version has been released - 1.1.3 (2025-04-09):
- https://xmpp.org/extensions/xep-0313.html
- https://www5.aptest.com/standards/htmldiff/htmldiff.pl?oldfile=https://xmpp.org/extensions/attic/xep-0313-1.1.2.html&newfile=https://xmpp.org/extensions/attic/xep-0313-1.1.3.html
- https://www5.aptest.com/standards/htmldiff/htmldiff.pl?oldfile=https://xmpp.org/extensions/attic/xep-0313-1.1.1.html&newfile=https://xmpp.org/extensions/attic/xep-0313-1.1.2.html