summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorElzorFox <elzorfox@ya.ru>2018-10-03 17:31:42 +0500
committerElzorFox <elzorfox@ya.ru>2018-10-03 17:31:42 +0500
commit39fb3e8fa1f2603bdca1cf005d382c18b0f3f993 (patch)
tree40187fdcff817a80908e44dcbdd5d57eac7507de /protocols
parent5ea4704b38bd381008f61418405d606483d68f29 (diff)
VKontakte:
history synchronization without deleting messages version bump
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_history.cpp32
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp1
3 files changed, 21 insertions, 14 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 2f84f0faaa..15891a286b 100644
--- a/protocols/VKontakte/src/version.h
+++ b/protocols/VKontakte/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 6
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index dab77003d9..e6271b6835 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -104,21 +104,23 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay)
time_t tTime = time(0) - 60 * 60 * 24 * NDay;
- MEVENT hDBEvent = db_event_first(hContact);
- while (hDBEvent) {
- MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
- DBEVENTINFO dbei = {};
- db_event_get(hDBEvent, &dbei);
- if (dbei.timestamp > tTime && dbei.eventType != VK_USER_DEACTIVATE_ACTION)
- db_event_delete(hContact, hDBEvent);
- hDBEvent = hDBEventNext;
- }
+ if (NDay > 3) {
+ MEVENT hDBEvent = db_event_first(hContact);
+ while (hDBEvent) {
+ MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
+ DBEVENTINFO dbei = {};
+ db_event_get(hDBEvent, &dbei);
+ if (dbei.timestamp > tTime && dbei.eventType != VK_USER_DEACTIVATE_ACTION)
+ db_event_delete(hContact, hDBEvent);
+ hDBEvent = hDBEventNext;
+ }
- {
- mir_cslock lck(m_csLoadHistoryTask);
- m_iLoadHistoryTask++;
- if (NDay > 3)
+ {
+ mir_cslock lck(m_csLoadHistoryTask);
+ m_iLoadHistoryTask++;
m_bNotifyForEndLoadingHistory = true;
+ }
+
}
setDword(hContact, "oldlastmsgid", getDword(hContact, "lastmsgid", -1));
@@ -295,6 +297,10 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque
recv.szMsgId = szMid;
ProtoChainRecvMsg(hContact, &recv);
+ MEVENT hDbEvent = db_event_getById(m_szModuleName, strcat(szMid, "_"));
+ if (hDbEvent)
+ db_event_delete(hContact, hDbEvent);
+
if (isRead && isOut && datetime > tLastReadMessageTime)
tLastReadMessageTime = datetime;
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index fd91d769f0..60c6bf5207 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -343,6 +343,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
T2Utf pszAttach(wszAttachmentDescr);
recv.timestamp = time(0); // only local time
recv.szMessage = pszAttach;
+ recv.szMsgId = strcat(szMid, "_");
ProtoChainRecvMsg(hContact, &recv);
}
}