diff options
Diffstat (limited to 'plugins/AuthState/src')
-rw-r--r-- | plugins/AuthState/src/main.cpp | 28 | ||||
-rw-r--r-- | plugins/AuthState/src/options.cpp | 31 | ||||
-rw-r--r-- | plugins/AuthState/src/options.h | 47 | ||||
-rw-r--r-- | plugins/AuthState/src/stdafx.h | 7 | ||||
-rw-r--r-- | plugins/AuthState/src/version.h | 14 |
5 files changed, 54 insertions, 73 deletions
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 2b471bc150..62edf829b9 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -20,10 +20,9 @@ #include "stdafx.h"
static HGENMENU hUserMenu;
-HANDLE hExtraIcon;
-CMPlugin g_plugin;
+static HANDLE hExtraIcon;
-Opts Options;
+CMPlugin g_plugin;
static IconItem iconList[] =
{
@@ -56,7 +55,11 @@ PLUGININFOEX pluginInfoEx = { };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bUseAuthIcon(MODULENAME, "EnableAuthIcon", 1),
+ bUseGrantIcon(MODULENAME, "EnableGrantIcon", 1),
+ bContactMenuItem(MODULENAME, "MenuItem", 0),
+ bIconsForRecentContacts(MODULENAME, "EnableOnlyForRecent", 0)
{
}
@@ -66,7 +69,7 @@ INT_PTR getIconToUse(MCONTACT hContact, LPARAM) {
const char *proto = Proto_GetBaseAccountName(hContact);
// if (lParam == 1) return icon_none;
- if (!g_plugin.getByte(hContact, "ShowIcons", !Options.bIconsForRecentContacts))
+ if (!g_plugin.getByte(hContact, "ShowIcons", !g_plugin.bIconsForRecentContacts))
return ICON_NONE;
if (db_get_b(0, "ICQ", "UseServerCList", 0))
@@ -76,15 +79,15 @@ INT_PTR getIconToUse(MCONTACT hContact, LPARAM) // Facebook contact type
int type = db_get_b(hContact, proto, "ContactType", 0);
- if (Options.bUseAuthIcon & Options.bUseGrantIcon)
+ if (g_plugin.bUseAuthIcon & g_plugin.bUseGrantIcon)
if ((db_get_b(hContact, proto, "Auth", 0) && db_get_b(hContact, proto, "Grant", 0)) || type == 2)
return ICON_BOTH;
- if (Options.bUseAuthIcon)
+ if (g_plugin.bUseAuthIcon)
if (db_get_b(hContact, proto, "Auth", 0) || type == 3)
return ICON_AUTH;
- if (Options.bUseGrantIcon)
+ if (g_plugin.bUseGrantIcon)
if (db_get_b(hContact, proto, "Grant", 0) || type == 4)
return ICON_GRANT;
@@ -130,7 +133,7 @@ INT_PTR onAuthMenuSelected(WPARAM hContact, LPARAM) int onPrebuildContactMenu(WPARAM hContact, LPARAM)
{
- if (!Options.bContactMenuItem) {
+ if (!g_plugin.bContactMenuItem) {
Menu_ShowItem(hUserMenu, false);
return 0;
}
@@ -164,6 +167,9 @@ int onModulesLoaded(WPARAM, LPARAM) int CMPlugin::Load()
{
+ // IcoLib support
+ g_plugin.registerIcon(LPGEN("Auth state"), iconList);
+
HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
@@ -179,9 +185,5 @@ int CMPlugin::Load() mi.name.w = LPGENW("Enable AuthState icons");
mi.pszService = "AuthState/MenuItem";
hUserMenu = Menu_AddContactMenuItem(&mi);
-
- // IcoLib support
- g_plugin.registerIcon(LPGEN("Auth state"), iconList);
-
return 0;
}
diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp index d7f8b70cac..8ff821714b 100644 --- a/plugins/AuthState/src/options.cpp +++ b/plugins/AuthState/src/options.cpp @@ -19,13 +19,42 @@ #include "stdafx.h"
+class COptionsDialog : public CDlgBase
+{
+ CCtrlCheck m_chkAuthIcon;
+ CCtrlCheck m_chkGrantIcon;
+ CCtrlCheck m_chkMenuItem;
+ CCtrlCheck m_chkOnlyForRecent;
+
+public:
+ COptionsDialog() :
+ CDlgBase(g_plugin, IDD_AUTHSTATE_OPT),
+ m_chkAuthIcon(this, IDC_AUTHICON),
+ m_chkGrantIcon(this, IDC_GRANTICON),
+ m_chkMenuItem(this, IDC_ENABLEMENUITEM),
+ m_chkOnlyForRecent(this, IDC_ICONSFORRECENT)
+ {
+ CreateLink(m_chkAuthIcon, g_plugin.bUseAuthIcon);
+ CreateLink(m_chkGrantIcon, g_plugin.bUseGrantIcon);
+ CreateLink(m_chkMenuItem, g_plugin.bContactMenuItem);
+ CreateLink(m_chkOnlyForRecent, g_plugin.bIconsForRecentContacts);
+ }
+
+ bool OnApply() override
+ {
+ for (auto &hContact : Contacts())
+ onExtraImageApplying((WPARAM)hContact, 0);
+ return true;
+ }
+};
+
int onOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.szGroup.a = LPGEN("Icons");
odp.szTitle.a = LPGEN("Auth state");
odp.flags = ODPF_BOLDGROUPS;
- odp.pDialog = new COptionsDialog;
+ odp.pDialog = new COptionsDialog();
g_plugin.addOptions(wParam, &odp);
return 0;
}
diff --git a/plugins/AuthState/src/options.h b/plugins/AuthState/src/options.h deleted file mode 100644 index 07b0a45af8..0000000000 --- a/plugins/AuthState/src/options.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once
-
-struct Opts
-{
- CMOption<BYTE> bUseAuthIcon;
- CMOption<BYTE> bUseGrantIcon;
- CMOption<BYTE> bContactMenuItem;
- CMOption<BYTE> bIconsForRecentContacts;
-
- Opts() :
- bUseAuthIcon(MODULENAME, "EnableAuthIcon", 1),
- bUseGrantIcon(MODULENAME, "EnableGrantIcon", 1),
- bContactMenuItem(MODULENAME, "MenuItem", 0),
- bIconsForRecentContacts(MODULENAME, "EnableOnlyForRecent", 0)
- {}
-};
-
-extern Opts Options;
-
-
-class COptionsDialog : public CDlgBase
-{
- CCtrlCheck m_chkAuthIcon;
- CCtrlCheck m_chkGrantIcon;
- CCtrlCheck m_chkMenuItem;
- CCtrlCheck m_chkOnlyForRecent;
-public:
- COptionsDialog() :
- CDlgBase(g_plugin, IDD_AUTHSTATE_OPT),
- m_chkAuthIcon(this, IDC_AUTHICON),
- m_chkGrantIcon(this, IDC_GRANTICON),
- m_chkMenuItem(this, IDC_ENABLEMENUITEM),
- m_chkOnlyForRecent(this, IDC_ICONSFORRECENT)
- {
- CreateLink(m_chkAuthIcon, Options.bUseAuthIcon);
- CreateLink(m_chkGrantIcon, Options.bUseGrantIcon);
- CreateLink(m_chkMenuItem, Options.bContactMenuItem);
- CreateLink(m_chkOnlyForRecent, Options.bIconsForRecentContacts);
- }
-
- bool OnApply() override
- {
- for (auto &hContact : Contacts())
- onExtraImageApplying((WPARAM)hContact, 0);
- return true;
- }
-};
\ No newline at end of file diff --git a/plugins/AuthState/src/stdafx.h b/plugins/AuthState/src/stdafx.h index 6264b7f4ce..84487e182a 100644 --- a/plugins/AuthState/src/stdafx.h +++ b/plugins/AuthState/src/stdafx.h @@ -42,15 +42,12 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ CMOption<BYTE> bUseAuthIcon, bUseGrantIcon, bContactMenuItem, bIconsForRecentContacts;
+
int Load() override;
};
int onOptInitialise(WPARAM wParam, LPARAM lParam);
int onExtraImageApplying(WPARAM wParam, LPARAM lParam);
-extern HANDLE hExtraIcon;
-
-#include "options.h"
-
-
#endif //COMMHEADERS_H
diff --git a/plugins/AuthState/src/version.h b/plugins/AuthState/src/version.h index 4150d6ab48..9c10ef75fe 100644 --- a/plugins/AuthState/src/version.h +++ b/plugins/AuthState/src/version.h @@ -1,13 +1,13 @@ -#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 2
-#define __BUILD_NUM 1
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 2
#include <stdver.h>
-#define __PLUGIN_NAME "Authorization state"
-#define __FILENAME "AuthState.dll"
+#define __PLUGIN_NAME "Authorization state"
+#define __FILENAME "AuthState.dll"
#define __DESCRIPTION "If a contact didn't authorize you, this plugin puts an icon in front of the contact's name."
-#define __AUTHOR "Thief, idea by snwbrdr"
+#define __AUTHOR "Thief, idea by snwbrdr"
#define __AUTHORWEB "https://miranda-ng.org/p/AuthState/"
#define __COPYRIGHT "© 2006-2010 Alexander Turyak"
|