diff options
author | George Hazan <ghazan@miranda.im> | 2018-10-31 16:38:45 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-10-31 16:38:45 +0300 |
commit | 5cfe759310f1368eb5bcd3ed07918a61768f7cde (patch) | |
tree | 625ef2f3ab9ffe8848638c8cb1ed5a15a0602ab8 /protocols/Discord/src/proto.cpp | |
parent | 5cc9245a01e968e8c6fbc801b46a489e7abbac15 (diff) |
Discord: subgroups usage is enabled for the new accounts only
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 6e4164fd5b..a803488898 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -49,7 +49,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : m_wszEmail(this, "Email", L""), m_wszDefaultGroup(this, "GroupName", DB_KEYVAL_GROUP), m_bHideGroupchats(this, "HideChats", true), - m_bUseGuildGroups(this, "UseGuildGroups", true) + m_bUseGuildGroups(this, "UseGuildGroups", false) { // Services CreateProtoService(PS_CREATEACCMGRUI, &CDiscordProto::SvcCreateAccMgrUI); @@ -62,6 +62,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : // Events HookProtoEvent(ME_OPT_INITIALISE, &CDiscordProto::OnOptionsInit); HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CDiscordProto::OnDbEventRead); + HookProtoEvent(ME_PROTO_ACCLISTCHANGED, &CDiscordProto::OnAccountChanged); // database db_set_resident(m_szModuleName, "XStatusMsg"); @@ -457,6 +458,19 @@ int CDiscordProto::OnDbEventRead(WPARAM, LPARAM hDbEvent) ///////////////////////////////////////////////////////////////////////////////////////// +int CDiscordProto::OnAccountChanged(WPARAM iAction, LPARAM lParam) +{ + if (iAction == PRAC_ADDED) { + PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam; + if (pa && pa->ppro == this) + m_bUseGuildGroups = true; + } + + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CDiscordProto::OnContactDeleted(MCONTACT hContact) { CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID)); |