summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-03 19:53:44 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-03 19:53:44 +0000
commit603b969ceae10078727e0ed1acf3be1efdefec77 (patch)
treeca85db11837d57422da626f4cea2a331afac4006 /protocols/VKontakte/src/misc.cpp
parenteb091c59e72ddc90d812091bb2fc7ffb0a8093a8 (diff)
VK: fix read state synchronization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16413 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index eaf5ba5e44..0ea0ebb483 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -680,15 +680,20 @@ void CVkProto::MarkDialogAsRead(MCONTACT hContact)
if (userID == -1 || userID == VK_FEED_USER)
return;
- MEVENT hDBEvent;
+ MEVENT hDBEvent = NULL;
MCONTACT hMContact = db_mc_tryMeta(hContact);
- while ((hDBEvent = db_event_firstUnread(hContact)) != NULL) {
- db_event_markRead(hContact, hDBEvent);
- int res1 = pcli->pfnRemoveEvent(hMContact, hDBEvent);
- int res2 = 2;
- if (hContact != hMContact)
- res2 = pcli->pfnRemoveEvent(hContact, hDBEvent);
- debugLogA("CVkProto::MarkDialogAsRead [1] result = (%d, %d), hDbEvent = %d", res1, res2, (int)hDBEvent);
+ while ((hDBEvent = db_event_firstUnread(hContact)) != NULL)
+ {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if (!db_event_get(hDBEvent, &dbei) && !mir_strcmp(m_szModuleName, dbei.szModule))
+ {
+ db_event_markRead(hContact, hDBEvent);
+ int res1 = pcli->pfnRemoveEvent(hMContact, hDBEvent);
+ int res2 = 2;
+ if (hContact != hMContact)
+ res2 = pcli->pfnRemoveEvent(hContact, hDBEvent);
+ debugLogA("CVkProto::MarkDialogAsRead [1] result = (%d, %d), hDbEvent = %d", res1, res2, (int)hDBEvent);
+ }
}
}