summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-13 12:13:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-13 12:13:40 +0300
commitba00e60921f9a63a2b6157fc10a98f4db99aaa6b (patch)
treec71c646208357492fe30b17b1fad8c9212665cca /protocols/Discord
parent58b9cd3d8edda8e0b94b802aa2e4bb0d36adb11b (diff)
fixes #1262 ([Discord] Database migration causes duplication of discord contacts)
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/src/proto.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index b4207c66f0..c3cd1eda57 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -64,17 +64,6 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) :
// database
db_set_resident(m_szModuleName, "XStatusMsg");
- // Fill users list
- for (auto &hContact : AccContacts()) {
- CDiscordUser *pNew = new CDiscordUser(getId(hContact, DB_KEY_ID));
- pNew->hContact = hContact;
- pNew->channelId = getId(hContact, DB_KEY_CHANNELID);
- pNew->lastMsg.id = getId(hContact, DB_KEY_LASTMSGID);
- pNew->wszUsername = ptrW(getWStringA(hContact, DB_KEY_NICK));
- pNew->iDiscriminator = getDword(hContact, DB_KEY_DISCR);
- arUsers.insert(pNew);
- }
-
// Network initialization
CMStringW descr;
NETLIBUSER nlu = {};
@@ -562,6 +551,17 @@ HANDLE CDiscordProto::SendFile(MCONTACT hContact, const wchar_t *szDescription,
int CDiscordProto::OnModulesLoaded(WPARAM, LPARAM)
{
+ // Fill users list
+ for (auto &hContact : AccContacts()) {
+ CDiscordUser *pNew = new CDiscordUser(getId(hContact, DB_KEY_ID));
+ pNew->hContact = hContact;
+ pNew->channelId = getId(hContact, DB_KEY_CHANNELID);
+ pNew->lastMsg.id = getId(hContact, DB_KEY_LASTMSGID);
+ pNew->wszUsername = ptrW(getWStringA(hContact, DB_KEY_NICK));
+ pNew->iDiscriminator = getDword(hContact, DB_KEY_DISCR);
+ arUsers.insert(pNew);
+ }
+
GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.ptszDispName = m_tszUserName;