From cfe123df04b3317cc55d2405614d60496cd9bd3c Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Fri, 8 Dec 2023 07:45:10 +0500 Subject: VKontakte: forward only messages --- protocols/VKontakte/src/vk_messages.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 881c0a3e86..94bebc7e78 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -51,15 +51,17 @@ int CVkProto::ForwardMsg(MCONTACT hContact, std::vector& vForvardEvents, if (iForwardVKMessageCount == VK_MAX_FORWARD_MESSAGES) break; + iForwardVKMessageCount++; + DB::EventInfo dbei(mEvnt); - if (!dbei) + if (!dbei || dbei.eventType != EVENTTYPE_MESSAGE) continue; MCONTACT hForwardContact = db_event_getContact(mEvnt); if (!Proto_IsProtoOnContact(hForwardContact, m_szModuleName)) { CMStringW wszContactName = (dbei.flags & DBEF_SENT) ? getWStringA(hContact, "Nick", TranslateT("Me")) : Clist_GetContactDisplayName(hForwardContact); - + wchar_t ttime[64]; time_t tTimestamp(dbei.timestamp); _locale_t locale = _create_locale(LC_ALL, ""); @@ -75,13 +77,12 @@ int CVkProto::ForwardMsg(MCONTACT hContact, std::vector& vForvardEvents, ttime, dbei.pBlob ? ptrW(mir_utf8decodeW((char*)dbei.pBlob)) : L"" ); + } else if (mir_strlen(dbei.szId) > 0) { if (!szIds.IsEmpty()) szIds.AppendChar(','); szIds += dbei.szId; } - - iForwardVKMessageCount++; } ULONG uMsgId = ::InterlockedIncrement(&m_iMsgId); -- cgit v1.2.3