Skip to content

Commit

Permalink
Merge pull request #872 from meganz/hotfix/import-old-seen
Browse files Browse the repository at this point in the history
#15770. Avoid to set SEEN back in history
  • Loading branch information
sergiohs84 authored May 22, 2020
2 parents 7ce1329 + 1db01dd commit 735de77
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/chatd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3481,7 +3481,16 @@ void Chat::onLastSeen(Id msgid, bool resend)
return;
}
}
// else --> msgid was found locally
else // msgid was found locally
{
// if both `msgid` and `mLastSeenId` are known and localy available, there's an index to compare
if (mLastSeenIdx != CHATD_IDX_INVALID && idx < mLastSeenIdx)
{
CHATID_LOG_WARNING("onLastSeen: ignoring attempt to set last seen msgid backwards. Current: %s Attempt: %s", ID_CSTR(mLastSeenId), ID_CSTR(msgid));
return; // `mLastSeenId` is newer than the received `msgid`
}
}

assert(mLastSeenId.isValid());

if (idx == mLastSeenIdx)
Expand Down

0 comments on commit 735de77

Please sign in to comment.