From af206b4db260512719cb2771f234b9d7975a3727 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 23 Apr 2019 21:24:14 +0300 Subject: fixes #1925 ([Discord] Guildchat information for "general" chat is stored in the "Server" contact, resulting in history retrieval issues) --- protocols/Discord/src/guilds.cpp | 2 +- protocols/Discord/src/proto.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index 9e1867fa33..633303cf59 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -138,7 +138,7 @@ void CDiscordProto::ProcessGuild(const JSONNode &p) SESSION_INFO *si = Chat_NewSession(GCW_SERVER, m_szModuleName, pGuild->wszName, pGuild->wszName, pGuild); pGuild->pParentSi = (SESSION_INFO*)si; pGuild->hContact = si->hContact; - setId(si->hContact, DB_KEY_CHANNELID, guildId); + if (!pGuild->bSynced && getByte(si->hContact, "EnableSync")) GatewaySendGuildInfo(guildId); diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index d0fa670de4..0526883730 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -106,16 +106,18 @@ void CDiscordProto::OnModulesLoaded() for (auto &hContact : AccContacts()) { CDiscordUser *pNew = new CDiscordUser(getId(hContact, DB_KEY_ID)); pNew->hContact = hContact; - pNew->channelId = getId(hContact, DB_KEY_CHANNELID); pNew->lastMsgId = getId(hContact, DB_KEY_LASTMSGID); pNew->wszUsername = ptrW(getWStringA(hContact, DB_KEY_NICK)); pNew->iDiscriminator = getDword(hContact, DB_KEY_DISCR); arUsers.insert(pNew); // set EnableSync = 1 by default for all existing guilds - if (getByte(hContact, "ChatRoom") == 2) + if (getByte(hContact, "ChatRoom") == 2) { + delSetting(hContact, DB_KEY_CHANNELID); if (getDword(hContact, "EnableSync", -1) == -1) setDword(hContact, "EnableSync", 1); + } + else pNew->channelId = getId(hContact, DB_KEY_CHANNELID); } GCREGISTER gcr = {}; -- cgit v1.2.3