summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_history.cpp
diff options
context:
space:
mode:
authorElzorFox <elzorfox@ya.ru>2017-01-25 13:42:57 +0500
committerElzorFox <elzorfox@ya.ru>2017-01-25 13:42:57 +0500
commit9d92a46105e5203c829a0e1958285e74a984a7f4 (patch)
tree87ae6991ede2fb54452a5cc910e40204d31d7a4f /protocols/VKontakte/src/vk_history.cpp
parentf9c61d93a14c89c89f234d978fb4264a3b271266 (diff)
VKontakte:
fix autoloading history on open message window fix cleaning lastmsgid key on ‘empty’ sync history
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);