From 5a5a0265a25e063ae560adbf83042e01d0ce1941 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Tue, 22 Sep 2015 09:30:48 +0000 Subject: VKontakte: hidden option for full load clist support for sync message read status from server version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15421 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'protocols/VKontakte/src/misc.cpp') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index b83bb0d396..06e0bccac2 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -655,6 +655,32 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } +void CVkProto::MarkDialogAsRead(MCONTACT hContact) +{ + debugLogA("CVkProto::MarkDialogAsRead"); + if (!IsOnline()) + return; + + LONG userID = getDword(hContact, "ID", -1); + if (userID == -1 || userID == VK_FEED_USER) + return; + + MEVENT hDBEvent; + while ((hDBEvent = db_event_firstUnread(hContact)) != NULL) { + db_event_markRead(hContact, hDBEvent); + int res = CallService(MS_CLIST_REMOVEEVENT, hContact, hDBEvent); + debugLogA("CVkProto::MarkDialogAsRead [1] result = %d, hDbEvent = %d", res, (int)hDBEvent); + } + + hContact = db_mc_tryMeta(hContact); + CLISTEVENT *cle = NULL; + while ((cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, hContact, 0)) != NULL) { + db_event_markRead(hContact, cle->hDbEvent); + int res = CallService(MS_CLIST_REMOVEEVENT, hContact, cle->hDbEvent); + debugLogA("CVkProto::MarkDialogAsRead [2] result = %d, hDbEvent = %d", res, (int)(cle->hDbEvent)); + } +} + char* CVkProto::GetStickerId(const char* Msg, int &stickerid) { stickerid = 0; -- cgit v1.2.3