diff options
author | ElzorFox <elzorfox@ya.ru> | 2018-10-09 09:43:20 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2018-10-09 09:43:20 +0500 |
commit | f2f150f613e06712b3c8069720f7651bfbbd1b40 (patch) | |
tree | b0c8c297e5d7b689ecf961f2ceb1ffeae5c5fca8 /protocols/VKontakte/src | |
parent | c15750f0863773722214557fdff7b06e25801cd9 (diff) |
VKontakte:
rework load attachments on link sending and receiving
version bump
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 5604d40413..59e7733f67 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 7
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 60c6bf5207..caa43907c8 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -253,6 +253,8 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe wszBody += wszFwdMessages;
}
+ CMStringW wszBodyNoAttachments = wszBody;
+
CMStringW wszAttachmentDescr;
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
@@ -332,16 +334,24 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe debugLogA("CVkProto::OnReceiveMessages mid = %d, datetime = %d, isOut = %d, isRead = %d, uid = %d", mid, datetime, isOut, isRead, uid);
- if (!IsMessageExist(mid, vkOUT) || bEdited) {
+ if (!IsMessageExist(mid, vkALL) || bEdited) {
debugLogA("CVkProto::OnReceiveMessages ProtoChainRecvMsg");
recv.szMsgId = szMid;
ProtoChainRecvMsg(hContact, &recv);
if (mid > getDword(hContact, "lastmsgid", -1))
setDword(hContact, "lastmsgid", mid);
}
- else if (m_vkOptions.bLoadSentAttachments && !wszAttachmentDescr.IsEmpty() && isOut) {
+ else if (m_vkOptions.bLoadSentAttachments && !wszAttachmentDescr.IsEmpty()) {
+ CMStringW wszOldMsg;
+
+ if (GetMessageFromDb(mid, datetime, wszOldMsg) && (wszOldMsg == wszBody))
+ continue;
+
+ if (wszBodyNoAttachments != wszOldMsg)
+ continue;
+
T2Utf pszAttach(wszAttachmentDescr);
- recv.timestamp = time(0); // only local time
+ recv.timestamp = isOut ? time(0) : datetime;
recv.szMessage = pszAttach;
recv.szMsgId = strcat(szMid, "_");
ProtoChainRecvMsg(hContact, &recv);
|