summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-04-23 21:24:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-04-23 21:24:23 +0300
commitaf206b4db260512719cb2771f234b9d7975a3727 (patch)
tree15ecf1c55a4b92ba316c19793c973fb2d3b51b3b /protocols
parent333f189add8c6ba4194d357b6c44db9f0246cae6 (diff)
fixes #1925 ([Discord] Guildchat information for "general" chat is stored in the "Server" contact, resulting in history retrieval issues)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/guilds.cpp2
-rw-r--r--protocols/Discord/src/proto.cpp6
2 files changed, 5 insertions, 3 deletions
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 = {};