diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-04-09 16:57:04 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-04-09 16:57:04 +0000 |
commit | a7200235833ec502c4a1641565b21d6dd88ea417 (patch) | |
tree | d3621de103fd57a2a2d44b4410d7029d87b45c63 /plugins/SecureIM | |
parent | 5a88ed3957a993b931128682a243de3db0a961c8 (diff) |
-remove SRMM icons on exit (fixes #310)
git-svn-id: http://svn.miranda-ng.org/main/trunk@4399 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r-- | plugins/SecureIM/src/main.cpp | 43 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_srmm.cpp | 62 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_srmm.h | 4 |
3 files changed, 68 insertions, 41 deletions
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 531ea39a96..00eb331a93 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -125,14 +125,14 @@ extern "C" __declspec(dllexport) int __cdecl Unload() return 0;
}
-int ModuleLoad(WPARAM wParam, LPARAM lParam)
+int ModuleLoad(WPARAM, LPARAM)
{
bPopupExists = ServiceExists(MS_POPUP_ADDPOPUP);
bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT);
return 0;
}
-int onModulesLoaded(WPARAM wParam, LPARAM lParam)
+int onModulesLoaded(WPARAM, LPARAM)
{
InitNetlib();
@@ -355,45 +355,11 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
}
- // add icon to srmm status icons
- if (ServiceExists(MS_MSG_ADDICON)) {
- StatusIconData sid = { sizeof(sid) };
- sid.szModule = (char*)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);
- }
-
+ InitSRMMIcons();
return 0;
}
-int onSystemOKToExit(WPARAM wParam, LPARAM lParam)
+int onSystemOKToExit(WPARAM, LPARAM)
{
if (bSavePass) {
LPSTR tmp = gpg_get_passphrases();
@@ -413,6 +379,7 @@ int onSystemOKToExit(WPARAM wParam, LPARAM lParam) free_rtfconv();
DeinitNetlib();
+ DeinitSRMMIcons();
return 0;
}
diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index bebe781c3f..fd330367db 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -1,6 +1,6 @@ #include "commonheaders.h"
-int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam)
+int __cdecl onWindowEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *mwd = (MessageWindowEventData *)lParam;
if (mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING)
@@ -29,5 +29,65 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) return 0;
}
+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);
+ }
+}
+
+
+
+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);
+ }
+}
// EOF
diff --git a/plugins/SecureIM/src/svcs_srmm.h b/plugins/SecureIM/src/svcs_srmm.h index 5d85abcfe3..1c5bb5e705 100644 --- a/plugins/SecureIM/src/svcs_srmm.h +++ b/plugins/SecureIM/src/svcs_srmm.h @@ -1,7 +1,7 @@ #ifndef __SVCS_SRMM_H__
#define __SVCS_SRMM_H__
-int __cdecl onWindowEvent(WPARAM,LPARAM);
-int __cdecl onIconPressed(WPARAM,LPARAM);
+void InitSRMMIcons();
+void UninitSRMMIcons();
#endif
|