diff options
Diffstat (limited to 'plugins/SecureIM/src/main.cpp')
-rw-r--r-- | plugins/SecureIM/src/main.cpp | 294 |
1 files changed, 130 insertions, 164 deletions
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 87370c7260..3c3d08aa64 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -16,27 +16,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfoEx;
}
-void AddServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) {
-
- g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1));
- g_hService[iService] = CreateServiceFunction(serviceName, serviceFunction);
- iService++;
-}
-
-void AddProtoServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction)
-{
- g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1));
- g_hService[iService] = CreateProtoServiceFunction(szModuleName, serviceName, serviceFunction);
- iService++;
-}
-
-void AddHookFunction(LPCSTR eventName, MIRANDAHOOK hookFunction)
-{
- g_hHook = (HANDLE*) mir_realloc(g_hHook,sizeof(HANDLE)*(iHook+1));
- g_hHook[iHook] = HookEvent(eventName, hookFunction);
- iHook++;
-}
-
HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
@@ -102,7 +81,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) // load crypo++ dll
if ( !loadlib()) {
- msgbox1(0,sim107,szModuleName,MB_OK|MB_ICONSTOP);
+ msgbox1(0,sim107,MODULENAME,MB_OK|MB_ICONSTOP);
return 1;
}
@@ -110,33 +89,33 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) // register plugin module
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
- pd.szName = (char*)szModuleName;
+ pd.szName = (char*)MODULENAME;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
// hook events
- AddHookFunction(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- AddHookFunction(ME_SYSTEM_OKTOEXIT, onSystemOKToExit);
- AddHookFunction(ME_SYSTEM_MODULELOAD, ModuleLoad);
- AddHookFunction(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_SYSTEM_OKTOEXIT, onSystemOKToExit);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled");
g_hEvent[1] = CreateHookableEvent(MODULENAME"/Established");
- AddServiceFunction(MODULENAME"/IsContactSecured",Service_IsContactSecured);
- AddServiceFunction(MODULENAME"/SIM_EST",Service_CreateIM);
- AddServiceFunction(MODULENAME"/SIM_DIS",Service_DisableIM);
- AddServiceFunction(MODULENAME"/SIM_ST_DIS",Service_StatusDis);
- AddServiceFunction(MODULENAME"/SIM_ST_ENA",Service_StatusEna);
- AddServiceFunction(MODULENAME"/SIM_ST_TRY",Service_StatusTry);
- AddServiceFunction(MODULENAME"/PGP_SET",Service_PGPsetKey);
- AddServiceFunction(MODULENAME"/PGP_DEL",Service_PGPdelKey);
- AddServiceFunction(MODULENAME"/GPG_SET",Service_GPGsetKey);
- AddServiceFunction(MODULENAME"/GPG_DEL",Service_GPGdelKey);
- AddServiceFunction(MODULENAME"/MODE_NAT",Service_ModeNative);
- AddServiceFunction(MODULENAME"/MODE_PGP",Service_ModePGP);
- AddServiceFunction(MODULENAME"/MODE_GPG",Service_ModeGPG);
- AddServiceFunction(MODULENAME"/MODE_RSA",Service_ModeRSAAES);
+ CreateServiceFunction(MODULENAME"/IsContactSecured",Service_IsContactSecured);
+ CreateServiceFunction(MODULENAME"/SIM_EST",Service_CreateIM);
+ CreateServiceFunction(MODULENAME"/SIM_DIS",Service_DisableIM);
+ CreateServiceFunction(MODULENAME"/SIM_ST_DIS",Service_StatusDis);
+ CreateServiceFunction(MODULENAME"/SIM_ST_ENA",Service_StatusEna);
+ CreateServiceFunction(MODULENAME"/SIM_ST_TRY",Service_StatusTry);
+ CreateServiceFunction(MODULENAME"/PGP_SET",Service_PGPsetKey);
+ CreateServiceFunction(MODULENAME"/PGP_DEL",Service_PGPdelKey);
+ CreateServiceFunction(MODULENAME"/GPG_SET",Service_GPGsetKey);
+ CreateServiceFunction(MODULENAME"/GPG_DEL",Service_GPGdelKey);
+ CreateServiceFunction(MODULENAME"/MODE_NAT",Service_ModeNative);
+ CreateServiceFunction(MODULENAME"/MODE_PGP",Service_ModePGP);
+ CreateServiceFunction(MODULENAME"/MODE_GPG",Service_ModeGPG);
+ CreateServiceFunction(MODULENAME"/MODE_RSA",Service_ModeRSAAES);
return 0;
}
@@ -156,75 +135,73 @@ int ModuleLoad(WPARAM wParam, LPARAM lParam) int onModulesLoaded(WPARAM wParam, LPARAM lParam)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
- InitNetlib();
- Sent_NetLog("onModuleLoaded begin");
+ InitNetlib();
+ Sent_NetLog("onModuleLoaded begin");
#endif
- g_hFolders = FoldersRegisterCustomPathT(szModuleName, LPGEN("Icons"), _T(MIRANDA_PATH"\\icons"));
+ g_hFolders = FoldersRegisterCustomPathT(MODULENAME, LPGEN("Icons"), _T(MIRANDA_PATH"\\icons"));
- InitIcons();
- GetFlags();
- ModuleLoad(0, 0);
+ InitIcons();
+ GetFlags();
+ ModuleLoad(0, 0);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_init");
#endif
- { // RSA/AES
- rsa_init(&exp,&imp);
-
- DBVARIANT dbv;
- dbv.type = DBVT_BLOB;
+ // RSA/AES
+ rsa_init(&exp, &imp);
- if ( DBGetContactSetting(0,szModuleName,"rsa_priv",&dbv) == 0 ) {
- exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
- rsa_4096=1;
- }
- else
- if ( DBGetContactSetting(0,szModuleName,"rsa_priv_4096",&dbv) == 0 ) {
- exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
+ DBVARIANT dbv;
+ dbv.type = DBVT_BLOB;
- char priv_key[4096]; int priv_len;
- char pub_key[4096]; int pub_len;
+ if ( DBGetContactSetting(0,MODULENAME,"rsa_priv",&dbv) == 0 ) {
+ exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
+ DBFreeVariant(&dbv);
+ rsa_4096=1;
+ }
+ else if ( DBGetContactSetting(0,MODULENAME,"rsa_priv_4096",&dbv) == 0 ) {
+ exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
+ DBFreeVariant(&dbv);
- DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
- cws.value.type = DBVT_BLOB;
+ char priv_key[4096]; int priv_len;
+ char pub_key[4096]; int pub_len;
- exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
+ DBCONTACTWRITESETTING cws;
+ cws.szModule = MODULENAME;
+ cws.value.type = DBVT_BLOB;
- cws.szSetting = "rsa_priv";
- cws.value.pbVal = (PBYTE)&priv_key;
- cws.value.cpbVal = priv_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
- cws.szSetting = "rsa_pub";
- cws.value.pbVal = (PBYTE)&pub_key;
- cws.value.cpbVal = pub_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ cws.szSetting = "rsa_priv";
+ cws.value.pbVal = (PBYTE)&priv_key;
+ cws.value.cpbVal = priv_len;
+ CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- DBDeleteContactSetting(0, szModuleName, "rsa_priv_2048");
- DBDeleteContactSetting(0, szModuleName, "rsa_pub_2048");
- rsa_4096 = 1;
- }
+ cws.szSetting = "rsa_pub";
+ cws.value.pbVal = (PBYTE)&pub_key;
+ cws.value.cpbVal = pub_len;
+ CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- if ( !rsa_4096 ) {
- unsigned int tID;
- CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttGenerateRSA, NULL, 0, &tID));
- }
+ db_unset(0, MODULENAME, "rsa_priv_2048");
+ db_unset(0, MODULENAME, "rsa_pub_2048");
+ rsa_4096 = 1;
+ }
- exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10));
+ if ( !rsa_4096 ) {
+ unsigned int tID;
+ CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttGenerateRSA, NULL, 0, &tID));
}
+ exp->rsa_set_timeout( DBGetContactSettingWord(0,MODULENAME,"ket",10));
+
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("pgp_init");
#endif
- bPGP = db_get_b(0, szModuleName, "pgp", 0);
+ bPGP = db_get_b(0, MODULENAME, "pgp", 0);
if (bPGP) { //PGP
bPGPloaded = pgp_init();
- bUseKeyrings = db_get_b(0,szModuleName,"ukr",1);
- LPSTR priv = myDBGetStringDecode(0,szModuleName,"pgpPrivKey");
+ bUseKeyrings = db_get_b(0,MODULENAME,"ukr",1);
+ LPSTR priv = myDBGetStringDecode(0,MODULENAME,"pgpPrivKey");
if (priv) {
bPGPprivkey = true;
if (bPGPloaded)
@@ -239,12 +216,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) }
else {
LPSTR tmp;
- tmp = myDBGetString(0,szModuleName,"pgpPubRing");
+ tmp = myDBGetString(0,MODULENAME,"pgpPubRing");
if (tmp) {
strncpy(PubRingPath,tmp,sizeof(PubRingPath));
mir_free(tmp);
}
- tmp = myDBGetString(0,szModuleName,"pgpSecRing");
+ tmp = myDBGetString(0,MODULENAME,"pgpSecRing");
if (tmp) {
strncpy(SecRingPath,tmp,sizeof(SecRingPath));
mir_free(tmp);
@@ -252,12 +229,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) if (PubRingPath[0] && SecRingPath[0]) {
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
if (bPGPkeyrings) {
- DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
- DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpPubRing",PubRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpSecRing",SecRingPath);
}
else {
- DBDeleteContactSetting(0, szModuleName, "pgpPubRing");
- DBDeleteContactSetting(0, szModuleName, "pgpSecRing");
+ db_unset(0, MODULENAME, "pgpPubRing");
+ db_unset(0, MODULENAME, "pgpSecRing");
}
}
}
@@ -267,37 +244,34 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("gpg_init");
#endif
- bGPG = db_get_b(0, szModuleName, "gpg", 0);
+ bGPG = db_get_b(0, MODULENAME, "gpg", 0);
if (bGPG) { //GPG
-
- LPSTR tmp;
-
bGPGloaded = gpg_init();
- char gpgexec[MAX_PATH], gpghome[MAX_PATH];
- gpgexec[0]='\0'; gpghome[0]='\0';
+ char gpgexec[MAX_PATH], gpghome[MAX_PATH];
+ gpgexec[0]='\0'; gpghome[0]='\0';
- tmp = myDBGetString(0,szModuleName,"gpgExec");
+ LPSTR tmp = myDBGetString(0,MODULENAME,"gpgExec");
if (tmp) {
strncpy(gpgexec,tmp,sizeof(gpgexec));
mir_free(tmp);
}
- tmp = myDBGetString(0,szModuleName,"gpgHome");
+ tmp = myDBGetString(0,MODULENAME,"gpgHome");
if (tmp) {
strncpy(gpghome,tmp,sizeof(gpghome));
mir_free(tmp);
}
- if (db_get_b(0, szModuleName, "gpgLogFlag",0)) {
- tmp = myDBGetString(0,szModuleName,"gpgLog");
+ if (db_get_b(0, MODULENAME, "gpgLogFlag",0)) {
+ tmp = myDBGetString(0,MODULENAME,"gpgLog");
if (tmp) {
gpg_set_log(tmp);
mir_free(tmp);
}
}
- if (db_get_b(0, szModuleName, "gpgTmpFlag",0)) {
- tmp = myDBGetString(0,szModuleName,"gpgTmp");
+ if (db_get_b(0, MODULENAME, "gpgTmpFlag",0)) {
+ tmp = myDBGetString(0,MODULENAME,"gpgTmp");
if (tmp) {
gpg_set_tmp(tmp);
mir_free(tmp);
@@ -306,17 +280,17 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) bGPGkeyrings = gpg_open_keyrings(gpgexec,gpghome);
if (bGPGkeyrings) {
- DBWriteContactSettingString(0,szModuleName,"gpgExec",gpgexec);
- DBWriteContactSettingString(0,szModuleName,"gpgHome",gpghome);
+ DBWriteContactSettingString(0,MODULENAME,"gpgExec",gpgexec);
+ DBWriteContactSettingString(0,MODULENAME,"gpgHome",gpghome);
}
else {
- DBDeleteContactSetting(0, szModuleName, "gpgExec");
- DBDeleteContactSetting(0, szModuleName, "gpgHome");
+ db_unset(0, MODULENAME, "gpgExec");
+ db_unset(0, MODULENAME, "gpgHome");
}
- bSavePass = db_get_b(0,szModuleName,"gpgSaveFlag",0);
+ bSavePass = db_get_b(0,MODULENAME,"gpgSaveFlag",0);
if (bSavePass) {
- tmp = myDBGetString(0,szModuleName,"gpgSave");
+ tmp = myDBGetString(0,MODULENAME,"gpgSave");
if (tmp) {
gpg_set_passphrases(tmp);
mir_free(tmp);
@@ -343,24 +317,24 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("hook events");
#endif
- AddHookFunction(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
- g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
+ g_hCLIcon = ExtraIcon_Register(MODULENAME, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
// hook init options
- AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions);
+ HookEvent(ME_OPT_INITIALISE, onRegisterOptions);
if (bPopupExists)
- AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
- AddHookFunction(ME_PROTO_ACK, onProtoAck);
- AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
- AddHookFunction(ME_DB_CONTACT_ADDED, onContactAdded);
- AddHookFunction(ME_DB_CONTACT_DELETED, onContactDeleted);
+ HookEvent(ME_OPT_INITIALISE, onRegisterPopOptions);
+ HookEvent(ME_PROTO_ACK, onProtoAck);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
+ HookEvent(ME_DB_CONTACT_ADDED, onContactAdded);
+ HookEvent(ME_DB_CONTACT_DELETED, onContactDeleted);
// hook message transport
- AddProtoServiceFunction(PSR_MESSAGE, onRecvMsg);
- AddProtoServiceFunction(PSS_MESSAGE, onSendMsg);
- AddProtoServiceFunction(PSS_MESSAGE"W", onSendMsgW);
- AddProtoServiceFunction(PSS_FILE, onSendFile);
+ CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, onRecvMsg);
+ CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, onSendMsg);
+ CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE"W", onSendMsgW);
+ CreateProtoServiceFunction(MODULENAME, PSS_FILE, onSendFile);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Native/RSA menu");
@@ -370,16 +344,16 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) g_hMenu[1] = AddMenuItem(sim302,110001,g_hICO[ICO_CM_DIS],MODULENAME"/SIM_DIS",CMIF_NOTOFFLINE);
if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
- g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
- g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
- g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
- g_hMenu[5] = AddSubItem(g_hMenu[2],sim232[2],110005,110002,MODULENAME"/SIM_ST_TRY");
+ g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
+ g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
+ g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
+ g_hMenu[5] = AddSubItem(g_hMenu[2],sim232[2],110005,110002,MODULENAME"/SIM_ST_TRY");
}
else {
- g_hMenu[2] = 0;
- g_hMenu[3] = AddMenuItem(sim232[0],110003,NULL,MODULENAME"/SIM_ST_DIS");
- g_hMenu[4] = AddMenuItem(sim232[1],110004,NULL,MODULENAME"/SIM_ST_ENA");
- g_hMenu[5] = AddMenuItem(sim232[2],110005,NULL,MODULENAME"/SIM_ST_TRY");
+ g_hMenu[2] = 0;
+ g_hMenu[3] = AddMenuItem(sim232[0],110003,NULL,MODULENAME"/SIM_ST_DIS");
+ g_hMenu[4] = AddMenuItem(sim232[1],110004,NULL,MODULENAME"/SIM_ST_ENA");
+ g_hMenu[5] = AddMenuItem(sim232[2],110005,NULL,MODULENAME"/SIM_ST_TRY");
}
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -393,42 +367,38 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) g_hMenu[7] = AddMenuItem(sim307,110007,icon,MODULENAME"/PGP_DEL",0);
}
- if (bGPGloaded) {
+ if (bGPGloaded) {
icon=mode2icon(MODE_GPG|SECURED,2);
g_hMenu[8] = AddMenuItem(sim308,110008,icon,MODULENAME"/GPG_SET",0);
icon=mode2icon(MODE_GPG,2);
g_hMenu[9] = AddMenuItem(sim309,110009,icon,MODULENAME"/GPG_DEL",0);
- }
+ }
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Mode menu");
#endif
if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
- g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
- g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
- g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
- g_hMenu[13] = AddSubItem(g_hMenu[10],sim231[2],110013,110010,MODULENAME"/MODE_GPG");
- g_hMenu[14] = AddSubItem(g_hMenu[10],sim231[3],110014,110010,MODULENAME"/MODE_RSA");
+ g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
+ g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
+ g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
+ g_hMenu[13] = AddSubItem(g_hMenu[10],sim231[2],110013,110010,MODULENAME"/MODE_GPG");
+ g_hMenu[14] = AddSubItem(g_hMenu[10],sim231[3],110014,110010,MODULENAME"/MODE_RSA");
}
else {
- g_hMenu[10] = 0;
- g_hMenu[11] = AddMenuItem(sim231[0],110011,NULL,MODULENAME"/MODE_NAT");
- g_hMenu[12] = AddMenuItem(sim231[1],110012,NULL,MODULENAME"/MODE_PGP");
- g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG");
- g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
+ g_hMenu[10] = 0;
+ g_hMenu[11] = AddMenuItem(sim231[0],110011,NULL,MODULENAME"/MODE_NAT");
+ g_hMenu[12] = AddMenuItem(sim231[1],110012,NULL,MODULENAME"/MODE_PGP");
+ g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG");
+ g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
}
-
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create srmm icons");
#endif
// add icon to srmm status icons
if (ServiceExists(MS_MSG_ADDICON)) {
-
- StatusIconData sid;
- memset(&sid,0,sizeof(sid));
- sid.cbSize = sizeof(sid);
- sid.szModule = (char*)szModuleName;
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = (char*)MODULENAME;
sid.flags = MBF_DISABLED|MBF_HIDDEN;
// Native
sid.dwId = MODE_NATIVE;
@@ -456,8 +426,8 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
// hook the window events so that we can can change the status of the icon
- AddHookFunction(ME_MSG_WINDOWEVENT, onWindowEvent);
- AddHookFunction(ME_MSG_ICONPRESSED, onIconPressed);
+ HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent);
+ HookEvent(ME_MSG_ICONPRESSED, onIconPressed);
}
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -466,26 +436,22 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) return 0;
}
-
int onSystemOKToExit(WPARAM wParam, LPARAM lParam)
{
- if (bSavePass) {
- LPSTR tmp = gpg_get_passphrases();
- DBWriteContactSettingString(0,szModuleName,"gpgSave",tmp);
- LocalFree(tmp);
- }
- else {
- DBDeleteContactSetting(0,szModuleName,"gpgSave");
- }
+ if (bSavePass) {
+ LPSTR tmp = gpg_get_passphrases();
+ DBWriteContactSettingString(0,MODULENAME,"gpgSave",tmp);
+ LocalFree(tmp);
+ }
+ else db_unset(0,MODULENAME,"gpgSave");
+
if (bPGPloaded) pgp_done();
if (bGPGloaded) gpg_done();
rsa_done();
- while(iHook--) UnhookEvent(g_hHook[iHook]);
- mir_free(g_hHook);
- while(iService--) DestroyServiceFunction(g_hService[iService]);
- mir_free(g_hService);
+
DestroyHookableEvent(g_hEvent[0]);
DestroyHookableEvent(g_hEvent[1]);
+
freeContactList();
free_rtfconv();
#if defined(_DEBUG) || defined(NETLIB_LOG)
|