From ba1083b4da33ca44a5ae7d90eabbe3d6d340a81e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 16:47:04 +0300 Subject: XSoundNotify, YAPP, YaRelay, ZeroSwitch, ZeroNotify -> CMPlugin --- plugins/XSoundNotify/src/dialog.cpp | 2 +- plugins/XSoundNotify/src/options.cpp | 2 +- plugins/XSoundNotify/src/stdafx.h | 9 +++++++-- plugins/XSoundNotify/src/xsn_main.cpp | 23 ++++++++++++----------- 4 files changed, 21 insertions(+), 15 deletions(-) (limited to 'plugins/XSoundNotify') diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 283aa78bdb..96d623ccbb 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -194,7 +194,7 @@ INT_PTR ShowDialog(WPARAM wParam, LPARAM) { HWND hChangeSoundDlg = WindowList_Find(hChangeSoundDlgList, wParam); if (!hChangeSoundDlg) { - hChangeSoundDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACTS), nullptr, DlgProcContactsOptions, (LPARAM)wParam); + hChangeSoundDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACTS), nullptr, DlgProcContactsOptions, (LPARAM)wParam); ShowWindow(hChangeSoundDlg, SW_SHOW); } else { diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index 0444d7c155..61d9505381 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -344,7 +344,7 @@ INT OptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 100000000; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.szGroup.w = LPGENW("Sounds"); diff --git a/plugins/XSoundNotify/src/stdafx.h b/plugins/XSoundNotify/src/stdafx.h index ea8008c8c6..8e147d857d 100644 --- a/plugins/XSoundNotify/src/stdafx.h +++ b/plugins/XSoundNotify/src/stdafx.h @@ -3,7 +3,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -23,6 +22,13 @@ #define SETTINGSKEY "XSNPlugin_sound" #define SETTINGSIGNOREKEY "XSNPlugin_ignore" +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(SETTINGSNAME) + {} +}; + struct XSN_Data { LPARAM hContact; @@ -41,7 +47,6 @@ struct XSN_Data extern LIST XSN_Users; -extern HINSTANCE hInst; extern MWindowList hChangeSoundDlgList; extern BYTE isIgnoreSound, isOwnSound; diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index e06c33a311..ca3dab258a 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -9,16 +9,19 @@ There is no warranty. #include "stdafx.h" -HINSTANCE hInst; int hLangpack; +CMPlugin g_plugin; +CHAT_MANAGER *pci; + LIST XSN_Users(10, NumericKeySortT); HGENMENU hChangeSound = nullptr; MWindowList hChangeSoundDlgList = nullptr; BYTE isIgnoreSound = 0, isOwnSound = 0, isIgnoreAccSound = 0, isAccSound = 0; -CHAT_MANAGER *pci; +///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = { +PLUGININFOEX pluginInfo = +{ sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -28,15 +31,9 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB, UNICODE_AWARE, // {A01E25F7-A6EF-4B40-8CAC-755A2F2E55B5} - { 0xa01e25f7, 0xa6ef, 0x4b40,{ 0x8c, 0xac, 0x75, 0x5a, 0x2f, 0x2e, 0x55, 0xb5 } } + { 0xa01e25f7, 0xa6ef, 0x4b40,{ 0x8c, 0xac, 0x75, 0x5a, 0x2f, 0x2e, 0x55, 0xb5 }} }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; @@ -44,7 +41,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) ///////////////////////////////////////////////////////////////////////////////////////// -struct { +struct +{ int iStatus; const char *szName; } @@ -190,6 +188,7 @@ static int OnPlaySound(WPARAM, LPARAM) { if (isIgnoreSound || isIgnoreAccSound) return 1; + if (isOwnSound) { isOwnSound = 0; return 1; @@ -255,6 +254,8 @@ extern "C" int __declspec(dllexport) Load() return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Unload(void) { WindowList_Destroy(hChangeSoundDlgList); -- cgit v1.2.3