diff options
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 23 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_pollserver.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 2 |
3 files changed, 23 insertions, 4 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);
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 52a8b92f06..d5916d8e47 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -104,7 +104,7 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) }
if (hContact != 0 && (iFlags & VKFLAG_MSGUNREAD) && !IsMessageExist(iMessageId, vkIN)) {
- MarkRemoteRead(hContact);
+ MarkRemoteRead(hContact, iMessageId);
if (m_vkOptions.bUserForceInvisibleOnActivity)
SetInvisible(hContact);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 1cdf42e861..368735e235 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -386,7 +386,7 @@ private: void __cdecl ContactTypingThread(void *p);
int IsHystoryMessageExist(MCONTACT hContact);
void SetSrmmReadStatus(MCONTACT hContact);
- void MarkRemoteRead(MCONTACT hContact);
+ void MarkRemoteRead(MCONTACT hContact, VKMessageID_t iMessageId = 0);
void MarkDialogAsRead(MCONTACT hContact);
void CheckUpdate();
bool IsGroupUser(MCONTACT hContact);
|