diff options
39 files changed, 535 insertions, 542 deletions
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 43035e9f59..dcaca0087b 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -87,8 +87,6 @@ BOOL _saveDlgItemScore(HWND hDialog, int controlID, char* option) return TRUE;
}
-extern HINSTANCE hInst;
-
INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing = 0, i, j;
@@ -554,7 +552,7 @@ extern INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wPara int OnOptInitialize(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = PLUGIN_NAME;
odp.flags = ODPF_BOLDGROUPS;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index f23b7861e9..a67fdd2b8c 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -1,9 +1,12 @@ #include "stdafx.h"
-HINSTANCE hInst;
HANDLE hOptInitialize, hModulesLoaded, hDBContactAdded, hDBEventAdded, hDBEventFilterAdd;
time_t last_queue_check = 0;
+
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -18,18 +21,18 @@ PLUGININFOEX pluginInfo = { {0x14331048, 0x5a73, 0x4fdb, {0xb9, 0x09, 0x2d, 0x7e, 0x18, 0x25, 0xa0, 0x12}}
};
-extern int OnOptInitialize(WPARAM wParam, LPARAM lParam);
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- hInst = hinstDLL;
- return TRUE;
+ return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern int OnOptInitialize(WPARAM wParam, LPARAM lParam);
+
int OnModulesLoaded(WPARAM, LPARAM)
{
hOptInitialize = HookEvent(ME_OPT_INITIALISE, OnOptInitialize);
-
return 0;
}
@@ -498,10 +501,7 @@ void RemoveNotOnListSettings() }
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load()
{
@@ -524,6 +524,8 @@ extern "C" __declspec(dllexport) int Load() return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" _declspec(dllexport) int Unload(void)
{
RemoveNotOnListSettings();
diff --git a/plugins/Spamotron/src/stdafx.h b/plugins/Spamotron/src/stdafx.h index 64f97f4c96..859d41a792 100644 --- a/plugins/Spamotron/src/stdafx.h +++ b/plugins/Spamotron/src/stdafx.h @@ -150,6 +150,13 @@ void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message); void bayes_approve_contact(MCONTACT hContact);
void dequeue_messages();
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PLUGIN_NAME)
+ {}
+};
+
#ifdef _DEBUG
extern sqlite3 *bayesdbg;
#define BAYESDBG_FILENAME "bayes.dbg"
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index eec0687100..060fa80846 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -55,9 +55,9 @@ BOOL ShowAutoReplaceDialog(HWND parent, BOOL modal, data->replace = replace;
if (modal)
- return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
+ return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
- HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
+ HWND hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
SetForegroundWindow(hwnd);
SetFocus(hwnd);
SetFocus(GetDlgItem(hwnd, IDC_NEW));
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 6f0d0e22e9..9f4f8e22b9 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -56,7 +56,7 @@ static OptPageControl autoReplaceControls[] = { int InitOptionsCallback(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = LPGEN("Spell Checker");
odp.pfnDlgProc = OptionsDlgProc;
@@ -65,7 +65,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM) Options_AddPage(wParam, &odp);
memset(&odp, 0, sizeof(odp));
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = LPGEN("Auto-replacements");
odp.pfnDlgProc = AutoreplaceDlgProc;
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 9770861c9c..276c2b650c 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -21,22 +21,8 @@ Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {36753AE3-840B-4797-94A5-FD9F5852B942} - { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 } } -}; - -HINSTANCE hInst; - int hLangpack = 0; +CMPlugin g_plugin; HANDLE hDictionariesFolder = nullptr; wchar_t *dictionariesFolder; @@ -55,19 +41,29 @@ BOOL loaded = FALSE; LIST<Dictionary> languages(1); -// Functions //////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) +PLUGININFOEX pluginInfo = { - hInst = hinstDLL; - return TRUE; -} + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {36753AE3-840B-4797-94A5-FD9F5852B942} + { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 }} +}; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } +// Functions //////////////////////////////////////////////////////////////////////////// + static int IconsChanged(WPARAM, LPARAM) { StatusIconData sid = {}; @@ -137,7 +133,7 @@ static int ModulesLoaded(WPARAM, LPARAM) HMODULE hFlagsDll = LoadLibraryEx(flag_file, nullptr, LOAD_LIBRARY_AS_DATAFILE); wchar_t path[MAX_PATH]; - GetModuleFileName(hInst, path, MAX_PATH); + GetModuleFileName(g_plugin.getInst(), path, MAX_PATH); SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE | SIDF_SORTED; @@ -234,7 +230,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); // icons - Icon_Register(hInst, LPGEN("Spell Checker"), iconList, _countof(iconList)); + Icon_Register(g_plugin.getInst(), LPGEN("Spell Checker"), iconList, _countof(iconList)); // hooks HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/plugins/SpellChecker/src/stdafx.h b/plugins/SpellChecker/src/stdafx.h index 83ab91a8b5..38317e99c4 100644 --- a/plugins/SpellChecker/src/stdafx.h +++ b/plugins/SpellChecker/src/stdafx.h @@ -34,7 +34,6 @@ Boston, MA 02111-1307, USA. #include <string>
using namespace std;
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_protosvc.h>
#include <m_langpack.h>
@@ -67,14 +66,21 @@ using namespace std; #include "ardialog.h"
#include "RichEdit.h"
-#define MODULE_NAME "SpellChecker"
+#define MODULE_NAME "SpellChecker"
#define FLAGS_DLL_FOLDER L"%miranda_path%\\Icons"
#define CUSTOM_DICTIONARIES_FOLDER L"%miranda_userdata%\\Dictionaries"
#define DICTIONARIES_FOLDER L"%miranda_path%\\Dictionaries"
// Global Variables
-extern HINSTANCE hInst;
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
+ {}
+};
+
extern BOOL uinfoex_enabled;
extern BOOL variables_enabled;
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index e6d9106950..ab415fb252 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "stdafx.h"
-HINSTANCE hInst = nullptr;
int hLangpack;
+CMPlugin g_plugin;
BOOL bstartup = true; // startup?
BOOL bserviceinvoked = false;
@@ -36,6 +36,8 @@ wchar_t szLogFile[MAX_PATH]; SPLASHOPTS options;
HWND hwndSplash;
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -49,12 +51,13 @@ PLUGININFOEX pluginInfo = { { 0xc64cc8e0, 0xcf03, 0x474a, { 0x8b, 0x11, 0x8b, 0xd4, 0x56, 0x5c, 0xcf, 0x04 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- hInst = hinstDLL;
- return TRUE;
+ return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void SplashMain()
{
if (bstartup) {
@@ -187,36 +190,20 @@ void SplashMain() int PlugDisableHook(WPARAM wParam, LPARAM lParam)
{
- #ifdef _DEBUG
- wchar_t buf[128];
- #endif
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
+
if (options.inheritGS) {
- if (!strcmp(cws->szModule, "Skin") && !strcmp(cws->szSetting, "UseSound")) {
+ if (!strcmp(cws->szModule, "Skin") && !strcmp(cws->szSetting, "UseSound"))
db_set_b(NULL, MODNAME, "PlaySound", cws->value.bVal);
- #ifdef _DEBUG
- cws->value.bVal ? _DebugPopup(NULL, L"Sounds enabled.", L"") : _DebugPopup(NULL, L"Sounds disabled.", L"");
- logMessage(L"Module", _A2T(cws->szModule));
- logMessage(L"Setting", _A2T(cws->szSetting));
- logMessage(L"Value", _itow(cws->value.bVal, buf, 10));
- #endif
- }
- if (!strcmp(cws->szModule, "PluginDisable") && !strcmp(cws->szSetting, _T2A(szDllName))) {
+
+ if (!strcmp(cws->szModule, "PluginDisable") && !strcmp(cws->szSetting, _T2A(szDllName)))
db_set_b(NULL, MODNAME, "Active", cws->value.bVal);
- #ifdef _DEBUG
- cws->value.bVal ? _DebugPopup(NULL, L"Disabled.", "") : _DebugPopup(NULL, L"Enabled.", L"");
- logMessage(L"PlugDisableHook", L"Triggered");
- logMessage(L"Module", _A2T(cws->szModule));
- logMessage(L"Setting", _A2T(cws->szSetting));
- logMessage(L"Value", _itow(cws->value.bVal, buf, 10));
- #endif
- }
}
return 0;
}
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
bmodulesloaded = true; // all modules are loaded now, let other parts know about this fact
@@ -242,11 +229,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- return &pluginInfo;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -259,13 +241,10 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
- UnregisterClass(SPLASH_CLASS, hInst);
-
- #ifdef _DEBUG
- logMessage(L"Unload", L"Job done");
- #endif
-
+ UnregisterClass(SPLASH_CLASS, g_plugin.getInst());
return 0;
}
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 4fe7173ad6..851c660c93 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -336,7 +336,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int OptInit(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Skins");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPLASH_OPT);
odp.szTitle.a = LPGEN("Splash Screen");
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp index c8f8c874ba..650be8de35 100644 --- a/plugins/SplashScreen/src/splash.cpp +++ b/plugins/SplashScreen/src/splash.cpp @@ -147,7 +147,7 @@ void __cdecl SplashThread(void *arg) wcl.style = 0;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
- wcl.hInstance = hInst;
+ wcl.hInstance = g_plugin.getInst();
wcl.hIcon = nullptr;
wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
@@ -181,7 +181,7 @@ void __cdecl SplashThread(void *arg) SplashBmp->getHeight(), // Height
HWND_DESKTOP, //Parent
nullptr, //menu handle
- hInst, //Instance
+ g_plugin.getInst(), //Instance
nullptr);
RECT rc; GetWindowRect(hwndSplash, &rc);
diff --git a/plugins/SplashScreen/src/stdafx.h b/plugins/SplashScreen/src/stdafx.h index 5f8b8c8660..f2630ef5e9 100644 --- a/plugins/SplashScreen/src/stdafx.h +++ b/plugins/SplashScreen/src/stdafx.h @@ -27,7 +27,6 @@ #include <time.h>
#include <dshow.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -53,6 +52,13 @@ #define MODNAME "SplashScreen"
#define WM_LOADED (WM_USER + 10)
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODNAME)
+ {}
+};
+
struct SPLASHOPTS
{
byte active;
@@ -73,7 +79,6 @@ extern wchar_t szSplashFile[MAX_PATH], szSoundFile[MAX_PATH], szPrefix[128]; extern wchar_t *szMirDir;
extern char szVersion[MAX_PATH];
extern BOOL bserviceinvoked, bmodulesloaded, png2dibavail;
-extern HINSTANCE hInst;
extern int OptInit(WPARAM wParam, LPARAM lParam);
extern BOOL ShowSplash(BOOL bpreview);
diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp index 36705787a5..80bbb1d457 100644 --- a/plugins/StartPosition/src/main.cpp +++ b/plugins/StartPosition/src/main.cpp @@ -23,8 +23,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HINSTANCE g_hInstance;
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -46,17 +48,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) /////////////////////////////////////////////////////////////////////////////////////////
-CMPlugin g_plugin;
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
g_plugin.Init();
g_plugin.positionClist();
-
return 0;
}
diff --git a/plugins/StartPosition/src/options.cpp b/plugins/StartPosition/src/options.cpp index f797c1d030..9ba3fe4262 100644 --- a/plugins/StartPosition/src/options.cpp +++ b/plugins/StartPosition/src/options.cpp @@ -16,7 +16,7 @@ StartPositionOptions::StartPositionOptions() : } COptionsDlg::COptionsDlg() : - CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE_NAME), + CPluginDlgBase(g_plugin.getInst(), IDD_OPTIONS, MODULE_NAME), chkPositionTop(this, IDC_CLTOPENABLE), edtPositionTop(this, IDC_CLTOP), chkPositionBottom(this, IDC_CLBOTTOMENABLE), diff --git a/plugins/StartPosition/src/startposition.cpp b/plugins/StartPosition/src/startposition.cpp index d6927d0ee1..64479d266c 100644 --- a/plugins/StartPosition/src/startposition.cpp +++ b/plugins/StartPosition/src/startposition.cpp @@ -48,7 +48,7 @@ void CMPlugin::positionClist() int CMPlugin::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = {}; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.szGroup.a = LPGEN("Contact list"); odp.szTitle.a = LPGEN("Start position"); odp.pDialog = new COptionsDlg(); diff --git a/plugins/StartPosition/src/startposition.h b/plugins/StartPosition/src/startposition.h index 35c3982cc8..455fb8981b 100644 --- a/plugins/StartPosition/src/startposition.h +++ b/plugins/StartPosition/src/startposition.h @@ -19,11 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -class CMPlugin : public PLUGIN<CMPlugin> +struct CMPlugin : public PLUGIN<CMPlugin> { - friend COptionsDlg; - -public: CMPlugin(); void Init(); diff --git a/plugins/StartPosition/src/stdafx.h b/plugins/StartPosition/src/stdafx.h index 0ad957d508..f654557d13 100644 --- a/plugins/StartPosition/src/stdafx.h +++ b/plugins/StartPosition/src/stdafx.h @@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
#include <windows.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_gui.h>
#include <m_langpack.h>
@@ -33,8 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "resource.h"
#include "version.h"
-extern HINSTANCE g_hInstance;
-
#define MODULE_NAME "StartPosition"
#define CLIST_MODULE_NAME "CList"
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 5bb39c8103..775968b2f2 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -24,17 +24,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst;
int hLangpack;
+CMPlugin g_plugin;
+
HGENMENU hSSMenuToggleOnOff;
HANDLE GetIconHandle(char *szIcon);
HANDLE hOptionsInitialize;
HANDLE hTTBarloaded = nullptr;
HANDLE Buttons = nullptr;
-int InitializeOptions(WPARAM wParam,LPARAM lParam);
int DisablePopup(WPARAM wParam, LPARAM lParam);
-int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-static int CreateTTButtons(WPARAM wParam, LPARAM lParam);
+
void RemoveTTButtons();
void EnablePopupModule();
BYTE Enabled;
@@ -62,7 +61,10 @@ char NonStatusAllowComp[MAX_PATH] = ""; static LIST<void> ttbButtons(1);
-PLUGININFOEX pluginInfo={
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -72,20 +74,16 @@ PLUGININFOEX pluginInfo={ __AUTHORWEB,
UNICODE_AWARE,
// {7B856B6A-D48F-4f54-B8D6-C8D86D02FFC2}
- {0x7b856b6a, 0xd48f, 0x4f54, {0xb8, 0xd6, 0xc8, 0xd8, 0x6d, 0x2, 0xff, 0xc2}}
+ { 0x7b856b6a, 0xd48f, 0x4f54, { 0xb8, 0xd6, 0xc8, 0xd8, 0x6d, 0x2, 0xff, 0xc2 }}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static void __cdecl AdvSt(void*)
{
Thread_SetName("StartupSilenc: AdvSt");
@@ -124,66 +122,26 @@ static void __cdecl AdvSt(void*) }
}
-INT_PTR StartupSilence()
-{
- InitSettings();
- HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- mir_forkthread((pThreadFunc)AdvSt);
- CreateServiceFunction(SS_SERVICE_NAME, StartupSilenceEnabled);
- CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection);
- IsMenu();
- HookEvent(ME_OPT_INITIALISE, InitializeOptions);
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
- StartupSilence();
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Unload(void)
-{
- if (hTTBarloaded != nullptr){
- UnhookEvent(hTTBarloaded);
- }
- return 0;
-}
-
-int ModulesLoaded(WPARAM, LPARAM)
-{
- HookEvent(ME_POPUP_FILTER, DisablePopup);
- hTTBarloaded = HookEvent(ME_TTB_MODULELOADED, CreateTTButtons);
- if (TTBButtons == 1 && hTTBarloaded != nullptr) {
- Icon_Register(hInst, "Toolbar/" MENU_NAME, iconttbList, _countof(iconttbList), MENU_NAME);
- RemoveTTButtons();
- CreateTTButtons(0,0);
- }
- return 0;
-}
-
int DisablePopup(WPARAM wParam, LPARAM)
{
if (DefEnabled == 1 && DefPopup == 0) //All popups are blocked
return 1;
- if ( (NonStatusAllow == 1) // while startup allow popups for unread mail notification from MRA, keepstatus ... other services?
- || ((DefPopup == 1 && DefEnabled == 1) && timer !=2) ) //also filtered only: We do not run next lines every time
- //if "Filtered only..." is unchecked --->
- {
- MCONTACT hContact = wParam;
- if (hContact != NULL)
- {
- char* cp = GetContactProto(hContact);
- if ( !mir_strcmp(cp, "Weather") || !mir_strcmp(cp, "mRadio") )
- return 0;
- return 1;
- }
- else return 0;//or allow popups for unread mail notification from MRA, keepstatus ... other services?
+ if ((NonStatusAllow == 1) // while startup allow popups for unread mail notification from MRA, keepstatus ... other services?
+ || ((DefPopup == 1 && DefEnabled == 1) && timer != 2)) //also filtered only: We do not run next lines every time
+ //if "Filtered only..." is unchecked --->
+ {
+ MCONTACT hContact = wParam;
+ if (hContact != NULL) {
+ char* cp = GetContactProto(hContact);
+ if (!mir_strcmp(cp, "Weather") || !mir_strcmp(cp, "mRadio"))
+ return 0;
+ return 1;
}
+ else return 0;//or allow popups for unread mail notification from MRA, keepstatus ... other services?
+ }
else if (timer == 2)
- return 1; //block all popups at startup
+ return 1; //block all popups at startup
return 0; //---> just allow all popups with this return
}
@@ -194,7 +152,7 @@ void EnablePopupModule() void InitSettings()
{
- if(gethostname(hostname, _countof(hostname)) == 0){
+ if (gethostname(hostname, _countof(hostname)) == 0) {
mir_snprintf(EnabledComp, "%s_Enabled", hostname);
mir_snprintf(DelayComp, "%s_Delay", hostname);
mir_snprintf(PopUpComp, "%s_PopUp", hostname);
@@ -212,6 +170,7 @@ void InitSettings() //or load host settings
else LoadSettings();
}
+
void DefSettings()
{
db_set_dw(NULL, MODULE_NAME, DelayComp, 20);
@@ -226,6 +185,7 @@ void DefSettings() db_set_b(NULL, MODULE_NAME, NonStatusAllowComp, 1);
LoadSettings();
}
+
void LoadSettings()
{
Enabled = db_get_b(NULL, MODULE_NAME, EnabledComp, 0);
@@ -250,15 +210,9 @@ void LoadSettings() db_set_dw(NULL, MODULE_NAME, PopUpTimeComp, PopUpTime);
}
-void IsMenu()
-{
- if (MenuItem == 1) {
- Icon_Register(hInst, MENU_NAME, iconList, _countof(iconList), MENU_NAME);
- InitMenu();
- }
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR StartupSilenceEnabled(WPARAM, LPARAM)
+static INT_PTR StartupSilenceEnabled(WPARAM, LPARAM)
{
db_set_b(NULL, MODULE_NAME, EnabledComp, !Enabled);
LoadSettings();
@@ -266,7 +220,7 @@ INT_PTR StartupSilenceEnabled(WPARAM, LPARAM) UpdateMenu();
if (PopUp == 1) {
wchar_t * lptzText = Enabled == 1 ? S_MODE_CHANGEDON : S_MODE_CHANGEDOFF;
- POPUPDATAT ppd = {0};
+ POPUPDATAT ppd = { 0 };
ppd.lchIcon = IcoLib_GetIconByHandle((Enabled == 1) ? GetIconHandle(ENABLE_SILENCE) : GetIconHandle(DISABLE_SILENCE));
ppd.lchContact = NULL;
ppd.iSeconds = PopUpTime;
@@ -278,12 +232,14 @@ INT_PTR StartupSilenceEnabled(WPARAM, LPARAM) return 0;
}
-INT_PTR SilenceConnection(WPARAM wParam, LPARAM)
+static INT_PTR SilenceConnection(WPARAM wParam, LPARAM)
{
timer = (BYTE)wParam;
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR InitMenu()
{
CMenuItem mi;
@@ -310,7 +266,7 @@ void UpdateMenu() void UpdateTTB()
{
if (hTTBarloaded != nullptr && TTBButtons == 1)
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)Buttons, (Enabled == 1 ? 0 : TTBST_PUSHED));
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)Buttons, (Enabled == 1 ? 0 : TTBST_PUSHED));
}
static int CreateTTButtons(WPARAM, LPARAM)
@@ -349,7 +305,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
LoadSettings();
- SetDlgItemText(hwndDlg, IDC_HST, mir_a2u(hostname));
+ SetDlgItemText(hwndDlg, IDC_HST, mir_a2u(hostname));
CheckDlgButton(hwndDlg, IDC_DELAY, (Enabled == 1) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SSTIME), 0);
SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETRANGE32, 10, 300);
@@ -377,17 +333,17 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_SSTIME:
DWORD min;
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return FALSE;
- min = GetDlgItemInt(hwndDlg, IDC_SSTIME, nullptr, FALSE);
+ min = GetDlgItemInt(hwndDlg, IDC_SSTIME, nullptr, FALSE);
if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SSTIME)))
- SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETPOS, 0, MAKELONG((short)1, 0));
delay = (DWORD)db_set_dw(NULL, MODULE_NAME, DelayComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_GETPOS, 0, 0)));
break;
case IDC_SSPOPUPTIME:
if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return FALSE;
- min = GetDlgItemInt(hwndDlg, IDC_SSPOPUPTIME, nullptr, FALSE);
+ min = GetDlgItemInt(hwndDlg, IDC_SSPOPUPTIME, nullptr, FALSE);
if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SSPOPUPTIME)))
- SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_SETPOS, 0, MAKELONG((short)1, 0));
PopUpTime = (DWORD)db_set_dw(NULL, MODULE_NAME, PopUpTimeComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_GETPOS, 0, 0)));
break;
@@ -459,7 +415,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP int InitializeOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SSOPT);
odp.szGroup.a = LPGEN("Events");//FIXME: move to...Group?
odp.szTitle.a = MENU_NAME;
@@ -468,3 +424,48 @@ int InitializeOptions(WPARAM wParam, LPARAM) Options_AddPage(wParam, &odp);
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int ModulesLoaded(WPARAM, LPARAM)
+{
+ HookEvent(ME_POPUP_FILTER, DisablePopup);
+ hTTBarloaded = HookEvent(ME_TTB_MODULELOADED, CreateTTButtons);
+ if (TTBButtons == 1 && hTTBarloaded != nullptr) {
+ Icon_Register(g_plugin.getInst(), "Toolbar/" MENU_NAME, iconttbList, _countof(iconttbList), MENU_NAME);
+ RemoveTTButtons();
+ CreateTTButtons(0, 0);
+ }
+ return 0;
+}
+
+extern "C" __declspec(dllexport) int Load(void)
+{
+ mir_getLP(&pluginInfo);
+
+ InitSettings();
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, InitializeOptions);
+
+ mir_forkthread((pThreadFunc)AdvSt);
+
+ CreateServiceFunction(SS_SERVICE_NAME, StartupSilenceEnabled);
+ CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection);
+
+ if (MenuItem == 1) {
+ Icon_Register(g_plugin.getInst(), MENU_NAME, iconList, _countof(iconList), MENU_NAME);
+ InitMenu();
+ }
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) int Unload(void)
+{
+ if (hTTBarloaded != nullptr)
+ UnhookEvent(hTTBarloaded);
+
+ return 0;
+}
diff --git a/plugins/StartupSilence/src/stdafx.h b/plugins/StartupSilence/src/stdafx.h index 50f6bf36f4..285f6c400f 100644 --- a/plugins/StartupSilence/src/stdafx.h +++ b/plugins/StartupSilence/src/stdafx.h @@ -4,7 +4,6 @@ #include <CommCtrl.h>
#include <WinSock.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_core.h>
#include <m_clist.h>
@@ -27,15 +26,18 @@ static INT_PTR InitMenu(); void InitSettings();
void LoadSettings();
void DefSettings();
-void IsMenu();
void UpdateMenu();
void UpdateTTB();
-INT_PTR StartupSilenceEnabled(WPARAM wParam, LPARAM lParam);
-INT_PTR SilenceConnection(WPARAM wParam, LPARAM lParam);
-
#define MODULE_NAME "StartupSilence"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
+ {}
+};
+
#define SS_SERVICE_NAME "StartupSilence/ToggleEnabled"
//StartupSilence/SilenceConnection
diff --git a/plugins/StatusChange/src/main.cpp b/plugins/StatusChange/src/main.cpp index 350872570b..b91526137b 100644 --- a/plugins/StatusChange/src/main.cpp +++ b/plugins/StatusChange/src/main.cpp @@ -1,13 +1,17 @@ #include "stdafx.h"
-HINSTANCE hInst;
TOPTIONS Options;
HICON hIconMsg;
HICON hIconUrl;
HICON hIconFile;
+
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo={
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -17,9 +21,16 @@ PLUGININFOEX pluginInfo={ __AUTHORWEB,
UNICODE_AWARE,
// {1ACB2ED1-C1ED-43EE-89BD-086686F6EBB5}
- {0x1acb2ed1, 0xc1ed, 0x43ee, {0x89, 0xbd, 0x8, 0x66, 0x86, 0xf6, 0xeb, 0xb5}}
+ { 0x1acb2ed1, 0xc1ed, 0x43ee, { 0x89, 0xbd, 0x8, 0x66, 0x86, 0xf6, 0xeb, 0xb5 }}
};
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void LoadOptions()
{
memset(&Options, 0, sizeof(Options));
@@ -50,43 +61,43 @@ static int StatusChangeGetMessage(WPARAM, LPARAM hDbEvent) db_event_get(hDbEvent, &dbe);
int status = Proto_GetStatus(dbe.szModule);
- if(!status)
+ if (!status)
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
- if(status == Options.ChangeTo)
+ if (status == Options.ChangeTo)
return 0;
switch (status) {
- case ID_STATUS_OFFLINE : change_status = Options.IfOffline; break;
- case ID_STATUS_ONLINE : change_status = Options.IfOnline; break;
- case ID_STATUS_AWAY : change_status = Options.IfAway; break;
- case ID_STATUS_NA : change_status = Options.IfNA; break;
- case ID_STATUS_OCCUPIED : change_status = Options.IfOccupied; break;
- case ID_STATUS_DND : change_status = Options.IfDND; break;
- case ID_STATUS_FREECHAT : change_status = Options.IfFreeforchat; break;
- case ID_STATUS_INVISIBLE : change_status = Options.IfInvisible; break;
- case ID_STATUS_ONTHEPHONE : change_status = Options.IfOnthephone; break;
- case ID_STATUS_OUTTOLUNCH : change_status = Options.IfOuttolunch; break;
- default : change_status = FALSE; break;
+ case ID_STATUS_OFFLINE: change_status = Options.IfOffline; break;
+ case ID_STATUS_ONLINE: change_status = Options.IfOnline; break;
+ case ID_STATUS_AWAY: change_status = Options.IfAway; break;
+ case ID_STATUS_NA: change_status = Options.IfNA; break;
+ case ID_STATUS_OCCUPIED: change_status = Options.IfOccupied; break;
+ case ID_STATUS_DND: change_status = Options.IfDND; break;
+ case ID_STATUS_FREECHAT: change_status = Options.IfFreeforchat; break;
+ case ID_STATUS_INVISIBLE: change_status = Options.IfInvisible; break;
+ case ID_STATUS_ONTHEPHONE: change_status = Options.IfOnthephone; break;
+ case ID_STATUS_OUTTOLUNCH: change_status = Options.IfOuttolunch; break;
+ default: change_status = FALSE; break;
}
if (!change_status)
return 0;
-
+
switch (dbe.eventType) {
- case EVENTTYPE_MESSAGE :
- read = Options.MessageRead;
- send = Options.MessageSend;
- break;
- case EVENTTYPE_URL :
- read = Options.UrlRead;
- send = Options.UrlSend;
- break;
- case EVENTTYPE_FILE :
- read = Options.FileRead;
- send = Options.FileSend;
- break;
- break;
+ case EVENTTYPE_MESSAGE:
+ read = Options.MessageRead;
+ send = Options.MessageSend;
+ break;
+ case EVENTTYPE_URL:
+ read = Options.UrlRead;
+ send = Options.UrlSend;
+ break;
+ case EVENTTYPE_FILE:
+ read = Options.FileRead;
+ send = Options.FileSend;
+ break;
+ break;
}
// If is a message sent...
@@ -104,206 +115,205 @@ static int StatusChangeGetMessage(WPARAM, LPARAM hDbEvent) CallProtoService(dbe.szModule, PS_SETSTATUS, (LPARAM)Options.ChangeTo, 0);
}
}
-
+
return 0;
}
static INT_PTR CALLBACK DlgProcStatusChangeOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- hIconMsg = (HICON)CopyImage(Skin_LoadIcon(SKINICON_EVENT_MESSAGE), IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE);
- SendDlgItemMessage(hwndDlg, IDC_MSGICON, STM_SETICON, (WPARAM)hIconMsg, 0);
- hIconUrl = (HICON)CopyImage(Skin_LoadIcon(SKINICON_EVENT_URL), IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE);
- SendDlgItemMessage(hwndDlg, IDC_URLICON, STM_SETICON, (WPARAM)hIconUrl, 0);
- hIconFile = (HICON)CopyImage(Skin_LoadIcon(SKINICON_EVENT_FILE), IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE);
- SendDlgItemMessage(hwndDlg, IDC_FILEICON, STM_SETICON, (WPARAM)hIconFile, 0);
-
- CheckDlgButton(hwndDlg, IDC_CHK_MESSAGEREAD, Options.MessageRead ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_MESSAGESEND, Options.MessageSend ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_URLREAD, Options.UrlRead ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_URLSEND, Options.UrlSend ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_FILEREAD, Options.FileRead ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_FILESEND, Options.FileSend ? BST_CHECKED : BST_UNCHECKED);
-
- switch(Options.ChangeTo) {
- case ID_STATUS_OFFLINE : CheckDlgButton(hwndDlg, IDC_RAD_OFFLINE, BST_CHECKED); break;
- case ID_STATUS_ONLINE : CheckDlgButton(hwndDlg, IDC_RAD_ONLINE, BST_CHECKED); break;
- case ID_STATUS_AWAY : CheckDlgButton(hwndDlg, IDC_RAD_AWAY, BST_CHECKED); break;
- case ID_STATUS_DND : CheckDlgButton(hwndDlg, IDC_RAD_DND, BST_CHECKED); break;
- case ID_STATUS_NA : CheckDlgButton(hwndDlg, IDC_RAD_NA, BST_CHECKED); break;
- case ID_STATUS_OCCUPIED : CheckDlgButton(hwndDlg, IDC_RAD_OCCUPIED, BST_CHECKED); break;
- case ID_STATUS_FREECHAT : CheckDlgButton(hwndDlg, IDC_RAD_FREECHAT, BST_CHECKED); break;
- case ID_STATUS_INVISIBLE : CheckDlgButton(hwndDlg, IDC_RAD_INVISIBLE, BST_CHECKED); break;
- case ID_STATUS_ONTHEPHONE : CheckDlgButton(hwndDlg, IDC_RAD_ONTHEPHONE, BST_CHECKED); break;
- case ID_STATUS_OUTTOLUNCH : CheckDlgButton(hwndDlg, IDC_RAD_OUTTOLUNCH, BST_CHECKED); break;
- break;
- }
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_CHK_OFFLINE, Options.IfOffline ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_ONLINE, Options.IfOnline ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_AWAY, Options.IfAway ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_DND, Options.IfDND ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_NA, Options.IfNA ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_OCCUPIED, Options.IfOccupied ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_FREECHAT, Options.IfFreeforchat ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_INVISIBLE, Options.IfInvisible ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_ONTHEPHONE, Options.IfOnthephone ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_OUTTOLUNCH, Options.IfOuttolunch ? BST_CHECKED : BST_UNCHECKED);
- return TRUE;
-
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_CHK_MESSAGEREAD:
- Options.MessageRead = !Options.MessageRead;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_MESSAGESEND:
- Options.MessageSend = !Options.MessageSend;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_URLREAD:
- Options.UrlRead = !Options.UrlRead;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_URLSEND:
- Options.UrlSend = !Options.UrlSend;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_FILEREAD:
- Options.FileRead = !Options.FileRead;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_FILESEND:
- Options.FileSend = !Options.FileSend;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_RAD_OFFLINE:
- Options.ChangeTo = ID_STATUS_OFFLINE;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_ONLINE:
- Options.ChangeTo = ID_STATUS_ONLINE;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_AWAY:
- Options.ChangeTo = ID_STATUS_AWAY;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_DND:
- Options.ChangeTo = ID_STATUS_DND;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_NA:
- Options.ChangeTo = ID_STATUS_NA;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_OCCUPIED:
- Options.ChangeTo = ID_STATUS_OCCUPIED;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_FREECHAT:
- Options.ChangeTo = ID_STATUS_FREECHAT;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_INVISIBLE:
- Options.ChangeTo = ID_STATUS_INVISIBLE;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_ONTHEPHONE:
- Options.ChangeTo = ID_STATUS_ONTHEPHONE;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_RAD_OUTTOLUNCH:
- Options.ChangeTo = ID_STATUS_OUTTOLUNCH;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_CHK_OFFLINE:
- Options.IfOffline = !Options.IfOffline;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_ONLINE:
- Options.IfOnline = !Options.IfOnline;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_AWAY:
- Options.IfAway = !Options.IfAway;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_DND:
- Options.IfDND = !Options.IfDND;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_NA:
- Options.IfNA = !Options.IfNA;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_OCCUPIED:
- Options.IfOccupied = !Options.IfOccupied;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_FREECHAT:
- Options.IfFreeforchat = !Options.IfFreeforchat;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_INVISIBLE:
- Options.IfInvisible = !Options.IfInvisible;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_ONTHEPHONE:
- Options.IfOnthephone = !Options.IfOnthephone;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_CHK_OUTTOLUNCH:
- Options.IfOuttolunch = !Options.IfOuttolunch;
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
+ hIconMsg = (HICON)CopyImage(Skin_LoadIcon(SKINICON_EVENT_MESSAGE), IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE);
+ SendDlgItemMessage(hwndDlg, IDC_MSGICON, STM_SETICON, (WPARAM)hIconMsg, 0);
+ hIconUrl = (HICON)CopyImage(Skin_LoadIcon(SKINICON_EVENT_URL), IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE);
+ SendDlgItemMessage(hwndDlg, IDC_URLICON, STM_SETICON, (WPARAM)hIconUrl, 0);
+ hIconFile = (HICON)CopyImage(Skin_LoadIcon(SKINICON_EVENT_FILE), IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE);
+ SendDlgItemMessage(hwndDlg, IDC_FILEICON, STM_SETICON, (WPARAM)hIconFile, 0);
+
+ CheckDlgButton(hwndDlg, IDC_CHK_MESSAGEREAD, Options.MessageRead ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_MESSAGESEND, Options.MessageSend ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_URLREAD, Options.UrlRead ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_URLSEND, Options.UrlSend ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_FILEREAD, Options.FileRead ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_FILESEND, Options.FileSend ? BST_CHECKED : BST_UNCHECKED);
+
+ switch (Options.ChangeTo) {
+ case ID_STATUS_OFFLINE: CheckDlgButton(hwndDlg, IDC_RAD_OFFLINE, BST_CHECKED); break;
+ case ID_STATUS_ONLINE: CheckDlgButton(hwndDlg, IDC_RAD_ONLINE, BST_CHECKED); break;
+ case ID_STATUS_AWAY: CheckDlgButton(hwndDlg, IDC_RAD_AWAY, BST_CHECKED); break;
+ case ID_STATUS_DND: CheckDlgButton(hwndDlg, IDC_RAD_DND, BST_CHECKED); break;
+ case ID_STATUS_NA: CheckDlgButton(hwndDlg, IDC_RAD_NA, BST_CHECKED); break;
+ case ID_STATUS_OCCUPIED: CheckDlgButton(hwndDlg, IDC_RAD_OCCUPIED, BST_CHECKED); break;
+ case ID_STATUS_FREECHAT: CheckDlgButton(hwndDlg, IDC_RAD_FREECHAT, BST_CHECKED); break;
+ case ID_STATUS_INVISIBLE: CheckDlgButton(hwndDlg, IDC_RAD_INVISIBLE, BST_CHECKED); break;
+ case ID_STATUS_ONTHEPHONE: CheckDlgButton(hwndDlg, IDC_RAD_ONTHEPHONE, BST_CHECKED); break;
+ case ID_STATUS_OUTTOLUNCH: CheckDlgButton(hwndDlg, IDC_RAD_OUTTOLUNCH, BST_CHECKED); break;
break;
+ }
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_RESET:
- LoadOptions();
- return TRUE;
- case PSN_APPLY:
- db_set_b(NULL, PLUGINNAME, "MessageRead", (BYTE)Options.MessageRead);
- db_set_b(NULL, PLUGINNAME, "MessageSend", (BYTE)Options.MessageSend);
- db_set_b(NULL, PLUGINNAME, "UrlRead", (BYTE)Options.UrlRead);
- db_set_b(NULL, PLUGINNAME, "UrlSend", (BYTE)Options.UrlSend);
- db_set_b(NULL, PLUGINNAME, "FileRead", (BYTE)Options.FileRead);
- db_set_b(NULL, PLUGINNAME, "FileSend", (BYTE)Options.FileSend);
- db_set_dw(NULL, PLUGINNAME, "ChangeTo", (DWORD)Options.ChangeTo);
- db_set_b(NULL, PLUGINNAME, "IfOffline", (BYTE)Options.IfOffline);
- db_set_b(NULL, PLUGINNAME, "IfOnline", (BYTE)Options.IfOnline);
- db_set_b(NULL, PLUGINNAME, "IfAway", (BYTE)Options.IfAway);
- db_set_b(NULL, PLUGINNAME, "IfNA", (BYTE)Options.IfNA);
- db_set_b(NULL, PLUGINNAME, "IfDND", (BYTE)Options.IfDND);
- db_set_b(NULL, PLUGINNAME, "IfOccupied", (BYTE)Options.IfOccupied);
- db_set_b(NULL, PLUGINNAME, "IfFreeforchat", (BYTE)Options.IfFreeforchat);
- db_set_b(NULL, PLUGINNAME, "IfInvisible", (BYTE)Options.IfInvisible);
- db_set_b(NULL, PLUGINNAME, "IfOnthephone", (BYTE)Options.IfOnthephone);
- db_set_b(NULL, PLUGINNAME, "IfOuttolunch", (BYTE)Options.IfOuttolunch);
- return TRUE;
- break;
- }
- break;
- break;
- }
+ CheckDlgButton(hwndDlg, IDC_CHK_OFFLINE, Options.IfOffline ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_ONLINE, Options.IfOnline ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_AWAY, Options.IfAway ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_DND, Options.IfDND ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_NA, Options.IfNA ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_OCCUPIED, Options.IfOccupied ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_FREECHAT, Options.IfFreeforchat ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_INVISIBLE, Options.IfInvisible ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_ONTHEPHONE, Options.IfOnthephone ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_OUTTOLUNCH, Options.IfOuttolunch ? BST_CHECKED : BST_UNCHECKED);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_MESSAGEREAD:
+ Options.MessageRead = !Options.MessageRead;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_MESSAGESEND:
+ Options.MessageSend = !Options.MessageSend;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_URLREAD:
+ Options.UrlRead = !Options.UrlRead;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_URLSEND:
+ Options.UrlSend = !Options.UrlSend;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_FILEREAD:
+ Options.FileRead = !Options.FileRead;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_FILESEND:
+ Options.FileSend = !Options.FileSend;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_RAD_OFFLINE:
+ Options.ChangeTo = ID_STATUS_OFFLINE;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_ONLINE:
+ Options.ChangeTo = ID_STATUS_ONLINE;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_AWAY:
+ Options.ChangeTo = ID_STATUS_AWAY;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_DND:
+ Options.ChangeTo = ID_STATUS_DND;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_NA:
+ Options.ChangeTo = ID_STATUS_NA;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_OCCUPIED:
+ Options.ChangeTo = ID_STATUS_OCCUPIED;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_FREECHAT:
+ Options.ChangeTo = ID_STATUS_FREECHAT;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_INVISIBLE:
+ Options.ChangeTo = ID_STATUS_INVISIBLE;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_ONTHEPHONE:
+ Options.ChangeTo = ID_STATUS_ONTHEPHONE;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_RAD_OUTTOLUNCH:
+ Options.ChangeTo = ID_STATUS_OUTTOLUNCH;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case WM_DESTROY:
- DestroyIcon(hIconMsg);
- DestroyIcon(hIconUrl);
- DestroyIcon(hIconFile);
+ case IDC_CHK_OFFLINE:
+ Options.IfOffline = !Options.IfOffline;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_ONLINE:
+ Options.IfOnline = !Options.IfOnline;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_AWAY:
+ Options.IfAway = !Options.IfAway;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- }
+ case IDC_CHK_DND:
+ Options.IfDND = !Options.IfDND;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_NA:
+ Options.IfNA = !Options.IfNA;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_OCCUPIED:
+ Options.IfOccupied = !Options.IfOccupied;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_FREECHAT:
+ Options.IfFreeforchat = !Options.IfFreeforchat;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_INVISIBLE:
+ Options.IfInvisible = !Options.IfInvisible;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_ONTHEPHONE:
+ Options.IfOnthephone = !Options.IfOnthephone;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_CHK_OUTTOLUNCH:
+ Options.IfOuttolunch = !Options.IfOuttolunch;
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadOptions();
+ return TRUE;
+
+ case PSN_APPLY:
+ db_set_b(NULL, PLUGINNAME, "MessageRead", (BYTE)Options.MessageRead);
+ db_set_b(NULL, PLUGINNAME, "MessageSend", (BYTE)Options.MessageSend);
+ db_set_b(NULL, PLUGINNAME, "UrlRead", (BYTE)Options.UrlRead);
+ db_set_b(NULL, PLUGINNAME, "UrlSend", (BYTE)Options.UrlSend);
+ db_set_b(NULL, PLUGINNAME, "FileRead", (BYTE)Options.FileRead);
+ db_set_b(NULL, PLUGINNAME, "FileSend", (BYTE)Options.FileSend);
+ db_set_dw(NULL, PLUGINNAME, "ChangeTo", (DWORD)Options.ChangeTo);
+ db_set_b(NULL, PLUGINNAME, "IfOffline", (BYTE)Options.IfOffline);
+ db_set_b(NULL, PLUGINNAME, "IfOnline", (BYTE)Options.IfOnline);
+ db_set_b(NULL, PLUGINNAME, "IfAway", (BYTE)Options.IfAway);
+ db_set_b(NULL, PLUGINNAME, "IfNA", (BYTE)Options.IfNA);
+ db_set_b(NULL, PLUGINNAME, "IfDND", (BYTE)Options.IfDND);
+ db_set_b(NULL, PLUGINNAME, "IfOccupied", (BYTE)Options.IfOccupied);
+ db_set_b(NULL, PLUGINNAME, "IfFreeforchat", (BYTE)Options.IfFreeforchat);
+ db_set_b(NULL, PLUGINNAME, "IfInvisible", (BYTE)Options.IfInvisible);
+ db_set_b(NULL, PLUGINNAME, "IfOnthephone", (BYTE)Options.IfOnthephone);
+ db_set_b(NULL, PLUGINNAME, "IfOuttolunch", (BYTE)Options.IfOuttolunch);
+ return TRUE;
+ }
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+ DestroyIcon(hIconMsg);
+ DestroyIcon(hIconUrl);
+ DestroyIcon(hIconFile);
+ break;
+ }
return FALSE;
}
@@ -311,7 +321,7 @@ static INT_PTR CALLBACK DlgProcStatusChangeOpts(HWND hwndDlg, UINT msg, WPARAM w int StatusChangeOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szTitle.w = LPGENW("Status Change");
odp.szGroup.w = LPGENW("Status");
@@ -321,16 +331,7 @@ int StatusChangeOptInit(WPARAM wParam, LPARAM) return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load(void)
{
@@ -340,10 +341,11 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_DB_EVENT_ADDED, StatusChangeGetMessage);
LoadOptions();
-
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
diff --git a/plugins/StatusChange/src/stdafx.h b/plugins/StatusChange/src/stdafx.h index 3ec8723cd2..a2335bb170 100644 --- a/plugins/StatusChange/src/stdafx.h +++ b/plugins/StatusChange/src/stdafx.h @@ -5,7 +5,6 @@ #include <windows.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_clist.h>
@@ -19,7 +18,14 @@ #define PLUGINNAME "StatusChange"
-typedef struct
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PLUGINNAME)
+ {}
+};
+
+struct TOPTIONS
{
BOOL MessageRead;
BOOL MessageSend;
@@ -40,4 +46,4 @@ typedef struct BOOL IfInvisible;
BOOL IfOnthephone;
BOOL IfOuttolunch;
-} TOPTIONS;
+};
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; diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 93f2ce40f1..58b8a765b6 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -17,7 +17,10 @@ #include "stdafx.h"
-HINSTANCE hInst;
+CMPlugin g_plugin;
+int hLangpack = 0;
+
+HANDLE hEventFilter = nullptr, hOptInitialise = nullptr, hSettingChanged = nullptr;
BOOL gbDosServiceExist = 0;
BOOL gbVarsServiceExist = 0;
@@ -43,7 +46,7 @@ BOOL gbAutoAddToServerList=0; BOOL gbAutoReqAuth=1;
BOOL gbMathExpression = 0;
-HANDLE hStopSpamLogDirH=nullptr;
+HANDLE hStopSpamLogDirH = nullptr;
wstring gbSpammersGroup = L"Spammers";
wstring gbAutoAuthGroup = L"NotSpammers";
@@ -76,6 +79,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern wstring DBGetContactSettingStringPAN(MCONTACT hContact, char const * szModule, char const * szSetting, wstring errorValue);
void InitVars()
@@ -107,15 +112,13 @@ void InitVars() gbLogToFile = db_get_b(NULL, pluginName, "LogSpamToFile", 0);
gbHistoryLog = db_get_b(NULL, pluginName, "HistoryLog", 0);
gbMathExpression = db_get_b(NULL, pluginName, "MathExpression", 0);
-
}
static int OnSystemModulesLoaded(WPARAM, LPARAM)
{
-/* if (ServiceExists(MS_DOS_SERVICE))
- gbDosServiceExist = TRUE; */
if (ServiceExists(MS_VARS_FORMATSTRING))
gbVarsServiceExist = TRUE;
+
InitVars();
if(gbDelAllTempory || gbDelExcluded)
mir_forkthread(&CleanThread);
@@ -125,16 +128,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) return 0;
}
-HANDLE hEventFilter = nullptr, hOptInitialise = nullptr, hSettingChanged = nullptr;
-
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-int hLangpack = 0;
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" int __declspec(dllexport) Load()
{
@@ -158,6 +152,8 @@ extern "C" int __declspec(dllexport) Load() return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index 7d7e6f5770..be0a7421e6 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -26,7 +26,7 @@ const wchar_t *defAuthReply = LPGENW("StopSpam: send a message and reply to an a class COptMainDlg : public CDlgBase
{
public:
- COptMainDlg() : CDlgBase(hInst, IDD_MAIN),
+ COptMainDlg() : CDlgBase(g_plugin.getInst(), IDD_MAIN),
chk_INFTALKPROT(this, ID_INFTALKPROT), chk_ADDPERMANENT(this, ID_ADDPERMANENT), chk_HANDLEAUTHREQ(this, ID_HANDLEAUTHREQ),
chk_HIDECONTACTS(this, ID_HIDECONTACTS), chk_IGNORESPAMMERS(this, ID_IGNORESPAMMERS), chk_LOGSPAMTOFILE(this, ID_LOGSPAMTOFILE),
ctrl_DESCRIPTION(this, ID_DESCRIPTION), edit_MAXQUESTCOUNT(this, ID_MAXQUESTCOUNT)
@@ -64,7 +64,7 @@ private: class COptMessagesDlg : public CDlgBase
{
public:
- COptMessagesDlg() : CDlgBase(hInst, IDD_MESSAGES),
+ COptMessagesDlg() : CDlgBase(g_plugin.getInst(), IDD_MESSAGES),
edit_QUESTION(this, ID_QUESTION), edit_ANSWER(this, ID_ANSWER), edit_CONGRATULATION(this, ID_CONGRATULATION), edit_AUTHREPL(this, ID_AUTHREPL),
btn_RESTOREDEFAULTS(this, ID_RESTOREDEFAULTS), btn_VARS(this, IDC_VARS)
{
@@ -114,7 +114,7 @@ private: class COptProtoDlg : public CDlgBase
{
public:
- COptProtoDlg() : CDlgBase(hInst, IDD_PROTO),
+ COptProtoDlg() : CDlgBase(g_plugin.getInst(), IDD_PROTO),
list_USEDPROTO(this, ID_USEDPROTO), list_ALLPROTO(this, ID_ALLPROTO),
btn_ADD(this, ID_ADD), btn_REMOVE(this, ID_REMOVE), btn_ADDALL(this, ID_ADDALL), btn_REMOVEALL(this, ID_REMOVEALL)
{
@@ -184,7 +184,7 @@ private: class COptAdvancedDlg : public CDlgBase
{
public:
- COptAdvancedDlg() : CDlgBase(hInst, IDD_ADVANCED),
+ COptAdvancedDlg() : CDlgBase(g_plugin.getInst(), IDD_ADVANCED),
chk_INVIS_DISABLE(this, IDC_INVIS_DISABLE), chk_CASE_INSENSITIVE(this, IDC_CASE_INSENSITIVE), chk_SPECIALGROUP(this, ID_SPECIALGROUP), chk_EXCLUDE(this, ID_EXCLUDE),
chk_REMOVE_TMP(this, ID_REMOVE_TMP), chk_REMOVE_TMP_ALL(this, ID_REMOVE_TMP_ALL), chk_IGNOREURL(this, ID_IGNOREURL), chk_AUTOAUTH(this, IDC_AUTOAUTH), chk_ADDTOSRVLST(this, IDC_ADDTOSRVLST),
chk_REQAUTH(this, IDC_REQAUTH), chk_REGEX(this, IDC_REGEX), chk_HISTORY_LOG(this, IDC_HISTORY_LOG), chk_MATH_QUESTION(this, IDC_MATH_QUESTION),
diff --git a/plugins/StopSpamMod/src/stdafx.h b/plugins/StopSpamMod/src/stdafx.h index c10b806397..1ff0aa6958 100755 --- a/plugins/StopSpamMod/src/stdafx.h +++ b/plugins/StopSpamMod/src/stdafx.h @@ -6,7 +6,6 @@ using namespace std; #include <fstream> #include <string> -#define __NO_CMPLUGIN_NEEDED #include <newpluginapi.h> #include <m_database.h> #include <m_protosvc.h> @@ -36,7 +35,13 @@ using namespace std; #include "resource.h" #include "utilities.h" -extern HINSTANCE hInst; +struct CMPlugin : public PLUGIN<CMPlugin> +{ + CMPlugin() : + PLUGIN<CMPlugin>(pluginName) + {} +}; + extern HANDLE hStopSpamLogDirH; int OnDbContactSettingChanged(WPARAM w, LPARAM l); diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index db5d0f6588..9ecf9d5cae 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -9,7 +9,7 @@ class COptMainDlg : public CPluginDlgBase public:
COptMainDlg() :
- CPluginDlgBase(hInst, IDD_MAIN, pluginName),
+ CPluginDlgBase(g_plugin.getInst(), IDD_MAIN, pluginName),
edtCount(this, ID_MAXQUESTCOUNT),
edtDescr(this, ID_DESCRIPTION),
chk1(this, ID_INFTALKPROT),
@@ -44,7 +44,7 @@ class COptMessageDlg : public CPluginDlgBase public:
COptMessageDlg() :
- CPluginDlgBase(hInst, IDD_MESSAGES, pluginName),
+ CPluginDlgBase(g_plugin.getInst(), IDD_MESSAGES, pluginName),
btnHelp(this, IDC_VARS),
btnRestore(this, ID_RESTOREDEFAULTS),
edtQuestion(this, ID_QUESTION),
@@ -94,7 +94,7 @@ class COptAccountDlg : public CPluginDlgBase public:
COptAccountDlg() :
- CPluginDlgBase(hInst, IDD_PROTO, pluginName),
+ CPluginDlgBase(g_plugin.getInst(), IDD_PROTO, pluginName),
m_accounts(this, IDC_PROTO)
{
m_accounts.OnItemChanged = Callback(this, &COptAccountDlg::list_OnItemChanged);
diff --git a/plugins/StopSpamPlus/src/stdafx.h b/plugins/StopSpamPlus/src/stdafx.h index e391c7780f..c92038517c 100644 --- a/plugins/StopSpamPlus/src/stdafx.h +++ b/plugins/StopSpamPlus/src/stdafx.h @@ -9,7 +9,6 @@ #include <sstream>
#include <list>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_protosvc.h>
@@ -32,9 +31,14 @@ typedef std::wstring tstring; #define pluginName LPGEN("StopSpam")
-extern char const *answeredSetting;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(pluginName)
+ {}
+};
-extern HINSTANCE hInst;
+extern char const *answeredSetting;
// utils
tstring &GetDlgItemString(HWND hwnd, int id);
diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp index 7352177744..7ea8d973a6 100644 --- a/plugins/StopSpamPlus/src/stopspam.cpp +++ b/plugins/StopSpamPlus/src/stopspam.cpp @@ -1,6 +1,8 @@ #include "stdafx.h"
int hLangpack;
+CMPlugin g_plugin;
+CLIST_INTERFACE *pcli;
/////////////////////////////////////////////////////////////////////////////////////////
// returns plugin's extended information
@@ -18,19 +20,12 @@ PLUGININFOEX pluginInfoEx = { { 0x553811ee, 0xdeb6, 0x48b8, { 0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79 } }
};
-CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" int __declspec(dllexport) Load(void)
{
@@ -58,6 +53,8 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index ffc5237068..5eb1182f15 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -124,7 +124,7 @@ unsigned int CALLBACK MessagePumpThread(void*) if (!NeedWaitForContent(clcitex)) {
if (hwndTip)
MyDestroyWindow(hwndTip);
- hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInst, (LPVOID)clcitex);
+ hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), (LPVOID)clcitex);
if (clcitex) {
mir_free(clcitex);
@@ -214,7 +214,7 @@ void InitMessagePump() WNDCLASSEX wcl = {0};
wcl.cbSize = sizeof(wcl);
wcl.lpfnWndProc = PopupWindowProc;
- wcl.hInstance = hInst;
+ wcl.hInstance = g_plugin.getInst();
wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcl.lpszClassName = POP_WIN_CLASS;
@@ -230,7 +230,7 @@ void InitMessagePump() void DeinitMessagePump()
{
PostMPMessage(WM_QUIT, 0, 0);
- UnregisterClass(POP_WIN_CLASS, hInst);
+ UnregisterClass(POP_WIN_CLASS, g_plugin.getInst());
FreeLibrary(hDwmapiDll);
}
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 67de4e4143..3e920bb3d4 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -847,7 +847,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
if (sel != CB_ERR) {
DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
@@ -867,7 +867,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA memset(di_value, 0, sizeof(DIListNode));
di_value->di.bIsVisible = true;
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di);
+ int result = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di);
if (result == IDOK || (result >= IDPRESETITEM && result < (IDPRESETITEM + 100))) {
TVINSERTSTRUCT tvi = {};
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
@@ -1020,7 +1020,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (item.hItem) {
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
DIListNode *di_value = (DIListNode *)item.lParam;
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK) {
item.mask = TVIF_TEXT;
SetTreeItemText(di_value, &item.pszText);
TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
@@ -1036,7 +1036,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
memset(ds_value, 0, sizeof(DSListNode));
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, index, (LPARAM)ds_value);
SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, index, 0);
@@ -1067,7 +1067,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
if (sel != LB_ERR) {
DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
@@ -1144,7 +1144,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (item.hItem) {
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
DIListNode *di_value = (DIListNode *)item.lParam;
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK) {
item.mask = TVIF_TEXT;
SetTreeItemText(di_value, &item.pszText);
TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
@@ -1965,7 +1965,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case IDC_BTN_FAVCONTACTS:
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FAVCONTACTS), nullptr, DlgProcFavouriteContacts);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FAVCONTACTS), nullptr, DlgProcFavouriteContacts);
break;
}
@@ -2083,7 +2083,7 @@ int OptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_BOLDGROUPS;
odp.position = -790000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_APPEARANCE);
odp.szTab.a = LPGEN("Appearance");
diff --git a/plugins/TipperYM/src/stdafx.h b/plugins/TipperYM/src/stdafx.h index fe059869bb..d338ff81cc 100644 --- a/plugins/TipperYM/src/stdafx.h +++ b/plugins/TipperYM/src/stdafx.h @@ -28,7 +28,6 @@ Boston, MA 02111-1307, USA. #include <windowsx.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_avatars.h>
@@ -74,7 +73,12 @@ Boston, MA 02111-1307, USA. #define MODULE_ITEMS "Tipper_Items"
#define DEFAULT_SKIN_FOLDER L"Skins\\Tipper"
-extern HMODULE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
extern HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle;
extern COLORREF colTitle, colLabels, colBg, colValues;
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index a28b8a7798..216b4e2af6 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -20,7 +20,9 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HMODULE hInst;
+int hLangpack;
+CMPlugin g_plugin;
+CLIST_INTERFACE *pcli;
FontIDW fontTitle, fontLabels, fontValues, fontTrayTitle;
ColourIDW colourBg, colourBorder, colourAvatarBorder, colourDivider, colourSidebar;
@@ -34,8 +36,7 @@ HANDLE hReloadFonts = nullptr; HANDLE hFolderChanged, hSkinFolder;
wchar_t SKIN_FOLDER[256];
-CLIST_INTERFACE *pcli;
-int hLangpack;
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfoEx =
{
@@ -51,17 +52,13 @@ PLUGININFOEX pluginInfoEx = {0x8392df1d, 0x9090, 0x4f8e, {0x9d, 0xf6, 0x2f, 0xe0, 0x58, 0xed, 0xd8, 0x00}}
};
-bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int ReloadFont(WPARAM, LPARAM)
{
LOGFONT logFont;
@@ -86,12 +83,11 @@ int ReloadFont(WPARAM, LPARAM) opt.colAvatarBorder = Colour_GetW(colourAvatarBorder);
opt.colSidebar = Colour_GetW(colourSidebar);
opt.colDivider = Colour_GetW(colourDivider);
-
return 0;
}
// hack to hide tip when clist hides from timeout
-int SettingChanged(WPARAM, LPARAM lParam)
+static int SettingChanged(WPARAM, LPARAM lParam)
{
DBCONTACTWRITESETTING *dcws = (DBCONTACTWRITESETTING *)lParam;
if (strcmp(dcws->szModule, "CList") != 0 || strcmp(dcws->szSetting, "State") != 0)
@@ -105,7 +101,7 @@ int SettingChanged(WPARAM, LPARAM lParam) }
// needed for msg_count_xxx substitutions
-int EventDeleted(WPARAM wParam, LPARAM lParam)
+static int EventDeleted(WPARAM wParam, LPARAM lParam)
{
DBEVENTINFO dbei = {};
if (!db_event_get(lParam, &dbei))
@@ -115,13 +111,13 @@ int EventDeleted(WPARAM wParam, LPARAM lParam) return 0;
}
-int ReloadSkinFolder(WPARAM, LPARAM)
+static int ReloadSkinFolder(WPARAM, LPARAM)
{
FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER);
return 0;
}
-void InitFonts()
+static void InitFonts()
{
colourBg.cbSize = sizeof(ColourIDW);
mir_wstrcpy(colourBg.group, LPGENW("Tooltips"));
@@ -240,7 +236,7 @@ void InitFonts() hReloadFonts = HookEvent(ME_FONT_RELOAD, ReloadFont);
}
-int ModulesLoaded(WPARAM, LPARAM)
+static int ModulesLoaded(WPARAM, LPARAM)
{
InitFonts();
@@ -307,6 +303,8 @@ static INT_PTR ReloadSkin(WPARAM wParam, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
IconItem iconList[] =
{
{ LPGEN("Copy item"), "copy_item", IDI_ITEM },
@@ -325,7 +323,7 @@ extern "C" int __declspec(dllexport) Load(void) iCodePage = Langpack_GetDefaultCodePage();
- Icon_Register(hInst, MODULE, iconList, _countof(iconList), MODULE);
+ Icon_Register(g_plugin.getInst(), MODULE, iconList, _countof(iconList), MODULE);
InitTranslations();
InitMessagePump();
@@ -346,6 +344,8 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload()
{
UnhookEvent(hSettingChangedEvent);
diff --git a/plugins/WhoUsesMyFiles/src/stdafx.h b/plugins/WhoUsesMyFiles/src/stdafx.h index b21584e35a..782f6938ab 100644 --- a/plugins/WhoUsesMyFiles/src/stdafx.h +++ b/plugins/WhoUsesMyFiles/src/stdafx.h @@ -21,35 +21,35 @@ #define MODULENAME "WUMF Plugin"
-#define LIFETIME_MAX 60
-#define LIFETIME_MIN 1
-#define MAX_PATHNAME 512
-#define MAX_USERNAME 512
-#define TIME 500
-
-#define POPUPS_ENABLED "1033"
-#define DELAY_SEC "1026"
-#define DELAY_SET "1049"
-#define DELAY_INF "1050"
-#define DELAY_DEF "1051"
-#define COLOR_SET "1000"
-#define COLOR_WIN "1001"
-#define COLOR_DEF "1002"
-#define COLOR_BACK "1003"
-#define COLOR_TEXT "1004"
-#define OPT_FILE "1006"
-#define LOG_INTO_FILE "1054"
-#define LOG_FOLDER "1055"
-#define ALERT_FOLDER "1056"
-#define LOG_UNC "1057"
-#define ALERT_UNC "1058"
-#define LOG_COMP "1059"
-#define ALERT_COMP "1060"
-
-#define IDM_SETUP 0x0402
-#define IDM_ABOUT 0x0403
-#define IDM_SHOW 0x0405
-#define IDM_EXIT 0x0404
+#define LIFETIME_MAX 60
+#define LIFETIME_MIN 1
+#define MAX_PATHNAME 512
+#define MAX_USERNAME 512
+#define TIME 500
+
+#define POPUPS_ENABLED "1033"
+#define DELAY_SEC "1026"
+#define DELAY_SET "1049"
+#define DELAY_INF "1050"
+#define DELAY_DEF "1051"
+#define COLOR_SET "1000"
+#define COLOR_WIN "1001"
+#define COLOR_DEF "1002"
+#define COLOR_BACK "1003"
+#define COLOR_TEXT "1004"
+#define OPT_FILE "1006"
+#define LOG_INTO_FILE "1054"
+#define LOG_FOLDER "1055"
+#define ALERT_FOLDER "1056"
+#define LOG_UNC "1057"
+#define ALERT_UNC "1058"
+#define LOG_COMP "1059"
+#define ALERT_COMP "1060"
+
+#define IDM_SETUP 0x0402
+#define IDM_ABOUT 0x0403
+#define IDM_SHOW 0x0405
+#define IDM_EXIT 0x0404
struct WUMF_OPTIONS
{
|