From 4810d4b1b7a47701b8e6c45490fb2643ea425123 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 23:13:56 +0000 Subject: rest of menu cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4325 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/init.cpp | 24 ++++++++++++------------ plugins/New_GPG/src/utilities.cpp | 9 +++++---- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'plugins/New_GPG/src') diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index af83770a2d..2c9f05b3e8 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -24,7 +24,8 @@ list Accounts; HINSTANCE hInst; HFONT bold_font = NULL; -HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL; +HANDLE hLoadPubKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL; +HGENMENU hSendKey = NULL, hToggleEncryption = NULL; RECT key_from_keyserver_rect = {0}, firstrun_rect = {0}, new_key_rect = {0}, key_gen_rect = {0}, load_key_rect = {0}, import_key_rect = {0}, key_password_rect = {0}, load_existing_key_rect = {0}; XML_API xi = {0}; int hLangpack = 0; @@ -67,21 +68,21 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); void init_vars() { - bAppendTags = db_get_b(NULL, szGPGModuleName, "bAppendTags", 0); - bStripTags = db_get_b(NULL, szGPGModuleName, "bStripTags", 0); + bAppendTags = db_get_b(NULL, szGPGModuleName, "bAppendTags", 0) != 0; + bStripTags = db_get_b(NULL, szGPGModuleName, "bStripTags", 0) != 0; inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("")); inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("")); outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("")); outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("")); - bDebugLog = db_get_b(NULL, szGPGModuleName, "bDebugLog", 0); - bAutoExchange = db_get_b(NULL, szGPGModuleName, "bAutoExchange", 0); - bSameAction = db_get_b(NULL, szGPGModuleName, "bSameAction", 0); + bDebugLog = db_get_b(NULL, szGPGModuleName, "bDebugLog", 0) != 0; + bAutoExchange = db_get_b(NULL, szGPGModuleName, "bAutoExchange", 0) != 0; + bSameAction = db_get_b(NULL, szGPGModuleName, "bSameAction", 0) != 0; password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); debuglog.init(); - bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001?true:false; - bJabberAPI = db_get_b(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0); - bPresenceSigning = db_get_b(NULL, szGPGModuleName, "bPresenceSigning", 0); - bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0); + bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001; + bJabberAPI = db_get_b(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09) != 0; + bPresenceSigning = db_get_b(NULL, szGPGModuleName, "bPresenceSigning", 0) != 0; + bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0) != 0; firstrun_rect.left = db_get_dw(NULL, szGPGModuleName, "FirstrunWindowX", 0); firstrun_rect.top = db_get_dw(NULL, szGPGModuleName, "FirstrunWindowY", 0); key_password_rect.left = db_get_dw(NULL, szGPGModuleName, "PasswordWindowX", 0); @@ -144,8 +145,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); } - - bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT); + bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0; if(bJabberAPI && bIsMiranda09) GetJabberInterface(0,0); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 4dd31b3a1a..51f9bb8312 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -192,7 +192,8 @@ INT_PTR SendKey(WPARAM w, LPARAM l) return 0; } -extern HANDLE hLoadPublicKey, hToggleEncryption, hSendKey; +extern HANDLE hLoadPublicKey; +extern HGENMENU hToggleEncryption, hSendKey; INT_PTR ToggleEncryption(WPARAM w, LPARAM l) { @@ -227,7 +228,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME; enc?mi.pszName="Turn off GPG encryption":mi.pszName="Turn on GPG encryption"; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi); + Menu_ModifyItem(hToggleEncryption, &mi); return 0; } @@ -260,7 +261,7 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) mir_sntprintf(buf, 127 * sizeof(TCHAR), _T("%s: %s"), TranslateT("Send publick key"), toUTF16(keyid).c_str()); mi2.ptszName = buf; mi2.flags = CMIM_NAME | CMIF_TCHAR; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSendKey, (LPARAM)&mi2); + Menu_ModifyItem(hSendKey, &mi2); } CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME; @@ -273,7 +274,7 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) else mi.flags = CMIM_NAME | CMIM_FLAGS; mi.pszName = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption"; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi); + Menu_ModifyItem(hToggleEncryption, &mi); return 0; } -- cgit v1.2.3