From 8a74e7495ce5ad39de4f5c25121a84d35df90c36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 15:08:48 +0300 Subject: CMPlugin to receive a reference to PLUGININFOEX --- plugins/MsgPopup/src/main.cpp | 18 +++++++++++------- plugins/MsgPopup/src/options.cpp | 16 ++++++++-------- plugins/MsgPopup/src/stdafx.h | 6 ++---- 3 files changed, 21 insertions(+), 19 deletions(-) (limited to 'plugins/MsgPopup/src') diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index 8fb334466f..aca431fc09 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -36,7 +36,7 @@ MSGBOXOPTIONS options; ///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -50,9 +50,13 @@ PLUGININFOEX pluginInfo = {0xcf25d645, 0x4dab, 0x4b0a, {0xb9, 0xf1, 0xde, 0x1e, 0x86, 0x23, 0x1f, 0x9b}} }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -211,19 +215,19 @@ void LoadConfig() mir_snprintf(szNameFG, "FG%d", indx); mir_snprintf(szNameBG, "BG%d", indx); mir_snprintf(szNameTO, "TO%d", indx); - options.FG[indx] = db_get_dw(NULL, SERVICENAME, szNameFG, optionsDefault.FG[indx]); - options.BG[indx] = db_get_dw(NULL, SERVICENAME, szNameBG, optionsDefault.BG[indx]); - options.Timeout[indx] = db_get_dw(NULL, SERVICENAME, szNameTO, (DWORD)optionsDefault.Timeout[indx]); + options.FG[indx] = db_get_dw(NULL, MODULENAME, szNameFG, optionsDefault.FG[indx]); + options.BG[indx] = db_get_dw(NULL, MODULENAME, szNameBG, optionsDefault.BG[indx]); + options.Timeout[indx] = db_get_dw(NULL, MODULENAME, szNameTO, (DWORD)optionsDefault.Timeout[indx]); } - options.Sound = db_get_b(NULL, SERVICENAME, "Sound", (DWORD)optionsDefault.Sound); + options.Sound = db_get_b(NULL, MODULENAME, "Sound", (DWORD)optionsDefault.Sound); } ///////////////////////////////////////////////////////////////////////////////////////// extern "C" __declspec(dllexport) int Load(void) { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); HookEvent(ME_SYSTEM_MODULESLOADED, HookedInit); HookEvent(ME_OPT_INITIALISE, HookedOptions); diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp index b8883e91db..672385c66c 100644 --- a/plugins/MsgPopup/src/options.cpp +++ b/plugins/MsgPopup/src/options.cpp @@ -54,10 +54,10 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l case WM_COMMAND: if (LOWORD(wParam) == IDC_PREVIEW) { - MessageBox(nullptr, TranslateT("Message with question"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONQUESTION); - MessageBox(nullptr, TranslateT("Message with exclamation"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONEXCLAMATION); - MessageBox(nullptr, TranslateT("Message with error"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONSTOP); - MessageBox(nullptr, TranslateT("Message with asterisk"), TranslateW(_A2W(SERVICENAME) L" - demo"), MB_ICONASTERISK); + MessageBox(nullptr, TranslateT("Message with question"), TranslateW(_A2W(MODULENAME) L" - demo"), MB_ICONQUESTION); + MessageBox(nullptr, TranslateT("Message with exclamation"), TranslateW(_A2W(MODULENAME) L" - demo"), MB_ICONEXCLAMATION); + MessageBox(nullptr, TranslateT("Message with error"), TranslateW(_A2W(MODULENAME) L" - demo"), MB_ICONSTOP); + MessageBox(nullptr, TranslateT("Message with asterisk"), TranslateW(_A2W(MODULENAME) L" - demo"), MB_ICONASTERISK); return FALSE; } @@ -103,11 +103,11 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l mir_snprintf(szNameBG, "BG%d", indx); mir_snprintf(szNameTO, "TO%d", indx); - DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]); - DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]); - DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameTO, options.Timeout[indx], (DWORD)optionsDefault.Timeout[indx]); + DBWriteContactSettingDwordDef(NULL, MODULENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]); + DBWriteContactSettingDwordDef(NULL, MODULENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]); + DBWriteContactSettingDwordDef(NULL, MODULENAME, szNameTO, options.Timeout[indx], (DWORD)optionsDefault.Timeout[indx]); } - DBWriteContactSettingDwordDef(NULL, SERVICENAME, "Sound", options.Sound, optionsDefault.Sound); + DBWriteContactSettingDwordDef(NULL, MODULENAME, "Sound", options.Sound, optionsDefault.Sound); break; } diff --git a/plugins/MsgPopup/src/stdafx.h b/plugins/MsgPopup/src/stdafx.h index c235239788..eeac5fc31d 100644 --- a/plugins/MsgPopup/src/stdafx.h +++ b/plugins/MsgPopup/src/stdafx.h @@ -37,13 +37,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h" #include "version.h" -#define SERVICENAME "MessagePopup" +#define MODULENAME "MessagePopup" struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(SERVICENAME) - {} + CMPlugin(); }; struct MSGBOXOPTIONS -- cgit v1.2.3