summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/res/discord.rc16
-rw-r--r--protocols/Discord/src/dispatch.cpp2
-rw-r--r--protocols/Discord/src/guilds.cpp3
-rw-r--r--protocols/Discord/src/options.cpp15
-rw-r--r--protocols/Discord/src/proto.cpp5
-rw-r--r--protocols/Discord/src/proto.h1
-rw-r--r--protocols/Discord/src/resource.h2
7 files changed, 32 insertions, 12 deletions
diff --git a/protocols/Discord/res/discord.rc b/protocols/Discord/res/discord.rc
index c42bba4392..1b15d35f61 100644
--- a/protocols/Discord/res/discord.rc
+++ b/protocols/Discord/res/discord.rc
@@ -62,7 +62,7 @@ IDI_GROUPCHAT ICON "groupchat.ico"
// Dialog
//
-IDD_OPTIONS_ACCOUNT DIALOGEX 0, 0, 305, 190
+IDD_OPTIONS_ACCOUNT DIALOGEX 0, 0, 305, 154
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -72,12 +72,14 @@ BEGIN
EDITTEXT IDC_USERNAME,84,18,123,13,ES_AUTOHSCROLL
LTEXT "Password:",IDC_STATIC,17,36,61,8,0,WS_EX_RIGHT
EDITTEXT IDC_PASSWORD,84,34,123,13,ES_PASSWORD | ES_AUTOHSCROLL
- GROUPBOX "Contacts",IDC_STATIC,7,77,291,88
- LTEXT "Default group:",IDC_STATIC,17,91,61,8,0,WS_EX_RIGHT
- EDITTEXT IDC_GROUP,84,89,123,13,ES_AUTOHSCROLL
- CONTROL "Do not open chat windows on creation",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,107,248,10
- CONTROL "Use subgroups for guild's channels (requires restart)",IDC_USEGROUPS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,121,248,10
+ GROUPBOX "Contacts",IDC_STATIC,7,71,291,79
+ LTEXT "Default group:",IDC_STATIC,17,88,61,8,0,WS_EX_RIGHT
+ EDITTEXT IDC_GROUP,84,86,123,13,ES_AUTOHSCROLL
+ CONTROL "Enable group chats",IDC_USECHANNELS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,105,248,10
+ CONTROL "Do not open chat windows on creation",IDC_HIDECHATS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,118,248,10
+ CONTROL "Use subgroups for Server channels (requires restart)",IDC_USEGROUPS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,131,248,10
END
IDD_OPTIONS_ACCMGR DIALOGEX 0, 0, 200, 88
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index fa351bb0f0..e55c28ee1b 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -94,7 +94,7 @@ void CDiscordProto::OnCommandChannelCreated(const JSONNode &pRoot)
else {
// group channel for a guild
CDiscordGuild *pGuild = FindGuild(guildId);
- if (pGuild) {
+ if (pGuild && m_bUseGroupchats) {
CDiscordUser *pUser = ProcessGuildChannel(pGuild, pRoot);
if (pUser)
CreateChat(pGuild, pUser);
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 023b8684fd..9e1867fa33 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -157,7 +157,8 @@ void CDiscordProto::ProcessGuild(const JSONNode &p)
for (auto itc = channels.begin(); itc != channels.end(); ++itc)
ProcessGuildChannel(pGuild, *itc);
- ForkThread(&CDiscordProto::BatchChatCreate, pGuild);
+ if (m_bUseGroupchats)
+ ForkThread(&CDiscordProto::BatchChatCreate, pGuild);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Discord/src/options.cpp b/protocols/Discord/src/options.cpp
index dce2a2e46c..98f6e285ce 100644
--- a/protocols/Discord/src/options.cpp
+++ b/protocols/Discord/src/options.cpp
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class CDiscardAccountOptions : public CProtoDlgBase<CDiscordProto>
{
- CCtrlCheck chkHideChats, chkUseGroups;
+ CCtrlCheck chkUseChats, chkHideChats, chkUseGroups;
CCtrlEdit m_edGroup, m_edUserName, m_edPassword;
ptrW m_wszOldGroup;
@@ -31,6 +31,7 @@ public:
m_edGroup(this, IDC_GROUP),
m_edUserName(this, IDC_USERNAME),
m_edPassword(this, IDC_PASSWORD),
+ chkUseChats(this, IDC_USECHANNELS),
chkHideChats(this, IDC_HIDECHATS),
chkUseGroups(this, IDC_USEGROUPS),
m_wszOldGroup(mir_wstrdup(ppro->m_wszDefaultGroup))
@@ -38,8 +39,11 @@ public:
CreateLink(m_edGroup, ppro->m_wszDefaultGroup);
CreateLink(m_edUserName, ppro->m_wszEmail);
if (bFullDlg) {
+ CreateLink(chkUseChats, ppro->m_bUseGroupchats);
CreateLink(chkHideChats, ppro->m_bHideGroupchats);
CreateLink(chkUseGroups, ppro->m_bUseGuildGroups);
+
+ chkUseChats.OnChange = Callback(this, &CDiscardAccountOptions::onChange_GroupChats);
}
}
@@ -48,6 +52,8 @@ public:
ptrW buf(m_proto->getWStringA(DB_KEY_PASSWORD));
if (buf)
m_edPassword.SetText(buf);
+
+ onChange_GroupChats(0);
return true;
}
@@ -60,6 +66,13 @@ public:
m_proto->setWString(DB_KEY_PASSWORD, buf);
return true;
}
+
+ void onChange_GroupChats(CCtrlCheck*)
+ {
+ bool bEnabled = chkUseChats.GetState();
+ chkHideChats.Enable(bEnabled);
+ chkUseGroups.Enable(bEnabled);
+ }
};
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index e20cdb18ca..4dd821c6a2 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -48,6 +48,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) :
m_wszEmail(this, "Email", L""),
m_wszDefaultGroup(this, "GroupName", DB_KEYVAL_GROUP),
+ m_bUseGroupchats(this, "UseGroupChats", false),
m_bHideGroupchats(this, "HideChats", true),
m_bUseGuildGroups(this, "UseGuildGroups", false)
{
@@ -467,8 +468,10 @@ int CDiscordProto::OnAccountChanged(WPARAM iAction, LPARAM lParam)
{
if (iAction == PRAC_ADDED) {
PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
- if (pa && pa->ppro == this)
+ if (pa && pa->ppro == this) {
+ m_bUseGroupchats = false;
m_bUseGuildGroups = true;
+ }
}
return 0;
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 611db0d662..2b296a01f2 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -180,6 +180,7 @@ class CDiscordProto : public PROTO<CDiscordProto>
CMOption<wchar_t*> m_wszEmail; // my own email
CMOption<wchar_t*> m_wszDefaultGroup; // clist group to store contacts
+ CMOption<BYTE> m_bUseGroupchats; // Shall we connect Guilds at all?
CMOption<BYTE> m_bHideGroupchats; // Do not open chat windows on creation
CMOption<BYTE> m_bUseGuildGroups; // use special subgroups for guilds
diff --git a/protocols/Discord/src/resource.h b/protocols/Discord/src/resource.h
index 7765cedeea..a434f423de 100644
--- a/protocols/Discord/src/resource.h
+++ b/protocols/Discord/src/resource.h
@@ -13,7 +13,7 @@
#define IDC_NICK 1004
#define IDC_HIDECHATS 1005
#define IDC_USEGROUPS 1006
-#define IDC_CHECK1 1007
+#define IDC_USECHANNELS 1007
// Next default values for new objects
//