diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-14 15:13:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-14 15:13:39 +0300 |
commit | eb5e8631d087f8fa6b100caf37331503b9ac4ed4 (patch) | |
tree | 8c710ca7d2b10e974299c890058e29cd2b66156c | |
parent | ec73c22503f6e4f742abcfeca300629e95dc573d (diff) |
fixes #1894 ([Discord] syncing DM contact Miranda take random message and copy it +19x times)
-rw-r--r-- | protocols/Discord/src/menus.cpp | 1 | ||||
-rw-r--r-- | protocols/Discord/src/server.cpp | 6 | ||||
-rw-r--r-- | protocols/Discord/src/version.h | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/protocols/Discord/src/menus.cpp b/protocols/Discord/src/menus.cpp index fc3df4d44e..8ebf50613b 100644 --- a/protocols/Discord/src/menus.cpp +++ b/protocols/Discord/src/menus.cpp @@ -82,6 +82,7 @@ INT_PTR CDiscordProto::OnMenuLoadHistory(WPARAM hContact, LPARAM) if (pUser) { pUser->bSkipHistory = true; RetrieveHistory(pUser, MSG_AFTER, 0, 100); + delSetting(hContact, DB_KEY_LASTMSGID); pUser->bSkipHistory = false; } return 0; diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index cae684f970..c5655381ac 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -106,14 +106,16 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest dbei.pBlob = (PBYTE)szBody.get(); dbei.cbBlob = (DWORD)mir_strlen(szBody); + bool bSucceeded = false; char szMsgId[100]; _i64toa_s(msgid, szMsgId, _countof(szMsgId), 10); MEVENT hDbEvent = db_event_getById(m_szModuleName, szMsgId); if (hDbEvent != 0) { if (!pUser->bSkipHistory) - db_event_edit(pUser->hContact, hDbEvent, &dbei); + bSucceeded = 0 == db_event_edit(pUser->hContact, hDbEvent, &dbei); } - else { + + if (!bSucceeded) { MEVENT hNew = db_event_add(pUser->hContact, &dbei); if (hNew != 0) db_event_setId(m_szModuleName, hNew, szMsgId); diff --git a/protocols/Discord/src/version.h b/protocols/Discord/src/version.h index 61ad77e877..489805825c 100644 --- a/protocols/Discord/src/version.h +++ b/protocols/Discord/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 6 -#define __RELEASE_NUM 1 -#define __BUILD_NUM 4 +#define __RELEASE_NUM 2 +#define __BUILD_NUM 1 #include <stdver.h> |