fix: whatsapp archive lthash mismatch and UI history refresh#504
fix: whatsapp archive lthash mismatch and UI history refresh#504asemarafa wants to merge 1 commit intod99kris:masterfrom
Conversation
|
Hi @asemarafa - thanks for contributing again. 👍 |
- Request app state recovery upon LTHash mismatch in whatsmeow. - Clear requested message IDs and refresh UI history when a chat is unarchived in uimodel.
7503585 to
24eb451
Compare
|
Hi again - I think the uimodel.cpp change makes sense, but I am a little hesitant regarding the change in Ideally I'd prefer this part of the PR to be submitted upstreams as a PR to https://github.com/tulir/whatsmeow as they may have better knowledge in assessing the correctness of the fix. And then nchat can integrate the fix once it's accepted upstream. We update the bundled whatsmeow once or twice per month. As you can see in |
This PR addresses the issue where WhatsApp chats fail to sync their archive/unarchive state properly when modified from another device (e.g.,
a phone) while nchat is offline or disconnected.
What this fixes:
ErrMismatchingLTHash in whatsmeow: When the local app state hash does not match the server's hash, whatsmeow previously failed silently on
ErrMismatchingLTHash. This patch catches the error and explicitly sends a BuildAppStateRecoveryRequest to heal the local state.
UI History Refresh (uimodel.cpp): When a chat is unarchived, the application sends a request for new messages. However, prior message
requests might have been silently dropped by the NewMessagesNotify handler when the chat was still considered archived locally. This
clears any previously requested message IDs and calls UpdateHistory() to ensure the UI accurately reflects any messages that arrived while
the chat was archived.