summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-12-06 15:20:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-12-06 15:20:27 +0300
commit0380841eece1c03a7a47da463c0f94d7945227d9 (patch)
treef64396c37bc6a21e518fcccb14312be717af679c
parent2262cc295453dd8bcfa9ba488769f7ce16fb432a (diff)
Discord: badly created channels should be removed (Miranda can't access them either)
-rw-r--r--protocols/Discord/src/proto.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 6cc81030bf..2d4befca37 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -144,12 +144,23 @@ void CDiscordProto::OnModulesLoaded()
arUsers.insert(pNew);
// set EnableSync = 1 by default for all existing guilds
- if (getByte(hContact, "ChatRoom") == 2) {
+ switch (getByte(hContact, "ChatRoom")) {
+ case 2: // guild
delSetting(hContact, DB_KEY_CHANNELID);
if (getDword(hContact, "EnableSync", -1) == -1)
setDword(hContact, "EnableSync", 1);
+ break;
+
+ case 1: // group chat
+ pNew->channelId = getId(hContact, DB_KEY_CHANNELID);
+ if (!pNew->channelId)
+ db_delete_contact(hContact);
+ break;
+
+ default:
+ pNew->channelId = getId(hContact, DB_KEY_CHANNELID);
+ break;
}
- else pNew->channelId = getId(hContact, DB_KEY_CHANNELID);
}
// Clist