summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 18:23:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 18:23:34 +0300
commit2aa59179945482dee30935c991f9317dfbf31946 (patch)
tree49fc2b77d68b636c7842a1af462af59c94ff6da5 /plugins/StatusManager/src
parent4c4735a232c680e60a85d0f85e2cb392e012c6e0 (diff)
Tipper, StopSpamMod, StopSpam, StatusManager, StatusChange, StartupSilence, StartPosition, SplashScreen, SpellChecker, Spamotron => CMPlugin
Diffstat (limited to 'plugins/StatusManager/src')
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp2
-rw-r--r--plugins/StatusManager/src/KeepStatus/ks_options.cpp4
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_options.cpp8
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp2
-rw-r--r--plugins/StatusManager/src/confirmdialog.cpp4
-rw-r--r--plugins/StatusManager/src/main.cpp17
-rw-r--r--plugins/StatusManager/src/options.cpp4
-rw-r--r--plugins/StatusManager/src/stdafx.h9
8 files changed, 21 insertions, 29 deletions
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
index 9a3d2da69f..c2ad74929f 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
@@ -424,7 +424,7 @@ int AutoAwayOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 1000000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS;
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Auto away");
diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp
index 72b5bb2bd3..fe96ea81b2 100644
--- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp
+++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp
@@ -457,7 +457,7 @@ static INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
int KeepStatusOptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Keep status");
odp.flags = ODPF_BOLDGROUPS;
@@ -476,7 +476,7 @@ int KeepStatusOptionsInit(WPARAM wparam, LPARAM)
memset(&odp, 0, sizeof(odp));
odp.position = 150000000;
odp.szGroup.a = LPGEN("Popups");
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS);
odp.szTitle.a = LPGEN("Keep status");
odp.pfnDlgProc = PopupOptDlgProc;
diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
index 499116447e..1f56ccb687 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
@@ -140,7 +140,7 @@ class CCmdlDlg : public CDlgBase
public:
CCmdlDlg(int iProfileNo)
- : CDlgBase(hInst, IDD_CMDLOPTIONS),
+ : CDlgBase(g_plugin.getInst(), IDD_CMDLOPTIONS),
btnCopy(this, IDC_COPY),
btnLink(this, IDC_SHORTCUT),
ps(protoList)
@@ -453,7 +453,7 @@ class CAddProfileDlg : public CDlgBase
public:
CAddProfileDlg()
- : CDlgBase(hInst, IDD_ADDPROFILE),
+ : CDlgBase(g_plugin.getInst(), IDD_ADDPROFILE),
btnOk(this, IDOK),
edtProfile(this, IDC_PROFILENAME)
{
@@ -588,7 +588,7 @@ class CSSAdvancedOptDlg : public CDlgBase
public:
CSSAdvancedOptDlg() :
- CDlgBase(hInst, IDD_OPT_STATUSPROFILES),
+ CDlgBase(g_plugin.getInst(), IDD_OPT_STATUSPROFILES),
cmbProfile(this, IDC_PROFILE),
btnAdd(this, IDC_ADDPROFILE),
btnHelp(this, IDC_VARIABLESHELP),
@@ -860,7 +860,7 @@ public:
int StartupStatusOptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Startup status");
odp.flags = ODPF_BOLDGROUPS;
diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
index 63e914b60a..cdf8b93889 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
@@ -41,7 +41,7 @@ void RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM, LPARAM)
{
if (iconList[0].hIcolib == nullptr)
- Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "Toolbar/StartupStatus", iconList, _countof(iconList));
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
diff --git a/plugins/StatusManager/src/confirmdialog.cpp b/plugins/StatusManager/src/confirmdialog.cpp
index 63c13658e0..0491a77c94 100644
--- a/plugins/StatusManager/src/confirmdialog.cpp
+++ b/plugins/StatusManager/src/confirmdialog.cpp
@@ -280,7 +280,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
ListView_GetItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), &lvItem);
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETSTSMSGDIALOG), hwndDlg, StatusMessageDlgProc, lvItem.lParam);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETSTSMSGDIALOG), hwndDlg, StatusMessageDlgProc, lvItem.lParam);
}
break;
@@ -391,7 +391,7 @@ HWND ShowConfirmDialogEx(TProtoSettings *params, int _timeout)
timeOut = DEF_CLOSE_TIME;
if (GetWindow(win, 0) == nullptr) {
- win = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMDIALOG), nullptr, ConfirmDlgProc, 0);
+ win = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFIRMDIALOG), nullptr, ConfirmDlgProc, 0);
EnableWindow(win, TRUE);
}
diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp
index 5996a200c6..b44f9ba773 100644
--- a/plugins/StatusManager/src/main.cpp
+++ b/plugins/StatusManager/src/main.cpp
@@ -19,22 +19,11 @@
#include "stdafx.h"
-HINSTANCE hInst;
-int hLangpack = 0;
+int hLangpack;
+CMPlugin g_plugin;
CLIST_INTERFACE *pcli;
/////////////////////////////////////////////////////////////////////////////////////////
-// dll entry point
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
-{
- if (fdwReason == DLL_PROCESS_ATTACH)
- hInst = hinstDLL;
-
- return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// returns plugin's extended information
PLUGININFOEX pluginInfoEx = {
@@ -81,8 +70,6 @@ int OnModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_OPT_INITIALISE, OnCommonOptionsInit);
- ////////////////////////////////////////////////////////////////////////////////////////
-
for (auto &pa : Accounts())
if (IsSuitableProto(pa))
protoList.insert(new SMProto(pa));
diff --git a/plugins/StatusManager/src/options.cpp b/plugins/StatusManager/src/options.cpp
index 3678bee1fd..5f5d73aec3 100644
--- a/plugins/StatusManager/src/options.cpp
+++ b/plugins/StatusManager/src/options.cpp
@@ -14,7 +14,7 @@ class CSubPluginsOptionsDlg : public CPluginDlgBase
public:
CSubPluginsOptionsDlg()
- : CPluginDlgBase(hInst, IDD_OPT_SUBPLUGINS, MODULENAME),
+ : CPluginDlgBase(g_plugin.getInst(), IDD_OPT_SUBPLUGINS, MODULENAME),
m_enableKeepStatus(this, IDC_ENABLE_KEEPSTATUS),
m_enableStartupStatus(this, IDC_ENABLE_STARTUPSTATUS),
m_enableAdvancedAutoAway(this, IDC_ENABLE_ADVANCEDAUTOAWAY)
@@ -55,7 +55,7 @@ public:
int OnCommonOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szGroup.w = LPGENW("Status");
odp.szTitle.w = LPGENW("Status manager");
diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h
index 9463297a5d..4ef05fee00 100644
--- a/plugins/StatusManager/src/stdafx.h
+++ b/plugins/StatusManager/src/stdafx.h
@@ -9,7 +9,6 @@
#include <icmpapi.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_core.h>
@@ -29,12 +28,18 @@
#define MODULENAME "StatusManager"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#include "commonstatus.h"
#include "KeepStatus\keepstatus.h"
#include "StartupStatus\startupstatus.h"
#include "AdvancedAutoAway\advancedautoaway.h"
-extern HINSTANCE hInst;
extern bool g_bMirandaLoaded;
extern int AAALangPack, KSLangPack, SSLangPack;
extern CMOption<bool> g_AAAEnabled, g_KSEnabled, g_SSEnabled;