Fix LMC autocompletion to suggest corrected message content #25

Manually merged
jabber.developer merged 1 commits from fix/correct-autocompletion into master 2025-09-02 12:20:56 +00:00

This PR fixes the /correct command's autocompletion, which incorrectly suggests the original message content instead of the corrected content. The issue occurs because chatwin_outgoing_msg only updates the last message content for original messages, not corrections. The fix ensures corrected content is stored for autocompletion while preserving the original message ID, per XEP-0308. It also optimizes _chatwin_set_last_message to avoid redundant memory operations and adds null checks for safety.

Checklist

  • Run Valgrind

How to tests

  • Use /correct autocompletion with multiple corrections to ensure correct content is suggested.

Fixes #24.

This PR fixes the `/correct` command's autocompletion, which incorrectly suggests the original message content instead of the corrected content. The issue occurs because `chatwin_outgoing_msg` only updates the last message content for original messages, not corrections. The fix ensures corrected content is stored for autocompletion while preserving the original message ID, per XEP-0308. It also optimizes `_chatwin_set_last_message` to avoid redundant memory operations and adds null checks for safety. ## Checklist - [x] Run Valgrind ## How to tests - Use `/correct` autocompletion with multiple corrections to ensure correct content is suggested. Fixes #24.
jabber.developer added 1 commit 2025-09-01 22:31:51 +00:00
fix(chatwin): Fix LMC autocompletion to suggest corrected message content
All checks were successful
CI / Check spelling (pull_request) Successful in 18s
CI / Check coding style (pull_request) Successful in 33s
CI / Linux (debian) (pull_request) Successful in 9m45s
CI / Linux (ubuntu) (pull_request) Successful in 10m0s
CI / Linux (arch) (pull_request) Successful in 16m48s
2808def933
- Modified chatwin_outgoing_msg to call _chatwin_set_last_message for corrected messages, using replace_id per XEP-0308.
- Updated _chatwin_set_last_message to skip redundant and invalid free/strdup for same pointers.
- Added null checks in _chatwin_set_last_message for safety.
- Fixes autocompletion suggesting original message content instead of corrected content.

Fixes #24
jabber.developer manually merged commit ea8a758ecf into master 2025-09-02 12:20:56 +00:00
Sign in to join this conversation.
No description provided.