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/NotifyAnything/src/main.cpp | 10 +++++++--- plugins/NotifyAnything/src/options.cpp | 36 +++++++++++++++++----------------- plugins/NotifyAnything/src/stdafx.h | 6 ++---- 3 files changed, 27 insertions(+), 25 deletions(-) (limited to 'plugins/NotifyAnything/src') diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 4b05c673ad..893ddc3bd1 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -29,7 +29,7 @@ int &hLangpack(g_plugin.m_hLang); ///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -43,9 +43,13 @@ PLUGININFOEX pluginInfo = { 0xe92874ec, 0x594a, 0x4a2f, { 0xbd, 0xed, 0xc0, 0xbe, 0x8b, 0x5a, 0x45, 0xd1 } } }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -970,7 +974,7 @@ void stop_threads() extern "C" int __declspec(dllexport) Load() { g_firstrun = true; - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); wchar_t buf[MAX_PATH + 1]; mir_wstrcpy(buf, L"."); diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 41e983dcba..d468ff11bc 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -134,34 +134,34 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara void save_settings() { - db_set_b(NULL, PlugName, "local_only", g_settings.local_only); - db_set_b(NULL, PlugName, "debug_messages", g_settings.debug_messages); - db_set_b(NULL, PlugName, "log_to_file", g_settings.log_to_file); - db_set_b(NULL, PlugName, "beep", g_settings.sound); - db_set_b(NULL, PlugName, "use_pcspeaker", g_settings.use_pcspeaker); - db_set_b(NULL, PlugName, "allow_execute", g_settings.allow_execute); - db_set_dw(NULL, PlugName, "port", g_settings.port); - db_set_ws(NULL, PlugName, "password", g_settings.password.c_str()); - db_set_ws(NULL, PlugName, "log_filename", g_settings.log_filename.c_str()); + db_set_b(NULL, MODULENAME, "local_only", g_settings.local_only); + db_set_b(NULL, MODULENAME, "debug_messages", g_settings.debug_messages); + db_set_b(NULL, MODULENAME, "log_to_file", g_settings.log_to_file); + db_set_b(NULL, MODULENAME, "beep", g_settings.sound); + db_set_b(NULL, MODULENAME, "use_pcspeaker", g_settings.use_pcspeaker); + db_set_b(NULL, MODULENAME, "allow_execute", g_settings.allow_execute); + db_set_dw(NULL, MODULENAME, "port", g_settings.port); + db_set_ws(NULL, MODULENAME, "password", g_settings.password.c_str()); + db_set_ws(NULL, MODULENAME, "log_filename", g_settings.log_filename.c_str()); } void load_settings() { - g_settings.local_only = db_get_b(NULL, PlugName, "local_only", 1) != 0; - g_settings.debug_messages = db_get_b(NULL, PlugName, "debug_messages", 0) != 0; - g_settings.log_to_file = db_get_b(NULL, PlugName, "log_to_file", 0) != 0; - g_settings.sound = NASettings::sound_t(db_get_b(NULL, PlugName, "beep", g_settings.request)); - g_settings.use_pcspeaker = db_get_b(NULL, PlugName, "use_pcspeaker", 0) != 0; - g_settings.allow_execute = db_get_b(NULL, PlugName, "allow_execute", 0) != 0; - g_settings.port = db_get_dw(NULL, PlugName, "port", 12001); + g_settings.local_only = db_get_b(NULL, MODULENAME, "local_only", 1) != 0; + g_settings.debug_messages = db_get_b(NULL, MODULENAME, "debug_messages", 0) != 0; + g_settings.log_to_file = db_get_b(NULL, MODULENAME, "log_to_file", 0) != 0; + g_settings.sound = NASettings::sound_t(db_get_b(NULL, MODULENAME, "beep", g_settings.request)); + g_settings.use_pcspeaker = db_get_b(NULL, MODULENAME, "use_pcspeaker", 0) != 0; + g_settings.allow_execute = db_get_b(NULL, MODULENAME, "allow_execute", 0) != 0; + g_settings.port = db_get_dw(NULL, MODULENAME, "port", 12001); DBVARIANT dbv; - if (!db_get_ws(NULL, PlugName, "password", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "password", &dbv)) { g_settings.password = dbv.ptszVal; db_free(&dbv); } - if (!db_get_ws(NULL, PlugName, "log_filename", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "log_filename", &dbv)) { g_settings.log_filename = dbv.ptszVal; db_free(&dbv); } diff --git a/plugins/NotifyAnything/src/stdafx.h b/plugins/NotifyAnything/src/stdafx.h index 1eaf2a7da5..940b5d379f 100644 --- a/plugins/NotifyAnything/src/stdafx.h +++ b/plugins/NotifyAnything/src/stdafx.h @@ -21,13 +21,11 @@ #include "resource.h" #include "version.h" -const char PlugName[] = "NotifyAnything"; +#define MODULENAME "NotifyAnything" struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(PlugName) - {} + CMPlugin(); }; //--------------------------- -- cgit v1.2.3