From bd820972afe24409e6b570adbc45f5dc0fa2385d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Apr 2013 07:08:40 +0000 Subject: SRMM icons to be unloaded automatically git-svn-id: http://svn.miranda-ng.org/main/trunk@4418 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CountryFlags/src/extraimg.cpp | 20 ++----- plugins/FavContacts/src/main.cpp | 21 +++---- plugins/FingerprintNG/src/fingerprint.cpp | 22 +------ plugins/HistorySweeperLight/src/main.cpp | 34 +++-------- plugins/MirOTR/MirOTR/src/svcs_srmm.cpp | 4 +- plugins/New_GPG/src/init.cpp | 35 +++++------- plugins/NoHistory/src/common.h | 2 - plugins/NoHistory/src/dllmain.cpp | 31 +++++----- plugins/Popup/src/main.cpp | 1 - plugins/Popup/src/srmm_menu.cpp | 92 +++++++++++------------------- plugins/Popup/src/srmm_menu.h | 1 - plugins/Scriver/src/msgs.cpp | 3 +- plugins/Scriver/src/statusicon.cpp | 3 +- plugins/SecureIM/src/main.cpp | 1 - plugins/SecureIM/src/svcs_srmm.cpp | 83 ++++++++++----------------- plugins/SecureIM/src/svcs_srmm.h | 1 - plugins/SpellChecker/src/spellchecker.cpp | 39 +++++-------- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 18 ++++-- plugins/UserInfoEx/src/init.cpp | 2 +- 19 files changed, 148 insertions(+), 265 deletions(-) (limited to 'plugins') diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index 7da037909a..4300276f53 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -165,7 +165,7 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam) static int StatusIconsChanged(WPARAM wParam,LPARAM lParam) { - if (ServiceExists(MS_MSG_ADDICON)) + if (ServiceExists(MS_MSG_MODIFYICON)) if ( db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT)) CallFunctionBuffered(UpdateStatusIcons, 0, FALSE, STATUSICON_REFRESHDELAY); return 0; @@ -184,7 +184,7 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L { BOOL val; /* Status Icon */ - if (ServiceExists(MS_MSG_ADDICON)) + if (ServiceExists(MS_MSG_REMOVEICON)) val = db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0; else EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG),val=FALSE); @@ -266,7 +266,7 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam) if (!lstrcmpA(dbcws->szSetting,"ShowStatusIconFlag") || !lstrcmpA(dbcws->szSetting,"UseUnknownFlag") || !lstrcmpA(dbcws->szSetting,"UseIpToCountry")) - if (ServiceExists(MS_MSG_ADDICON)) + if (ServiceExists(MS_MSG_REMOVEICON)) CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY); } } @@ -277,7 +277,7 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam) /* Extra Image */ SetExtraImage((HANDLE)wParam); /* Status Icon */ - if (ServiceExists(MS_MSG_ADDICON)) + if (ServiceExists(MS_MSG_REMOVEICON)) CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY); } return 0; @@ -298,29 +298,19 @@ static int ExtraImgModulesLoaded(WPARAM wParam,LPARAM lParam) StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; // dwID = 0 sid.flags = MBF_HIDDEN; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); /* Status Icon */ HookEvent(ME_MSG_WINDOWEVENT, MsgWndEvent); return 0; } -static int ExtraImgShutdown(WPARAM, LPARAM) -{ - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULENAME; // dwID = 0 - sid.flags = MBF_HIDDEN; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - return 0; -} - void InitExtraImg(void) { /* Services */ hServiceDetectContactOrigin = CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY,ServiceDetectContactOriginCountry); /* Misc */ HookEvent(ME_SYSTEM_MODULESLOADED, ExtraImgModulesLoaded); - HookEvent(ME_SYSTEM_PRESHUTDOWN, ExtraImgShutdown); /* Status icon */ HookEvent(ME_SKIN2_ICONSCHANGED,StatusIconsChanged); /* Options */ diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 3abcf07a58..6f8d797111 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -144,18 +144,15 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) { HookEvent(ME_TTB_MODULELOADED, ProcessTBLoaded); - if (ServiceExists(MS_MSG_ADDICON)) { - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); - sid.szModule = "FavContacts"; - sid.szTooltip = "Favourite Contacts"; - sid.hIcon = Skin_GetIconByHandle(iconList[0].hIcolib); - sid.hIconDisabled = Skin_GetIconByHandle(iconList[1].hIcolib); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - - HookEvent(ME_MSG_ICONPRESSED, ProcessSrmmIconClick); - HookEvent(ME_MSG_WINDOWEVENT, ProcessSrmmEvent); - } + StatusIconData sid = { sizeof(sid) }; + sid.szModule = "FavContacts"; + sid.szTooltip = "Favourite Contacts"; + sid.hIcon = Skin_GetIconByHandle(iconList[0].hIcolib); + sid.hIconDisabled = Skin_GetIconByHandle(iconList[1].hIcolib); + Srmm_AddIcon(&sid); + + HookEvent(ME_MSG_ICONPRESSED, ProcessSrmmIconClick); + HookEvent(ME_MSG_WINDOWEVENT, ProcessSrmmEvent); ///////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index df1a7aca71..036c1eb7a2 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -1159,38 +1159,20 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hExtraIcon = ExtraIcon_Register("Client", LPGEN("Fingerprint"), "client_Miranda_Unknown", OnExtraIconListRebuild,OnExtraImageApply,OnExtraIconClick); - if (db_get_b(NULL, MODULENAME, "StatusBarIcon", 1) && ServiceExists(MS_MSG_ADDICON)) { + if (db_get_b(NULL, MODULENAME, "StatusBarIcon", 1)) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; sid.flags = MBF_HIDDEN; sid.dwId = 1; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); } return 0; } -/**************************************************************************************** -* OnPreShutdown -* Drops all unused graphic stuff -*/ - -static int OnPreShutdown(WPARAM wParam, LPARAM lParam) -{ - if (ServiceExists(MS_MSG_REMOVEICON)) { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULENAME; - sid.dwId = 1; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - } - - return 0; -} - void InitFingerModule() { HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); CreateServiceFunction(MS_FP_SAMECLIENTS, ServiceSameClientsA); CreateServiceFunction(MS_FP_GETCLIENTICON, ServiceGetClientIconA); diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 0e96e3ad6f..43518e17b2 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst; -static HANDLE hHooks[5]; int hLangpack; static PLUGININFOEX pluginInfoEx = @@ -85,37 +84,32 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) if (sweep == 0) sid.szTooltip = Translate("Keep all events"); else if (sweep == 1) - { sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); - } else if (sweep == 2) - { sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); - } else if (sweep == 3) - { sid.szTooltip = Translate("Delete all events"); - } + sid.flags = MBF_HIDDEN; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); sid.dwId = 1; sid.hIcon = LoadIconEx("act1"); sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); sid.flags = MBF_HIDDEN; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); sid.dwId = 2; sid.hIcon = LoadIconEx("act2"); sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); sid.flags = MBF_HIDDEN; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); sid.dwId = 3; sid.hIcon = LoadIconEx("actDel"); sid.szTooltip = Translate("Delete all events"); sid.flags = MBF_HIDDEN; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); // for new contacts for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { @@ -133,8 +127,8 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) } } - hHooks[2] = HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); - hHooks[3] = HookEvent(ME_MSG_ICONPRESSED, OnIconPressed); + HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); + HookEvent(ME_MSG_ICONPRESSED, OnIconPressed); return 0; } @@ -146,11 +140,10 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void) { - mir_getLP(&pluginInfoEx); - hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hHooks[1] = HookEvent(ME_OPT_INITIALISE, HSOptInitialise); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_OPT_INITIALISE, HSOptInitialise); InitIcons(); @@ -159,15 +152,6 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void) { - int i; - ShutdownAction(); - - for (i = 0; i < SIZEOF(hHooks); i++) - { - if (hHooks[i]) - UnhookEvent(hHooks[i]); - } - return 0; } \ No newline at end of file diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index 030a534b28..cb73e3a448 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -251,12 +251,12 @@ void InitSRMM() { sid.hIconDisabled = hIconNotSecure; sid.flags = MBF_DISABLED | MBF_HIDDEN; sid.szTooltip = Translate(LANG_OTR_TOOLTIP); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); sid.dwId = 1; sid.hIcon = hIconPrivate; sid.hIconDisabled = hIconUnverified; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); // hook the window events so that we can can change the status of the icon diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 46a0aaa475..01bf91848c 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -124,26 +124,21 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1)) InitCheck(); InitIconLib(); - if(ServiceExists(MS_MSG_ADDICON)) - { - HICON IconLibGetIcon(const char* ident); - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); - sid.szModule = szGPGModuleName; - sid.flags = MBF_HIDDEN; - sid.dwId = 0x00000001; - sid.hIcon = IconLibGetIcon("secured"); - sid.szTooltip = Translate("GPG Turn off encryption"); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - ZeroMemory(&sid, sizeof(sid)); - sid.cbSize = sizeof(sid); - sid.szModule = szGPGModuleName; - sid.flags = MBF_HIDDEN; - sid.dwId = 0x00000002; - sid.hIcon = IconLibGetIcon("unsecured"); - sid.szTooltip = Translate("GPG Turn on encryption"); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - } + + HICON IconLibGetIcon(const char* ident); + + StatusIconData sid = { sizeof(sid) }; + sid.szModule = szGPGModuleName; + sid.flags = MBF_HIDDEN; + sid.dwId = 0x00000001; + sid.hIcon = IconLibGetIcon("secured"); + sid.szTooltip = Translate("GPG Turn off encryption"); + Srmm_AddIcon(&sid); + + sid.dwId = 0x00000002; + sid.hIcon = IconLibGetIcon("unsecured"); + sid.szTooltip = Translate("GPG Turn on encryption"); + Srmm_AddIcon(&sid); bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0; diff --git a/plugins/NoHistory/src/common.h b/plugins/NoHistory/src/common.h index d00d444593..549eaaddb0 100644 --- a/plugins/NoHistory/src/common.h +++ b/plugins/NoHistory/src/common.h @@ -31,8 +31,6 @@ extern HINSTANCE hInst; #endif - void SrmmMenu_Load(); -void SrmmMenu_Unload(); diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 1d8caa5cd8..0e7193c9b3 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -239,27 +239,22 @@ int IconPressed(WPARAM wParam, LPARAM lParam) // add icon to srmm status icons void SrmmMenu_Load() { - if ( ServiceExists(MS_MSG_ADDICON)) { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULE; - sid.flags = 0; - sid.dwId = 0; - - sid.szTooltip = Translate("History Enabled"); - sid.hIcon = sid.hIconDisabled = hIconKeep; - - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODULE; - sid.dwId = 1; - sid.szTooltip = Translate("History Disabled"); - sid.hIcon = sid.hIconDisabled = hIconRemove; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + sid.dwId = 0; + sid.szTooltip = Translate("History Enabled"); + sid.hIcon = sid.hIconDisabled = hIconKeep; + Srmm_AddIcon(&sid); + sid.dwId = 1; + sid.szTooltip = Translate("History Disabled"); + sid.hIcon = sid.hIconDisabled = hIconRemove; + Srmm_AddIcon(&sid); - // hook the window events so that we can can change the status of the icon - HookEvent(ME_MSG_WINDOWEVENT, WindowEvent); - HookEvent(ME_MSG_ICONPRESSED, IconPressed); - } + // hook the window events so that we can can change the status of the icon + HookEvent(ME_MSG_WINDOWEVENT, WindowEvent); + HookEvent(ME_MSG_ICONPRESSED, IconPressed); } int ModulesLoaded(WPARAM wParam, LPARAM lParam) diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index e7199dae36..8ec040ab6c 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -326,7 +326,6 @@ MIRAPI PLUGININFOEX* MirandaPluginInfoEx(DWORD) //called before the app goes into shutdown routine to make sure everyone is happy to exit static int OkToExit(WPARAM, LPARAM) { - SrmmMenu_Unload(); closing = TRUE; StopPopupThread(); return 0; diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 32f207e8c4..06456618cc 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -37,62 +37,37 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam); void SrmmMenu_Load() { - if (ServiceExists(MS_MSG_ADDICON)) - { - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); - sid.szModule = MODULNAME; - sid.flags = 0; - - sid.dwId = 0; - sid.szTooltip = Translate("Popup Mode: Auto"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON,0); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - - sid.dwId = 1; - sid.szTooltip = Translate("Popup Mode: Favourite"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV,0); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - - sid.dwId = 2; - sid.szTooltip = Translate("Popup Mode: Ignore fullscreen"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN,0); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - - sid.dwId = 3; - sid.szTooltip = Translate("Popup Mode: Block contact"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - - HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick); - HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent); - } -} - -void SrmmMenu_Unload() -{ - if (ServiceExists(MS_MSG_REMOVEICON)) - { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULNAME; - - sid.dwId = 0; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - - sid.dwId = 1; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - - sid.dwId = 2; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODULNAME; - sid.dwId = 3; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - } + sid.dwId = 0; + sid.szTooltip = Translate("Popup Mode: Auto"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON,0); + Srmm_AddIcon(&sid); + + sid.dwId = 1; + sid.szTooltip = Translate("Popup Mode: Favourite"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV,0); + Srmm_AddIcon(&sid); + + sid.dwId = 2; + sid.szTooltip = Translate("Popup Mode: Ignore fullscreen"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN,0); + Srmm_AddIcon(&sid); + + sid.dwId = 3; + sid.szTooltip = Translate("Popup Mode: Block contact"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0); + Srmm_AddIcon(&sid); + + HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick); + HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent); } static void SrmmMenu_UpdateIcon(HANDLE hContact) { - if (!hContact) return; + if (!hContact) + return; int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); @@ -100,8 +75,7 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact) sid.cbSize = sizeof(sid); sid.szModule = MODULNAME; - for (int i=0; i < 4; ++i) - { + for (int i=0; i < 4; ++i) { sid.dwId = i; sid.flags = (i == mode) ? 0 : MBF_HIDDEN; CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid); @@ -112,15 +86,14 @@ static int SrmmMenu_ProcessEvent(WPARAM, LPARAM lParam) { MessageWindowEventData *mwevent = (MessageWindowEventData *)lParam; - if ( mwevent->uType == MSG_WINDOW_EVT_OPEN ) - { + if (mwevent->uType == MSG_WINDOW_EVT_OPEN) { if (!hDialogsList) hDialogsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); WindowList_Add(hDialogsList, mwevent->hwndWindow, mwevent->hContact); SrmmMenu_UpdateIcon(mwevent->hContact); } - else if ( mwevent->uType == MSG_WINDOW_EVT_CLOSING ) + else if (mwevent->uType == MSG_WINDOW_EVT_CLOSING) { if (hDialogsList) WindowList_Remove(hDialogsList, mwevent->hwndWindow); @@ -139,8 +112,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); - if (sicd->flags&MBCF_RIGHTBUTTON) - { + if (sicd->flags & MBCF_RIGHTBUTTON) { HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_AUTO, TranslateT("Auto")); @@ -157,8 +129,8 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) db_set_b(hContact, MODULNAME, "ShowMode", mode-1); SrmmMenu_UpdateIcon(hContact); } - } else - { + } + else { db_set_b(hContact, MODULNAME, "ShowMode", (mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO); SrmmMenu_UpdateIcon(hContact); } diff --git a/plugins/Popup/src/srmm_menu.h b/plugins/Popup/src/srmm_menu.h index c64d3b303c..67ea73cc12 100644 --- a/plugins/Popup/src/srmm_menu.h +++ b/plugins/Popup/src/srmm_menu.h @@ -25,6 +25,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __srmm_menu_h__ void SrmmMenu_Load(); -void SrmmMenu_Unload(); #endif // __srmm_menu_h__ diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 26600238b0..7b58fba856 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -376,8 +376,7 @@ static void RegisterStatusIcons() sid.hIcon = CopyIcon(GetCachedIcon("scriver_TYPING")); sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_TYPINGOFF")); sid.flags = MBF_HIDDEN; - sid.szTooltip = NULL; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); + Srmm_AddIcon(&sid); } void ChangeStatusIcons() diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index b530c3ebe3..a51cdd22d5 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -91,9 +91,8 @@ int DeinitStatusIcons() int GetStatusIconsCount(HANDLE hContact) { - StatusIconData *si; int nIcon = 0; - while ((si = (StatusIconData*)CallService(MS_MSG_GETNTHICON, (WPARAM)hContact, nIcon)) != NULL) + while ( CallService(MS_MSG_GETNTHICON, (WPARAM)hContact, nIcon) != NULL) nIcon++; return nIcon; } diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 00eb331a93..81c66f45fd 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -379,7 +379,6 @@ int onSystemOKToExit(WPARAM, LPARAM) free_rtfconv(); DeinitNetlib(); - DeinitSRMMIcons(); return 0; } diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index fd330367db..405206621a 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -32,62 +32,39 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) void InitSRMMIcons() { // add icon to srmm status icons - if (ServiceExists(MS_MSG_ADDICON)) { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULENAME; - sid.flags = MBF_DISABLED|MBF_HIDDEN; - // Native - sid.dwId = MODE_NATIVE; - sid.hIcon = mode2icon(MODE_NATIVE|SECURED,3); - sid.hIconDisabled = mode2icon(MODE_NATIVE,3); - sid.szTooltip = Translate("SecureIM [Native]"); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - // PGP - sid.dwId = MODE_PGP; - sid.hIcon = mode2icon(MODE_PGP|SECURED,3); - sid.hIconDisabled = mode2icon(MODE_PGP,3); - sid.szTooltip = Translate("SecureIM [PGP]"); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - // GPG - sid.dwId = MODE_GPG; - sid.hIcon = mode2icon(MODE_GPG|SECURED,3); - sid.hIconDisabled = mode2icon(MODE_GPG,3); - sid.szTooltip = Translate("SecureIM [GPG]"); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - // RSAAES - sid.dwId = MODE_RSAAES; - sid.hIcon = mode2icon(MODE_RSAAES|SECURED,3); - sid.hIconDisabled = mode2icon(MODE_RSAAES,3); - sid.szTooltip = Translate("SecureIM [RSA/AES]"); - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - - // hook the window events so that we can can change the status of the icon - HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent); - HookEvent(ME_MSG_ICONPRESSED, onIconPressed); - } -} + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODULENAME; + sid.flags = MBF_DISABLED|MBF_HIDDEN; + // Native + sid.dwId = MODE_NATIVE; + sid.hIcon = mode2icon(MODE_NATIVE|SECURED,3); + sid.hIconDisabled = mode2icon(MODE_NATIVE,3); + sid.szTooltip = Translate("SecureIM [Native]"); + Srmm_AddIcon(&sid); + // PGP + sid.dwId = MODE_PGP; + sid.hIcon = mode2icon(MODE_PGP|SECURED,3); + sid.hIconDisabled = mode2icon(MODE_PGP,3); + sid.szTooltip = Translate("SecureIM [PGP]"); + Srmm_AddIcon(&sid); + // GPG + sid.dwId = MODE_GPG; + sid.hIcon = mode2icon(MODE_GPG|SECURED,3); + sid.hIconDisabled = mode2icon(MODE_GPG,3); + sid.szTooltip = Translate("SecureIM [GPG]"); + Srmm_AddIcon(&sid); + // RSAAES + sid.dwId = MODE_RSAAES; + sid.hIcon = mode2icon(MODE_RSAAES|SECURED,3); + sid.hIconDisabled = mode2icon(MODE_RSAAES,3); + sid.szTooltip = Translate("SecureIM [RSA/AES]"); + Srmm_AddIcon(&sid); -void DeinitSRMMIcons() -{ - // remove srmm status icons - if (ServiceExists(MS_MSG_REMOVEICON)) { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULENAME; - // Native - sid.dwId = MODE_NATIVE; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - // PGP - sid.dwId = MODE_PGP; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - // GPG - sid.dwId = MODE_GPG; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - // RSAAES - sid.dwId = MODE_RSAAES; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid); - } + // hook the window events so that we can can change the status of the icon + HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent); + HookEvent(ME_MSG_ICONPRESSED, onIconPressed); } // EOF diff --git a/plugins/SecureIM/src/svcs_srmm.h b/plugins/SecureIM/src/svcs_srmm.h index 8334a4dd7d..8de1d07b98 100644 --- a/plugins/SecureIM/src/svcs_srmm.h +++ b/plugins/SecureIM/src/svcs_srmm.h @@ -2,6 +2,5 @@ #define __SVCS_SRMM_H__ void InitSRMMIcons(); -void DeinitSRMMIcons(); #endif diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index ef633af616..4e4782d740 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -98,12 +98,6 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam) static int PreShutdown(WPARAM wParam, LPARAM lParam) { - if (ServiceExists(MS_MSG_REMOVEICON)) { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULE_NAME; - CallService(MS_MSG_REMOVEICON, 0, (LPARAM) &sid); - } - mir_free(dictionariesFolder); mir_free(customDictionariesFolder); mir_free(flagsDllFolder); @@ -211,30 +205,27 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) CreateServiceFunction(MS_SPELLCHECKER_REMOVE_RICHEDIT, RemoveContactTextBoxService); CreateServiceFunction(MS_SPELLCHECKER_SHOW_POPUP_MENU, ShowPopupMenuService); - if (ServiceExists(MS_MSG_ADDICON)) { - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULE_NAME; - sid.hIconDisabled = Skin_GetIcon("spellchecker_disabled"); - sid.flags = MBF_HIDDEN; + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODULE_NAME; + sid.hIconDisabled = Skin_GetIcon("spellchecker_disabled"); + sid.flags = MBF_HIDDEN; - for (int i = 0; i < languages.getCount(); i++) { - sid.dwId = i; + for (int i = 0; i < languages.getCount(); i++) { + sid.dwId = i; - char tmp[128]; - mir_snprintf(tmp, SIZEOF(tmp), "%s - %S", - Translate("Spell Checker"), languages[i]->full_name); - sid.szTooltip = tmp; + char tmp[128]; + mir_snprintf(tmp, SIZEOF(tmp), "%s - %S", + Translate("Spell Checker"), languages[i]->full_name); + sid.szTooltip = tmp; - HICON hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); - sid.hIcon = CopyIcon(hIcon); - Skin_ReleaseIcon(hIcon); + HICON hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); + sid.hIcon = CopyIcon(hIcon); + Skin_ReleaseIcon(hIcon); - CallService(MS_MSG_ADDICON, 0, (LPARAM) &sid); - } + Srmm_AddIcon(&sid); } - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = "Spell Checker/Toggle"; hkd.pszSection = LPGEN("Spell Checker"); hkd.pszDescription = LPGEN("Enable/disable spell checker"); diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 75cdf0f5cf..19375c7fb7 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -329,6 +329,12 @@ MsgWndData::MsgWndData(HWND hwnd, HANDLE hContact) { m_hwnd = hwnd; m_hContact = hContact; m_countryID = (int)ServiceDetectContactOriginCountry((WPARAM)m_hContact,0); + + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODNAMEFLAGS; + sid.flags = MBF_HIDDEN; + Srmm_AddIcon(&sid); + FlagsIconUpdate(); } @@ -344,8 +350,7 @@ void MsgWndData::FlagsIconSet() sid.szModule = MODNAMEFLAGS; sid.hIconDisabled = sid.hIcon = LoadFlagIcon(m_countryID); sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,m_countryID,0)); - if(CallService(MS_MSG_MODIFYICON,(WPARAM)m_hContact,(LPARAM)&sid) !=0) /* not yet registered? */ - CallService(MS_MSG_ADDICON,0,(LPARAM)&sid); + CallService(MS_MSG_MODIFYICON, (WPARAM)m_hContact, (LPARAM)&sid); } } @@ -369,7 +374,8 @@ static int CompareIconListData(const IconList* p1, const IconList* p2) } static OBJLIST gIListMW(10, CompareIconListData); -IconList::IconList(StatusIconData *sid) { +IconList::IconList(StatusIconData *sid) +{ m_StatusIconData.cbSize = sid->cbSize; m_StatusIconData.szModule = mir_strdup(sid->szModule); m_StatusIconData.dwId = sid->dwId; @@ -379,13 +385,15 @@ IconList::IconList(StatusIconData *sid) { m_StatusIconData.szTooltip = mir_strdup(sid->szTooltip); m_ID = sid->dwId; - CallService(MS_MSG_ADDICON,0,(LPARAM)sid); + Srmm_AddIcon(sid); } -IconList::~IconList() { +IconList::~IconList() +{ mir_free(m_StatusIconData.szModule); mir_free(m_StatusIconData.szTooltip); } + // const char *pszName; // [Optional] Name of an icon registered with icolib to be used in GUI. static __inline int MessageAPI_AddIcon(const char* pszName, const char* szModul/*StatusIconData *sid*/,int ID, int flags, const char* szTooltip) { diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index cc4e12f945..d353c585a8 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -70,7 +70,7 @@ static int OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { myGlobals.PopUpActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); - myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_ADDICON); + myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_MODIFYICON); // init meta contacts INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); -- cgit v1.2.3