Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/wmchat/go/ext/nchat-whatsmeow.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
Base-Commit: fc65416c22c47e15be1daf2e2d62deaba6881591
Base-Branch:
diff --git a/appstate.go b/appstate.go
index beacc44..4188264 100644
--- a/appstate.go
+++ b/appstate.go
@@ -161,6 +161,14 @@ func (cli *Client) applyAppStatePatches(
if err != nil {
if errors.Is(err, appstate.ErrKeyNotFound) {
go cli.requestMissingAppStateKeys(context.WithoutCancel(ctx), patches)
+ } else if errors.Is(err, appstate.ErrMismatchingLTHash) {
+ cli.Log.Warnf("LTHash mismatch for %s, requesting recovery", name)
+ go func() {
+ _, errReq := cli.SendPeerMessage(context.WithoutCancel(ctx), BuildAppStateRecoveryRequest(name))
+ if errReq != nil {
+ cli.Log.Errorf("Failed to send app state recovery request for %s: %v", name, errReq)
+ }
+ }()
}
return state, fmt.Errorf("failed to decode app state %s patches: %w", name, err)
}
diff --git a/download.go b/download.go
index 16b6108..6bdbd32 100644
--- a/download.go
Expand Down
8 changes: 8 additions & 0 deletions lib/wmchat/go/ext/whatsmeow/appstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ func (cli *Client) applyAppStatePatches(
if err != nil {
if errors.Is(err, appstate.ErrKeyNotFound) {
go cli.requestMissingAppStateKeys(context.WithoutCancel(ctx), patches)
} else if errors.Is(err, appstate.ErrMismatchingLTHash) {
cli.Log.Warnf("LTHash mismatch for %s, requesting recovery", name)
go func() {
_, errReq := cli.SendPeerMessage(context.WithoutCancel(ctx), BuildAppStateRecoveryRequest(name))
if errReq != nil {
cli.Log.Errorf("Failed to send app state recovery request for %s: %v", name, errReq)
}
}()
}
return state, fmt.Errorf("failed to decode app state %s patches: %w", name, err)
}
Expand Down
5 changes: 5 additions & 0 deletions src/uimodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2139,11 +2139,16 @@ void UiModel::Impl::MessageHandler(std::shared_ptr<ServiceMessage> p_ServiceMess
getChatsRequest->chatIds.insert(chatId);
SendProtocolRequest(profileId, getChatsRequest);

// clear previously requested message ids, as prior requests may have been
// silently dropped by NewMessagesNotify handler when chat was still archived
m_MsgFromIdsRequested[profileId][chatId].clear();

// fetch messages so they're available when user selects this chat
RequestMessages(profileId, chatId);
}
SortChats();
UpdateList();
UpdateHistory();
UpdateStatus();
}
break;
Expand Down
Loading