MAM improvements
Started trying to finish MAM here's what I've done so far. Nowhere near production ready btw. Many temporary stuff in here.
- When we open new chat (
/msg someone) if no msgs in db fetch using before: now. else fetch after most recent one. - When scrolled to top, fetch older messages from db and display them above the previous ones.
- After all db history gets displayed when scrolling up, fetch older messages from mam (these ones get displayed after everything instead of before)
Todo:
- Only fetch once if no msgs for one chat (further fetching will be done when scrolling).
- MAM for mucs
- Have different pagination counters for each chat (currently one temporary global one)
- When scrolling up display new mam messages before other ones instead of after. (start of buffer instead of end)
- In case that the buffer fills up while scrolling upwards and messages get deleted from the end, handle scrolling down to the bottom.
- Check notifications cause I think older messages from db might get displayed in notification after scrolling instead of new incoming ones.
- Mam when we receive a message instead of
/msg someone
That's great!
Especially that you also started implementing the infinite-scrolling feature (load messages from DB when)!
In case you didn't notice I want to point out that:
- https://github.com/profanity-im/profanity/discussions/1678 here I mentioned some thoughts regarding MAM, DG and scrolling.
- those links at https://github.com/profanity-im/profanity/issues/660#issuecomment-920379087 might be of interest too.
The second link also point to a thread discussing MAM sync strategies.
Yes I read those first before starting.
load messages from DB when
I already imlemented this in the commit
Yes I read those first before starting.
Awesome!
I already imlemented this in the commit
I'm aware. What I meant to say was that it's great that you did that!
Todo
- initial mam doesn't display(right after we /msg someone) until we scroll
- move the print at start or end logic away from _win_printf
- In case that the buffer fills up while scrolling upwards and messages get deleted from the end, handle scrolling down to the bottom.
- MAM for mucs
- Check notifications cause I think older messages from db might get displayed in notification after scrolling instead of new incoming ones.
- Mam when we receive a message instead of /msg someone
- Resolve conflicts
Done
- Only fetch once if no msgs for one chat (further fetching will be done when scrolling).
- Have different pagination counters for each chat (currently one temporary global one) -> no counters we check first messages timestamp in buffer
- Correctly use the before and after attributes
- Complete rsm paging
- When scrolling up display new mam messages before other ones instead of after. (start of buffer instead of end)
Todo:
- Reenable regular _chawin_history when needed
- Add the loader when initial mam is fetching (to prevent user of loading older mam whilst initial latest mam still in progress)
- In case that the buffer fills up while scrolling upwards and messages get deleted from the end, handle scrolling down to the bottom.
- MAM for mucs
- Check notifications cause I think older messages from db might get displayed in notification after scrolling instead of new incoming ones.
- Mam when we receive a message instead of /msg someone
- remove cons_show debug messages
- Resolve conflicts
Also should I disable notifications for MAM messages?
Todo:
- ~Handle late delivery~
- MAM for mucs
- ~MAM for private wins~
- ~Correct way to log corrections in db~
- ~See what to do about notifs~
- Check if url and quotes autocompletion works fine
- Check if the api still works fine
- Resolve conflicts
Now only the boring stuff is left
MAM for private wins
I'm not sure if we need this. I think in anonymous MUCs we can't be sure if the nick is from the same JID anyways.
Also should I disable notifications for MAM messages?
I'd say yes. In an optimal scenario we would only disable notifications for "read" messages. But I think that's too much for now. We still need to implement message markers afaik.
I think this PR already solves and improves the MAM situation a lot. I would suggest to resolve the merge conflicts (maybe check the commits as well if some should be squashed together) and then we merge this to master.
MAM for MUCs feature can be done in a separate PR later on.
And in the meantime we can gather (usage) feedback from users. I'll try to check if the url and quote autocompletion still works. Hopefully some users of the plugin API will report back in case we break something.
Thanks a lot for your work @MarcoPolo-PasTonMolo !! I tested it a bit and it seems to work fine. Maybe we need some delay so the user cant hold PG UP and make the client super slow.
It's merged on master now, so people can give feedback. MUC MAM can be done late.