From 603b969ceae10078727e0ed1acf3be1efdefec77 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Thu, 3 Mar 2016 19:53:44 +0000 Subject: VK: fix read state synchronization git-svn-id: http://svn.miranda-ng.org/main/trunk@16413 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'protocols/VKontakte/src/misc.cpp') 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); + } } } -- cgit v1.2.3