From 7339bc08a765b87b0140e350a05fcf0d22a57722 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 7 Apr 2013 16:14:47 +0000 Subject: mir_getCLI() - a helper for MS_CLIST_RETRIEVE_INTERFACE, just call it without parameters git-svn-id: http://svn.miranda-ng.org/main/trunk@4368 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BossKeyPlus/src/BossKey.cpp | 2 +- plugins/CSList/src/cslist.cpp | 2 +- plugins/Clist_blind/src/init.cpp | 2 +- plugins/Clist_modern/src/init.cpp | 2 +- plugins/Clist_mw/src/init.cpp | 2 +- plugins/Clist_nicer/src/init.cpp | 2 +- plugins/FlashAvatars/src/cflash.cpp | 10 +++++----- plugins/MetaContacts/src/meta_main.cpp | 2 +- plugins/SimpleStatusMsg/src/main.cpp | 5 +++-- plugins/SimpleStatusMsg/src/options.cpp | 4 +--- plugins/StatusPlugins/AdvancedAutoAway/main.cpp | 2 +- plugins/StatusPlugins/KeepStatus/main.cpp | 2 +- plugins/StatusPlugins/StartupStatus/main.cpp | 2 +- plugins/StopSpamMod/src/init.cpp | 10 ++-------- plugins/StopSpamMod/src/utilities.cpp | 15 ++++----------- plugins/UserInfoEx/src/init.cpp | 2 +- plugins/YARelay/src/main.cpp | 2 +- 17 files changed, 27 insertions(+), 41 deletions(-) (limited to 'plugins') diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 87bbb5cb6d..df278659e4 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -730,7 +730,6 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit); HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); - pcli = (CLIST_INTERFACE *)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInstance); GetWindowThreadProcessId(pcli->hwndContactList, &g_dwMirandaPID); // let's create our secret window @@ -807,6 +806,7 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); g_wMaskAdv = db_get_w(NULL,MOD_NAME,"optsmaskadv",0); g_bOldSetting = db_get_b(NULL, MOD_NAME, "OldSetting", 0); diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 98f0c86410..54a30b6b82 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -120,7 +120,7 @@ static int OnPreshutdown(WPARAM wparam, LPARAM lparam) extern "C" __declspec(dllexport) int Load() { mir_getLP(&pluginInfoEx); - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0); + mir_getCLI(); // support for ComboBoxEx INITCOMMONCONTROLSEX icc; diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 445591c950..8e391ded74 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -141,7 +141,7 @@ static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) CListInitialise() { - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + mir_getCLI(); #define CLIST_SWAP(a) pfn##a = pcli->pfn##a; pcli->pfn##a = a diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index eee4ba3891..360d4dfebd 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -143,7 +143,7 @@ extern "C" __declspec(dllexport) int Unload(void) static HRESULT SubclassClistInterface() { // get the contact list interface - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + mir_getCLI(); // OVERLOAD CLIST INTERFACE FUNCTIONS // diff --git a/plugins/Clist_mw/src/init.cpp b/plugins/Clist_mw/src/init.cpp index 2d89519ac4..667f23f288 100644 --- a/plugins/Clist_mw/src/init.cpp +++ b/plugins/Clist_mw/src/init.cpp @@ -156,7 +156,7 @@ extern "C" int __declspec(dllexport) CListInitialise() PreloadCLCModule(); - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + mir_getCLI(); pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu; pcli->pfnCalcEipPosition = CalcEipPosition; pcli->pfnCheckCacheItem = CheckPDNCE; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index e50687c25f..a812acaeb1 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -278,7 +278,7 @@ extern "C" int __declspec(dllexport) CListInitialise() PreloadContactListModule(); // get the clist interface - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + mir_getCLI(); pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu; pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged; pcli->pfnCompareContacts = CompareContacts; diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index 7153d41c9f..25dcfb5856 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -58,6 +58,7 @@ HINSTANCE g_hInst = 0; int hLangpack; +CLIST_INTERFACE *pcli; HANDLE hNetlibUser; @@ -208,17 +209,15 @@ static void __cdecl loadFlash_Thread(void *p) { flash->Release(); } -static void ShowBalloon(TCHAR *title, TCHAR *msg, int icon) { +static void ShowBalloon(TCHAR *title, TCHAR *msg, int icon) +{ MIRANDASYSTRAYNOTIFY msn = {0}; msn.cbSize = sizeof(MIRANDASYSTRAYNOTIFY); msn.dwInfoFlags = icon | NIIF_INTERN_UNICODE; msn.tszInfo = TranslateTS(msg); msn.tszInfoTitle = TranslateTS(title); msn.uTimeout = 5000; - - CLIST_INTERFACE* c = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); - if (c) - c->pfnCListTrayNotify(&msn); + pcli->pfnCListTrayNotify(&msn); } static void prepareFlash(char* pProto, const TCHAR* pUrl, FLASHAVATAR& fa, IShockwaveFlash* flash) @@ -615,6 +614,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirand extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded); return 0; diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index 9c49a7ced9..4b102b16d6 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -142,7 +142,7 @@ extern "C" __declspec(dllexport) int Unload(void) extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInstance); + mir_getCLI(); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status")); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS")); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 4aa0db4416..ab72a2a225 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., HINSTANCE g_hInst; int hLangpack; +CLIST_INTERFACE *pcli; PROTOACCOUNTS *accounts; static int g_iIdleTime = -1; @@ -2111,11 +2112,11 @@ static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam) return (INT_PTR)res; } - extern "C" int __declspec(dllexport) Load(void) { - mir_getLP(&pluginInfo); + mir_getCLI(); + hwndSAMsgDialog = NULL; accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS)); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index e803be5784..fcb79b0b37 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -22,9 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., static void RebuildStatusMenu(void) { - CLIST_INTERFACE* pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0); - if (pcli && pcli->version > 4) - pcli->pfnReloadProtoMenus(); + pcli->pfnReloadProtoMenus(); } static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) diff --git a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp index a08f18af0c..ac41956d2d 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp @@ -78,7 +78,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_AUTOAW extern "C" __declspec(dllexport) int Load(void) { mir_getLP( &pluginInfoEx ); - pcli = (CLIST_INTERFACE*)CallService( MS_CLIST_RETRIEVE_INTERFACE, 0, 0); + mir_getCLI(); autoAwaySettings = new OBJLIST(10, CompareSettings); diff --git a/plugins/StatusPlugins/KeepStatus/main.cpp b/plugins/StatusPlugins/KeepStatus/main.cpp index 10cdc9a5df..1baa85e758 100644 --- a/plugins/StatusPlugins/KeepStatus/main.cpp +++ b/plugins/StatusPlugins/KeepStatus/main.cpp @@ -77,7 +77,7 @@ INT_PTR AnnounceStatusChangeService(WPARAM wParam, LPARAM lParam); extern "C" int __declspec(dllexport) Load(void) { mir_getLP( &pluginInfoEx ); - pcli = (CLIST_INTERFACE*)CallService( MS_CLIST_RETRIEVE_INTERFACE, 0, 0); + mir_getCLI(); InitCommonStatus(); diff --git a/plugins/StatusPlugins/StartupStatus/main.cpp b/plugins/StatusPlugins/StartupStatus/main.cpp index 65488c63a5..690dc1e39b 100644 --- a/plugins/StatusPlugins/StartupStatus/main.cpp +++ b/plugins/StatusPlugins/StartupStatus/main.cpp @@ -73,7 +73,7 @@ static INT_PTR SrvGetProfile( WPARAM wParam, LPARAM lParam ) extern "C" int __declspec(dllexport) Load(void) { mir_getLP( &pluginInfoEx ); - pcli = (CLIST_INTERFACE*)CallService( MS_CLIST_RETRIEVE_INTERFACE, 0, 0); + mir_getCLI(); if ( db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1) || db_get_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0)) diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index f7c524af3a..4278ebef16 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -15,7 +15,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "headers.h" BOOL gbDosServiceExist = 0; @@ -55,12 +54,9 @@ std::wstring gbAuthRepl; extern TCHAR const * defQuestion; extern int RemoveTmp(WPARAM,LPARAM); - - ///////////////////////////////////////////////////////////////////////////////////////// // returns plugin's extended information - PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -137,19 +133,17 @@ HANDLE hEventFilter = 0, hOptInitialise = 0, hSettingChanged = 0; BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) { - /*if(DLL_PROCESS_ATTACH == fdwReason) - hInst=hinstDLL; - return TRUE;*/ hInst = hinstDLL; return TRUE; } - int hLangpack = 0; +CLIST_INTERFACE *pcli; extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfoEx); + mir_getCLI(); CreateServiceFunction("/RemoveTmp", (MIRANDASERVICE)RemoveTmp); HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index efef2f9e02..44ad773675 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -67,19 +67,12 @@ bool ProtoInList(std::string proto) int CreateCListGroup(TCHAR* szGroupName) { - int hGroup; - CLIST_INTERFACE *clint = NULL; + int hGroup = CallService(MS_CLIST_GROUPCREATE, 0, 0); - if (ServiceExists(MS_CLIST_RETRIEVE_INTERFACE)) - clint = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0); + TCHAR* usTmp = szGroupName; + pcli->pfnRenameGroup(hGroup, usTmp); - hGroup = CallService(MS_CLIST_GROUPCREATE, 0, 0); - - TCHAR* usTmp = szGroupName; - - clint->pfnRenameGroup(hGroup, usTmp); - - return hGroup; + return hGroup; } void DeleteCListGroupsByName(TCHAR* szGroupName) diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index e7af317ef7..cc4e12f945 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -180,7 +180,7 @@ extern "C" int __declspec(dllexport) Load(void) ZeroMemory(&myGlobals, sizeof(MGLOBAL)); // init clist interface - pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0); + mir_getCLI(); // init new miranda timezone interface mir_getTMI(&tmi); diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 3386c792da..950cb625b5 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -233,7 +233,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfoEx); - pcli = mir_getCLI(); + mir_getCLI(); // Load plugin options from DB hForwardFrom = (HANDLE)db_get_dw(NULL, "yaRelay", "ForwardFrom", 0); -- cgit v1.2.3