summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_history.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/vk_history.cpp')
-rw-r--r--protocols/VKontakte/src/vk_history.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index 8883238694..794ac8e465 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -108,6 +108,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay)
m_bNotifyForEndLoadingHistory = true;
}
+ setDword(hContact, "oldlastmsgid", getDword(hContact, "lastmsgid", -1));
db_unset(hContact, m_szModuleName, "lastmsgid");
GetServerHistory(hContact, 0, MAXHISTORYMIDSPERONE, tTime, 0);
}
@@ -264,6 +265,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque
count++;
}
+
setDword(param->hContact, "lastmsgid", iLastMsgId);
if (ServiceExists(MS_MESSAGESTATE_UPDATE)) {
@@ -280,6 +282,9 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque
if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
+ setDword(param->hContact, "lastmsgid", iLastMsgId == -1 ? getDword(param->hContact, "oldlastmsgid", -1) : iLastMsgId);
+ db_unset(param->hContact, m_szModuleName, "oldlastmsgid");
+
ptrW pwszNick(db_get_wsa(param->hContact, m_szModuleName, "Nick"));
CMStringW str(FORMAT, TranslateT("Loading messages for %s is completed."), pwszNick);
debugLogW(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask);