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/SecureIM/src/main.cpp | 1 - plugins/SecureIM/src/svcs_srmm.cpp | 83 ++++++++++++++------------------------ plugins/SecureIM/src/svcs_srmm.h | 1 - 3 files changed, 30 insertions(+), 55 deletions(-) (limited to 'plugins/SecureIM') 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 -- cgit v1.2.3