Skip to content

fix(mam): Prevent duplicated and out-of-order history messages#2183

Merged
jubalh merged 1 commit into
masterfrom
feat/mam-msg-sorting
Jul 4, 2026
Merged

fix(mam): Prevent duplicated and out-of-order history messages#2183
jubalh merged 1 commit into
masterfrom
feat/mam-msg-sorting

Conversation

@jubalh

@jubalh jubalh commented Jul 4, 2026

Copy link
Copy Markdown
Member

This resolves an issue where MAM history messages were being appended to the window display buffer in as they arrived, causing them to appear out of order and duplicated when the RSM batch completed and prepended the same sorted messages.

Bypass immediate display and file logging for MAM messages and allow them to only be saved to the database.
Render them in a single chronological block once the query completes.

So in server_events.c we now only decrypt and save MAM messages to db. Once we receive <fin> we trigger _mam_rsm_id_handler() and _mam_buffer_commit_handler() which call mucwin_db_history() and chatwin_db_history()which will query the DB and print them to the screen viawin_print_old_history()`.

This resolves an issue where MAM history messages were being appended
to the window display buffer in as they arrived, causing
them to appear out of order and duplicated when the RSM batch
completed and prepended the same sorted messages.

Bypass immediate display and file logging for MAM messages and
allow them to only be saved to the database.
Render them in a single chronological block once the query completes.

So in server_events.c we now only decrypt and save MAM messages to db.
Once we receive `<fin>` we trigger `_mam_rsm_id_handler()` and
`_mam_buffer_commit_handler()` which call `mucwin_db_history() and
`chatwin_db_history()` which will query the DB and print them to the
screen via `win_print_old_history()`.

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
@jubalh jubalh added this to the next milestone Jul 4, 2026
@jubalh jubalh self-assigned this Jul 4, 2026
@jubalh

jubalh commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

Confirmed by bug reporter maniac in our MUC.

@jubalh jubalh merged commit 01911bb into master Jul 4, 2026
12 checks passed
@jubalh jubalh deleted the feat/mam-msg-sorting branch July 4, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant