summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-01 14:54:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-01 14:54:08 +0300
commit966214ad3db583c8e8cbfbae4281705f73df4429 (patch)
treefd29be7e3d67bb584e4916571d9557a104d407c0 /protocols
parentc85ac94a325f120ae86d3971baa2cbda6561c797 (diff)
Discord to move towards message ids revolution in 0.95.10
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/server.cpp17
-rw-r--r--protocols/Discord/src/version.h6
2 files changed, 14 insertions, 9 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 1fc868642f..b9ce60811e 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -105,13 +105,18 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
else
dbei.flags &= ~DBEF_READ;
- CMStringA szBody(ptrA(mir_utf8encodeW(wszText)));
- szBody.AppendFormat("%c%lld", 0, msgid);
-
+ ptrA szBody(mir_utf8encodeW(wszText));
dbei.timestamp = dwTimeStamp;
- dbei.pBlob = (PBYTE)szBody.GetBuffer();
- dbei.cbBlob = szBody.GetLength();
- db_event_add(pUser->hContact, &dbei);
+ dbei.pBlob = (PBYTE)szBody.get();
+ dbei.cbBlob = (DWORD)mir_strlen(szBody);
+
+ char szMsgId[100];
+ _i64toa_s(msgid, szMsgId, _countof(szMsgId), 10);
+ MEVENT hDbEvent = db_event_getById(m_szModuleName, szMsgId);
+ if (hDbEvent != 0)
+ db_event_edit(pUser->hContact, hDbEvent, &dbei);
+ else
+ db_event_add(pUser->hContact, &dbei);
}
else {
ParseSpecialChars(si, wszText);
diff --git a/protocols/Discord/src/version.h b/protocols/Discord/src/version.h
index 19747c0df6..bf55aa75eb 100644
--- a/protocols/Discord/src/version.h
+++ b/protocols/Discord/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 5
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 2
+#define __MINOR_VERSION 6
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>