summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-09-27 19:29:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-09-27 19:29:19 +0300
commit0779b188d44b7795f4482c7066a064a38d7c130a (patch)
tree59c150d9d06b715f694b3373af6090c47ae2b32e /protocols/Discord
parent70df70d9bf061fd42523357bc8a34bf4323da964 (diff)
Discord: option to hide guild chats on startup
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/res/discord.rc41
-rw-r--r--protocols/Discord/src/guilds.cpp2
-rw-r--r--protocols/Discord/src/options.cpp3
-rw-r--r--protocols/Discord/src/proto.cpp1
-rw-r--r--protocols/Discord/src/proto.h3
-rw-r--r--protocols/Discord/src/resource.h5
-rw-r--r--protocols/Discord/src/stdafx.h1
-rw-r--r--protocols/Discord/src/version.h2
8 files changed, 53 insertions, 5 deletions
diff --git a/protocols/Discord/res/discord.rc b/protocols/Discord/res/discord.rc
index ef7bb54c64..fba3f590d7 100644
--- a/protocols/Discord/res/discord.rc
+++ b/protocols/Discord/res/discord.rc
@@ -53,8 +53,10 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON "discord.ico"
+
IDI_GROUPCHAT ICON "groupchat.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
@@ -73,6 +75,7 @@ BEGIN
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 "Hide guild chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,107,248,10
END
IDD_OPTIONS_ACCMGR DIALOGEX 0, 0, 200, 88
@@ -99,6 +102,44 @@ BEGIN
EDITTEXT IDC_NICK,3,18,103,12,0,WS_EX_CLIENTEDGE
END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPTIONS_ACCOUNT, DIALOG
+ BEGIN
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_OPTIONS_ACCOUNT AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 8b8f250835..52c1f290ed 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -107,7 +107,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszChannelId, wszChannelName);
BuildStatusList(pGuild, wszChannelId);
- Chat_Control(m_szModuleName, wszChannelId, WINDOW_HIDDEN);
+ Chat_Control(m_szModuleName, wszChannelId, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(m_szModuleName, wszChannelId, SESSION_ONLINE);
if (!wszTopic.IsEmpty()) {
diff --git a/protocols/Discord/src/options.cpp b/protocols/Discord/src/options.cpp
index 81fa9c506a..057a9980e3 100644
--- a/protocols/Discord/src/options.cpp
+++ b/protocols/Discord/src/options.cpp
@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class CDiscardAccountOptions : public CProtoDlgBase<CDiscordProto>
{
+ CCtrlCheck chkHideChats;
CCtrlEdit m_edGroup, m_edUserName, m_edPassword;
ptrW m_wszOldGroup;
@@ -30,10 +31,12 @@ public:
m_edGroup(this, IDC_GROUP),
m_edUserName(this, IDC_USERNAME),
m_edPassword(this, IDC_PASSWORD),
+ chkHideChats(this, IDC_HIDECHATS),
m_wszOldGroup(mir_wstrdup(ppro->m_wszDefaultGroup))
{
CreateLink(m_edGroup, ppro->m_wszDefaultGroup);
CreateLink(m_edUserName, ppro->m_wszEmail);
+ CreateLink(chkHideChats, ppro->m_bHideGroupchats);
}
virtual void OnInitDialog() override
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 102f739be4..a2550ec601 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -43,6 +43,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) :
m_evRequestsQueue(CreateEvent(nullptr, FALSE, FALSE, nullptr)),
m_wszDefaultGroup(this, DB_KEY_GROUP, DB_KEYVAL_GROUP),
m_wszEmail(this, DB_KEY_EMAIL, L""),
+ m_bHideGroupchats(this, DB_KEY_HIDECHATS, true),
arGuilds(1, compareGuilds),
arMarkReadQueue(1, compareUsers),
arOwnMessages(1, compareMessages),
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index b2d18e4350..56c04ef157 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -235,7 +235,8 @@ class CDiscordProto : public PROTO<CDiscordProto>
// options
CMOption<wchar_t*> m_wszEmail; // my own email
- CMOption<wchar_t*> m_wszDefaultGroup; // clist group to store contacts
+ CMOption<wchar_t*> m_wszDefaultGroup; // clist group to store contacts
+ CMOption<BYTE> m_bHideGroupchats; // hide guild chats on startup
//////////////////////////////////////////////////////////////////////////////////////
// common data
diff --git a/protocols/Discord/src/resource.h b/protocols/Discord/src/resource.h
index 65d61f094f..e73ee518ec 100644
--- a/protocols/Discord/src/resource.h
+++ b/protocols/Discord/src/resource.h
@@ -11,14 +11,15 @@
#define IDC_USERNAME 1002
#define IDC_GROUP 1003
#define IDC_NICK 1004
+#define IDC_HIDECHATS 1005
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1005
+#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h
index 1b31333ae0..12b741fa85 100644
--- a/protocols/Discord/src/stdafx.h
+++ b/protocols/Discord/src/stdafx.h
@@ -56,6 +56,7 @@ extern HWND g_hwndHeartbeat;
#define DB_KEY_MFA "MfaEnabled"
#define DB_KEY_NICK "Nick"
#define DB_KEY_AVHASH "AvatarHash"
+#define DB_KEY_HIDECHATS "HideChats"
#define DB_KEY_CHANNELID "ChannelID"
#define DB_KEY_LASTMSGID "LastMessageID"
#define DB_KEY_REQAUTH "ReqAuth"
diff --git a/protocols/Discord/src/version.h b/protocols/Discord/src/version.h
index a7660661d8..248ffde201 100644
--- a/protocols/Discord/src/version.h
+++ b/protocols/Discord/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 5
#define __RELEASE_NUM 1
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>