diff options
author | ElzorFox <elzorfox@ya.ru> | 2024-10-22 10:30:37 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2024-10-22 10:30:58 +0500 |
commit | 086a4572ba5c41ee8231d8c1a13288b42a4886c1 (patch) | |
tree | 213ed4136cf38c314d4009790e26924d5230e9a9 /protocols/VKontakte/src/misc.cpp | |
parent | 792207209ade53f715684de34f61029dd9752f06 (diff) |
VKontakte: fix logic of marking message as remote read
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 13f1beba81..7ca85b9d3e 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -915,10 +915,29 @@ void CVkProto::MarkDialogAsRead(MCONTACT hContact) }
}
-void CVkProto::MarkRemoteRead(MCONTACT hContact)
+void CVkProto::MarkRemoteRead(MCONTACT hContact, VKMessageID_t iMessageId)
{
- MEVENT hEvent = db_event_last(hContact);
+ MEVENT hEvent = 0;
+ if (iMessageId) {
+ char szMid[40];
+ _ltoa(iMessageId, szMid, 10);
+ hEvent = db_event_getById(m_szModuleName, szMid);
+ }
+ else
+ hEvent = db_event_last(hContact);
+
+ if (!hEvent)
+ return;
+
+ MEVENT hReadEvent = getDword(hContact, "RemoteRead");
+ if (hReadEvent) {
+ DB::EventInfo dbeiRead(hReadEvent);
+ VKMessageID_t iReadMessageId = strtol(strcat((char *)dbeiRead.szId, "_"), nullptr, 10);
+ if (iReadMessageId >= iMessageId)
+ return;
+ }
+
setDword(hContact, "LastMsgReadTime", time(0));
setDword(hContact, "RemoteRead", hEvent);
|