summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp16
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);