From 56239fcddd46400d812d83e38597d593b5c0356d Mon Sep 17 00:00:00 2001 From: Mataes Date: Wed, 16 May 2018 22:58:35 +0300 Subject: HistoryLinkList, HistoryStats, historysweeperlight, httpserver, HwHotKeys: cmplugin adaptation --- plugins/HistorySweeperLight/src/historysweeperlight.cpp | 2 +- plugins/HistorySweeperLight/src/main.cpp | 9 +-------- plugins/HistorySweeperLight/src/options.cpp | 6 +++--- plugins/HistorySweeperLight/src/stdafx.h | 12 ++++++++---- 4 files changed, 13 insertions(+), 16 deletions(-) (limited to 'plugins/HistorySweeperLight/src') diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index e73fb24e0c..176a87087e 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -169,7 +169,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke item = (BEventData*)bsearch(&ev, books, bookcnt, sizeof(BEventData), CompareBookmarks); if (item != nullptr && item->Timestamp == dbei.timestamp) { doDelete = FALSE; - btshift = (--bookcnt - (item - books))*sizeof(BEventData); + btshift = (--bookcnt - (item - books)) * sizeof(BEventData); if (btshift) memmove(item, item + 1, btshift); } diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index e0fee84c71..84937354a5 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -21,8 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -HINSTANCE hInst; - +CMPlugin g_plugin; int hLangpack; LIST g_hWindows(5, PtrKeySortT); @@ -41,12 +40,6 @@ static PLUGININFOEX pluginInfoEx = { 0x1d9bf74a, 0x44a8, 0x4b3f, { 0xa6, 0xe5, 0x73, 0x6, 0x9d, 0x3a, 0x89, 0x79 } } }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - int OnIconPressed(WPARAM hContact, LPARAM lParam) { StatusIconClickData *sicd = (StatusIconClickData *)lParam; diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index b6826d4c57..af1f911fb9 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -56,7 +56,7 @@ static HANDLE hIconLibItem[_countof(iconList)]; void InitIcons(void) { - Icon_Register(hInst, ModuleName, iconList, _countof(iconList), ModuleName); + Icon_Register(g_plugin.getInst(), ModuleName, iconList, _countof(iconList), ModuleName); } HICON LoadIconEx(const char* name) @@ -228,7 +228,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) return TRUE; case WM_NOTIFY: - NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam; + NMCLISTCONTROL * nmc = (NMCLISTCONTROL*)lParam; if (nmc->hdr.idFrom == 0 && nmc->hdr.code == (unsigned)PSN_APPLY) SaveSettings(hwndDlg); else if (nmc->hdr.idFrom == IDC_LIST) { @@ -270,7 +270,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) int HSOptInitialise(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORYSWEEPER); odp.szTitle.a = ModuleName; odp.szGroup.a = LPGEN("History"); diff --git a/plugins/HistorySweeperLight/src/stdafx.h b/plugins/HistorySweeperLight/src/stdafx.h index 1293f4ad9f..27d77a69d2 100644 --- a/plugins/HistorySweeperLight/src/stdafx.h +++ b/plugins/HistorySweeperLight/src/stdafx.h @@ -22,14 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __HISTORYSWEEPERLIGHT_H__ #if !defined( _WIN64 ) - #define _USE_32BIT_TIME_T +#define _USE_32BIT_TIME_T #endif #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -46,8 +44,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Plugin name #define ModuleName "History Sweeper Light" +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(ModuleName) + {} +}; + // main.c -extern HINSTANCE hInst; extern LIST g_hWindows; // options.c -- cgit v1.2.3