diff options
author | ElzorFox <elzorfox@ya.ru> | 2017-01-25 13:42:57 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2017-01-25 13:42:57 +0500 |
commit | 9d92a46105e5203c829a0e1958285e74a984a7f4 (patch) | |
tree | 87ae6991ede2fb54452a5cc910e40204d31d7a4f /protocols/VKontakte/src/misc.cpp | |
parent | f9c61d93a14c89c89f234d978fb4264a3b271266 (diff) |
VKontakte:
fix autoloading history on open message window
fix cleaning lastmsgid key on ‘empty’ sync history
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 885f00f9a1..7f81cdf53e 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -132,8 +132,8 @@ char* ExpUrlEncode(const char *szUrl, bool strict) *d++ = szHexDigits[*s & 0xF];
}
- *d = '\0';
- return szOutput;
+ *d = '\0';
+ return szOutput;
}
@@ -670,21 +670,47 @@ void CVkProto::ContactTypingThread(void *p) }
}
+int CVkProto::IsHystoryMessageExist(MCONTACT hContact)
+{
+ if (!hContact)
+ return 0;
+
+ MEVENT hDBEvent = db_event_first(hContact);
+
+ if (!hDBEvent)
+ return 0;
+
+ do {
+ DBEVENTINFO dbei = {};
+ db_event_get(hDBEvent, &dbei);
+ if (dbei.eventType != VK_USER_DEACTIVATE_ACTION)
+ return 1;
+
+ hDBEvent = db_event_next(hContact, hDBEvent);
+ } while (hDBEvent);
+
+ return -1;
+}
+
int CVkProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
{
debugLogA("CVkProto::OnProcessSrmmEvent");
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
+
+ CMStringA szProto(GetContactProto(event->hContact));
+ if (szProto.IsEmpty() || szProto != m_szModuleName)
+ return 0;
+
if (event->uType == MSG_WINDOW_EVT_OPENING && !ServiceExists(MS_MESSAGESTATE_UPDATE))
SetSrmmReadStatus(event->hContact);
- if (event->uType == MSG_WINDOW_EVT_OPENING && m_vkOptions.bLoadLastMessageOnMsgWindowsOpen
- && getDword(event->hContact, "lastmsgid", -1) == -1 && !isChatRoom(event->hContact)) {
+ if (event->uType == MSG_WINDOW_EVT_OPENING && m_vkOptions.bLoadLastMessageOnMsgWindowsOpen
+ && !isChatRoom(event->hContact) && IsHystoryMessageExist(event->hContact) != 1) {
m_bNotifyForEndLoadingHistory = false;
- GetServerHistory(event->hContact, 0, 100, 0, 0, true);
+ GetServerHistory(event->hContact, 0, MAXHISTORYMIDSPERONE, 0, 0, true);
}
-
return 0;
}
|