From 854959cbc0a1bad2c086214be4d1a829b17a61f3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 1 Dec 2012 13:25:11 +0000 Subject: icolib: icon creation quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2588 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/commonheaders.cpp | 14 ++-- plugins/SecureIM/src/crypt_check.cpp | 6 +- plugins/SecureIM/src/crypt_dll.cpp | 18 ++--- plugins/SecureIM/src/crypt_lists.cpp | 10 +-- plugins/SecureIM/src/crypt_metacontacts.cpp | 10 +-- plugins/SecureIM/src/loadicons.cpp | 113 +++++++++++++++++----------- plugins/SecureIM/src/main.cpp | 66 ++++++++-------- plugins/SecureIM/src/mmi.cpp | 4 +- plugins/SecureIM/src/options.cpp | 80 ++++++++++---------- plugins/SecureIM/src/popupOptions.cpp | 12 +-- plugins/SecureIM/src/secureim.h | 37 --------- plugins/SecureIM/src/splitmsg.cpp | 4 +- plugins/SecureIM/src/svcs_clist.cpp | 2 +- plugins/SecureIM/src/svcs_menu.cpp | 30 ++++---- plugins/SecureIM/src/svcs_proto.cpp | 26 +++---- plugins/SecureIM/src/svcs_rsa.cpp | 8 +- plugins/SecureIM/src/svcs_srmm.cpp | 4 +- 17 files changed, 217 insertions(+), 227 deletions(-) (limited to 'plugins/SecureIM') diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index b76e322a17..7567ec2522 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -181,19 +181,19 @@ void InitNetlib() void DeinitNetlib() { - if(hNetlibUser) + if (hNetlibUser) CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0); } int Sent_NetLog(const char *fmt,...) { - va_list va; - char szText[1024]; + va_list va; + char szText[1024]; - va_start(va,fmt); - mir_vsnprintf(szText,sizeof(szText),fmt,va); - va_end(va); - return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText); + va_start(va,fmt); + mir_vsnprintf(szText,sizeof(szText),fmt,va); + va_end(va); + return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText); } #endif diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index ad15f3f9de..b1bb9512ce 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -35,7 +35,7 @@ BYTE isContactSecured(HANDLE hContact) { r=clist[j].mode; switch(r) { case MODE_NATIVE: - if(cpp_keyx(clist[j].cntx)!=0) r|=SECURED; + if (cpp_keyx(clist[j].cntx)!=0) r|=SECURED; break; case MODE_PGP: DBGetContactSetting(hContact,szModuleName,"pgp",&dbv); @@ -48,10 +48,10 @@ BYTE isContactSecured(HANDLE hContact) { DBFreeVariant(&dbv); break; case MODE_RSAAES: - if(exp->rsa_get_state(clist[j].cntx)==7) r|=SECURED; + if (exp->rsa_get_state(clist[j].cntx)==7) r|=SECURED; break; case MODE_RSA: - if(clist[j].cntx) r|=SECURED; + if (clist[j].cntx) r|=SECURED; break; } break; diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index e7779831ff..f81ea8ad3a 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -10,7 +10,7 @@ LPSTR InitKeyA(pUinKey ptr,int features) { ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0); char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK"); - if(tmp) { + if (tmp) { cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password mir_free(tmp); } @@ -18,14 +18,14 @@ LPSTR InitKeyA(pUinKey ptr,int features) { LPSTR pub_text = cpp_init_keya(ptr->cntx,features); // calculate public and private key & fill KeyA LPSTR keysig; - if(features&CPP_FEATURES_NEWPG) { - if(features&KEY_B_SIG) + if (features&CPP_FEATURES_NEWPG) { + if (features&KEY_B_SIG) keysig = (LPSTR)SIG_KEYB; else keysig = (LPSTR)SIG_KEYA; } else - if(isProtoSmallPackets(ptr->hContact)) + if (isProtoSmallPackets(ptr->hContact)) keysig = (LPSTR)SIG_KEY4; else keysig = (LPSTR)SIG_KEY3; @@ -51,7 +51,7 @@ int InitKeyB(pUinKey ptr,LPCSTR key) { if (!cpp_keyp(ptr->cntx)) { char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK"); - if(tmp) { + if (tmp) { cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password mir_free(tmp); } @@ -161,7 +161,7 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) { LPSTR szNewMsg = NULL; LPSTR szOldMsg = (ppre->flags&PREF_UTF)?cpp_decodeU(ptr->cntx,szEncMsg):cpp_decode(ptr->cntx,szEncMsg); - if(szOldMsg == NULL) { + if (szOldMsg == NULL) { ptr->decoded=false; switch(cpp_get_error(ptr->cntx)) { case CPP_ERROR_BAD_LEN: @@ -201,16 +201,16 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) { BOOL LoadKeyPGP(pUinKey ptr) { int mode = db_get_b(ptr->hContact,szModuleName,"pgp_mode",255); - if(mode==0) { + if (mode==0) { DBVARIANT dbv; DBGetContactSetting(ptr->hContact,szModuleName,"pgp",&dbv); BOOL r=(dbv.type==DBVT_BLOB); - if(r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal); + if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal); DBFreeVariant(&dbv); return r; } else - if(mode==1) { + if (mode==1) { LPSTR key = myDBGetStringDecode(ptr->hContact,szModuleName,"pgp"); if ( key ) { pgp_set_key(ptr->cntx,key); diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 97b3c1ee3e..2e616a46b7 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -71,7 +71,7 @@ void freeSupportedProtocols() { pSupPro getSupPro(HANDLE hContact) { int j; for(j=0;jmsgQueue==NULL){ + if (ptr->msgQueue==NULL){ // create new ptr->msgQueue = (pWM) mir_alloc(sizeof(struct waitingMessage)); ptrMessage = ptr->msgQueue; @@ -201,7 +201,7 @@ void addMsg2Queue(pUinKey ptr,WPARAM wParam,LPSTR szMsg) { ptrMessage->wParam = wParam; ptrMessage->nextMessage = NULL; - if(wParam & PREF_UNICODE) { + if (wParam & PREF_UNICODE) { int slen = (int)strlen(szMsg)+1; int wlen = (int)wcslen((wchar_t *)(szMsg+slen))+1; ptrMessage->Message = (LPSTR) mir_alloc(slen+wlen*sizeof(WCHAR)); diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index 065ad5145d..d78f4adc49 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -2,14 +2,14 @@ BOOL isProtoMetaContacts(HANDLE hContact) { - if(bMetaContacts) { + if (bMetaContacts) { LPSTR proto = GetContactProto(hContact); if ( proto && strcmp(proto,"MetaContacts")==0 ) { return true; } } // for(int j=0;jinspecting) +// if (clist[j].hContact==hContact && clist[j].proto->inspecting) // return strstr(clist[j].proto->name,"MetaContacts")!=NULL; return false; } @@ -17,7 +17,7 @@ BOOL isProtoMetaContacts(HANDLE hContact) { BOOL isDefaultSubContact(HANDLE hContact) { - if(bMetaContacts) { + if (bMetaContacts) { return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact; } return false; @@ -26,7 +26,7 @@ BOOL isDefaultSubContact(HANDLE hContact) { HANDLE getMetaContact(HANDLE hContact) { - if(bMetaContacts) { + if (bMetaContacts) { return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); } return 0; @@ -35,7 +35,7 @@ HANDLE getMetaContact(HANDLE hContact) { HANDLE getMostOnline(HANDLE hContact) { - if(bMetaContacts) { + if (bMetaContacts) { return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0); } return 0; diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp index 77bcb57168..ab011af206 100644 --- a/plugins/SecureIM/src/loadicons.cpp +++ b/plugins/SecureIM/src/loadicons.cpp @@ -1,18 +1,53 @@ #include "commonheaders.h" +struct +{ + UINT key; // Resource ID + BYTE tbl; // Table NUM + BYTE idx; // Table IDX + char *section; + char *name; + char *text; +} +static icons[] = +{ + // Contact List + {IDI_CL_DIS, TBL_IEC, IEC_CL_DIS, MODULENAME"/Contact List", "sim_cl_dis", "Connection Disabled"}, + {IDI_CL_EST, TBL_IEC, IEC_CL_EST, MODULENAME"/Contact List", "sim_cl_est", "Connection Established"}, + + // Contact Menu + {IDI_CM_DIS, TBL_ICO, ICO_CM_DIS, MODULENAME"/Contact Menu", "sim_cm_dis", "Disable Secure Connection"}, + {IDI_CM_EST, TBL_ICO, ICO_CM_EST, MODULENAME"/Contact Menu", "sim_cm_est", "Establishe Secure Connection"}, + + // Message Window + {IDI_MW_DIS, TBL_ICO, ICO_MW_DIS, MODULENAME"/Message Window", "sim_mw_dis", "Connection Disabled"}, + {IDI_MW_EST, TBL_ICO, ICO_MW_EST, MODULENAME"/Message Window", "sim_mw_est", "Connection Established"}, + + // popup's + {IDI_PU_DIS, TBL_POP, POP_PU_DIS, MODULENAME"/Popups", "sim_pu_dis", "Secure Connection Disabled"}, + {IDI_PU_EST, TBL_POP, POP_PU_EST, MODULENAME"/Popups", "sim_pu_est", "Secure Connection Established"}, + {IDI_PU_PRC, TBL_POP, POP_PU_PRC, MODULENAME"/Popups", "sim_pu_prc", "Secure Connection In Process"}, + {IDI_PU_MSG, TBL_POP, POP_PU_MSR, MODULENAME"/Popups", "sim_pu_msr", "Recv Secured Message"}, + {IDI_PU_MSG, TBL_POP, POP_PU_MSS, MODULENAME"/Popups", "sim_pu_mss", "Sent Secured Message"}, + + // statuses + {IDI_ST_DIS, TBL_ICO, ICO_ST_DIS, MODULENAME"/Menu State", "sim_st_dis", "Disabled"}, + {IDI_ST_ENA, TBL_ICO, ICO_ST_ENA, MODULENAME"/Menu State", "sim_st_ena", "Enabled"}, + {IDI_ST_TRY, TBL_ICO, ICO_ST_TRY, MODULENAME"/Menu State", "sim_st_try", "Always Try"}, + + // overlay + {IDI_OV_NAT, TBL_ICO, ICO_OV_NAT, MODULENAME"/Overlays", "sim_ov_nat", "Native mode"}, + {IDI_OV_PGP, TBL_ICO, ICO_OV_PGP, MODULENAME"/Overlays", "sim_ov_pgp", "PGP mode"}, + {IDI_OV_GPG, TBL_ICO, ICO_OV_GPG, MODULENAME"/Overlays", "sim_ov_gpg", "GPG mode"}, + {IDI_OV_RSA, TBL_ICO, ICO_OV_RSA, MODULENAME"/Overlays", "sim_ov_rsa", "RSA/AES mode"}, +}; HINSTANCE LoadIconsPack(const char* szIconsPack) { - HINSTANCE hNewIconInst = NULL; - WORD i; - - hNewIconInst = LoadLibrary(szIconsPack); - - if (hNewIconInst != NULL) - { - for(i=ID_FIRSTICON; i<=ID_LASTICON; i++) - if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == NULL) - { + HINSTANCE hNewIconInst = LoadLibrary(szIconsPack); + if (hNewIconInst != NULL) { + for(int i=ID_FIRSTICON; i <= ID_LASTICON; i++) + if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == NULL) { FreeLibrary(hNewIconInst); hNewIconInst = NULL; break; @@ -21,21 +56,16 @@ HINSTANCE LoadIconsPack(const char* szIconsPack) return hNewIconInst; } - - int ReloadIcons(WPARAM wParam, LPARAM lParam) { - HICON hIcon; - for (int i=0; icons[i].key; i++) { - hIcon = Skin_GetIcon(icons[i].name); - if(icons[i].tbl == TBL_IEC) - g_hIEC[icons[i].idx]=hIcon; - else - if(icons[i].tbl == TBL_ICO) - g_hICO[icons[i].idx]=hIcon; - else - if(icons[i].tbl == TBL_POP) - g_hPOP[icons[i].idx]=hIcon; + for (int i=0; i < SIZEOF(icons); i++) { + HICON hIcon = Skin_GetIcon(icons[i].name); + if (icons[i].tbl == TBL_IEC) + g_hIEC[icons[i].idx] = hIcon; + else if (icons[i].tbl == TBL_ICO) + g_hICO[icons[i].idx] = hIcon; + else if (icons[i].tbl == TBL_POP) + g_hPOP[icons[i].idx] = hIcon; } return 0; @@ -47,8 +77,8 @@ void InitIcons(void) HINSTANCE hNewIconInst = NULL; if ( g_hFolders ) { - LPSTR pathname = (LPSTR) alloca(MAX_PATH); - FoldersGetCustomPathEx(g_hFolders, pathname, MAX_PATH, "icons\\", "secureim_icons.dll"); + TCHAR pathname[MAX_PATH]; + FoldersGetCustomPathExT(g_hFolders, pathname, MAX_PATH, "icons\\"); if (hNewIconInst == NULL) hNewIconInst = LoadIconsPack(pathname); } @@ -64,30 +94,27 @@ void InitIcons(void) else g_hIconInst = hNewIconInst; + TCHAR tszPath[MAX_PATH]; + GetModuleFileName(g_hInst, tszPath, SIZEOF(tszPath)); - SKINICONDESC sid = { 0 }; - sid.cbSize = sizeof(sid); + SKINICONDESC sid = { sizeof(sid) }; sid.pszSection = "SecureIM"; + sid.ptszDefaultFile = tszPath; - HICON hIcon; - for (int i=0; icons[i].key; i++) { + for (int i=0; i < SIZEOF(icons); i++) { sid.pszSection = icons[i].section; sid.pszName = icons[i].name; sid.pszDescription = icons[i].text; - sid.pszDefaultFile = "secureim_icons.dll"; - sid.iDefaultIndex = icons[i].key; - sid.hDefaultIcon = (HICON)LoadImage(g_hIconInst, MAKEINTRESOURCE(icons[i].key), IMAGE_ICON, 16, 16, LR_SHARED); - Skin_AddIcon(&sid); - hIcon = Skin_GetIcon(icons[i].name); - - if(icons[i].tbl == TBL_IEC) - g_hIEC[icons[i].idx]=hIcon; - else - if(icons[i].tbl == TBL_ICO) - g_hICO[icons[i].idx]=hIcon; - else - if(icons[i].tbl == TBL_POP) - g_hPOP[icons[i].idx]=hIcon; + sid.iDefaultIndex = -icons[i].key; + HANDLE hIcolib = Skin_AddIcon(&sid); + + HICON hIcon = Skin_GetIconByHandle(hIcolib); + if (icons[i].tbl == TBL_IEC) + g_hIEC[icons[i].idx] = hIcon; + else if (icons[i].tbl == TBL_ICO) + g_hICO[icons[i].idx] = hIcon; + else if (icons[i].tbl == TBL_POP) + g_hPOP[icons[i].idx] = hIcon; } AddHookFunction(ME_SKIN2_ICONSCHANGED, ReloadIcons); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 0591ce40cf..dff745ce1c 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -81,7 +81,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) GetTempPath(sizeof(temp),temp); GetLongPathName(temp,TEMP,sizeof(TEMP)); TEMP_SIZE = (int)strlen(TEMP); - if(TEMP[TEMP_SIZE-1]=='\\') { + if (TEMP[TEMP_SIZE-1]=='\\') { TEMP_SIZE--; TEMP[TEMP_SIZE]='\0'; } @@ -170,8 +170,8 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPEX)!=0; bPopupUnicode = ServiceExists(MS_POPUP_ADDPOPUPW)!=0; - g_hFolders = FoldersRegisterCustomPath(szModuleName, "Icons", MIRANDA_PATH"\\icons"); - if ( g_hFolders==(HANDLE)CALLSERVICE_NOTFOUND ) g_hFolders = 0; + if ( ServiceExists(MS_FOLDERS_GET_PATH)) + g_hFolders = FoldersRegisterCustomPathT(szModuleName, "Icons", _T(MIRANDA_PATH"\\icons")); InitIcons(); GetFlags(); @@ -234,37 +234,37 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { Sent_NetLog("pgp_init"); #endif bPGP = db_get_b(0, szModuleName, "pgp", 0); - if(bPGP) { //PGP + if (bPGP) { //PGP bPGPloaded = pgp_init(); bUseKeyrings = db_get_b(0,szModuleName,"ukr",1); LPSTR priv = myDBGetStringDecode(0,szModuleName,"pgpPrivKey"); - if(priv) { + if (priv) { bPGPprivkey = true; - if(bPGPloaded) + if (bPGPloaded) pgp_set_priv_key(priv); mir_free(priv); - }// if(priv) - if(bPGPloaded && bUseKeyrings) { + }// if (priv) + if (bPGPloaded && bUseKeyrings) { char PubRingPath[MAX_PATH], SecRingPath[MAX_PATH]; PubRingPath[0]='\0'; SecRingPath[0]='\0'; - if(pgp_get_version()<0x02000000) { // 6xx + if (pgp_get_version()<0x02000000) { // 6xx bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath); } else { LPSTR tmp; tmp = myDBGetString(0,szModuleName,"pgpPubRing"); - if(tmp) { + if (tmp) { strncpy(PubRingPath,tmp,sizeof(PubRingPath)); mir_free(tmp); } tmp = myDBGetString(0,szModuleName,"pgpSecRing"); - if(tmp) { + if (tmp) { strncpy(SecRingPath,tmp,sizeof(SecRingPath)); mir_free(tmp); } - if(PubRingPath[0] && SecRingPath[0]) { + if (PubRingPath[0] && SecRingPath[0]) { bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath); - if(bPGPkeyrings) { + if (bPGPkeyrings) { DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath); DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath); } @@ -274,14 +274,14 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { } } } - }// if(bPGPloaded && bUseKeyrings) - }// if(bPGP) + }// if (bPGPloaded && bUseKeyrings) + }// if (bPGP) #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("gpg_init"); #endif bGPG = db_get_b(0, szModuleName, "gpg", 0); - if(bGPG) { //GPG + if (bGPG) { //GPG LPSTR tmp; @@ -291,34 +291,34 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { gpgexec[0]='\0'; gpghome[0]='\0'; tmp = myDBGetString(0,szModuleName,"gpgExec"); - if(tmp) { + if (tmp) { strncpy(gpgexec,tmp,sizeof(gpgexec)); mir_free(tmp); } tmp = myDBGetString(0,szModuleName,"gpgHome"); - if(tmp) { + if (tmp) { strncpy(gpghome,tmp,sizeof(gpghome)); mir_free(tmp); } - if(db_get_b(0, szModuleName, "gpgLogFlag",0)) { + if (db_get_b(0, szModuleName, "gpgLogFlag",0)) { tmp = myDBGetString(0,szModuleName,"gpgLog"); - if(tmp) { + if (tmp) { gpg_set_log(tmp); mir_free(tmp); } } - if(db_get_b(0, szModuleName, "gpgTmpFlag",0)) { + if (db_get_b(0, szModuleName, "gpgTmpFlag",0)) { tmp = myDBGetString(0,szModuleName,"gpgTmp"); - if(tmp) { + if (tmp) { gpg_set_tmp(tmp); mir_free(tmp); } } bGPGkeyrings = gpg_open_keyrings(gpgexec,gpghome); - if(bGPGkeyrings) { + if (bGPGkeyrings) { DBWriteContactSettingString(0,szModuleName,"gpgExec",gpgexec); DBWriteContactSettingString(0,szModuleName,"gpgHome",gpghome); } @@ -328,9 +328,9 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { } bSavePass = db_get_b(0,szModuleName,"gpgSaveFlag",0); - if(bSavePass) { + if (bSavePass) { tmp = myDBGetString(0,szModuleName,"gpgSave"); - if(tmp) { + if (tmp) { gpg_set_passphrases(tmp); mir_free(tmp); } @@ -362,7 +362,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { // hook init options AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions); - if(bPopupExists) + if (bPopupExists) AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions); AddHookFunction(ME_PROTO_ACK, onProtoAck); AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); @@ -382,7 +382,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { g_hMenu[0] = AddMenuItem(sim301,110000,g_hICO[ICO_CM_EST],MODULENAME"/SIM_EST",CMIF_NOTOFFLINE); g_hMenu[1] = AddMenuItem(sim302,110001,g_hICO[ICO_CM_DIS],MODULENAME"/SIM_DIS",CMIF_NOTOFFLINE); - if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) { + 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"); @@ -406,7 +406,7 @@ int __cdecl 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); @@ -416,7 +416,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("create Mode menu"); #endif - if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) { + 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"); @@ -436,7 +436,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { Sent_NetLog("create srmm icons"); #endif // add icon to srmm status icons - if(ServiceExists(MS_MSG_ADDICON)) { + if (ServiceExists(MS_MSG_ADDICON)) { StatusIconData sid; memset(&sid,0,sizeof(sid)); @@ -482,7 +482,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { int __cdecl onSystemOKToExit(WPARAM wParam,LPARAM lParam) { - if(bSavePass) { + if (bSavePass) { LPSTR tmp = gpg_get_passphrases(); DBWriteContactSettingString(0,szModuleName,"gpgSave",tmp); LocalFree(tmp); @@ -490,8 +490,8 @@ int __cdecl onSystemOKToExit(WPARAM wParam,LPARAM lParam) { else { DBDeleteContactSetting(0,szModuleName,"gpgSave"); } - if(bPGPloaded) pgp_done(); - if(bGPGloaded) gpg_done(); + if (bPGPloaded) pgp_done(); + if (bGPGloaded) gpg_done(); rsa_done(); while(iHook--) UnhookEvent(g_hHook[iHook]); mir_free(g_hHook); diff --git a/plugins/SecureIM/src/mmi.cpp b/plugins/SecureIM/src/mmi.cpp index 2269d76a51..76a6bd065b 100644 --- a/plugins/SecureIM/src/mmi.cpp +++ b/plugins/SecureIM/src/mmi.cpp @@ -136,11 +136,11 @@ LPSTR utf8_to_miranda(LPCSTR szUtfMsg, DWORD& flags) { // ЇаҐ®Ўа §гҐ¬ ⥪бв Ё§ д®а¬ в  ¬Ёа ­¤л ў зЁбвл© UTF8 LPSTR miranda_to_utf8(LPCSTR szMirMsg, DWORD flags) { LPSTR szNewMsg; - if(flags & PREF_UTF) { + if (flags & PREF_UTF) { szNewMsg = (LPSTR) szMirMsg; } else - if(flags & PREF_UNICODE) { + if (flags & PREF_UNICODE) { szNewMsg = exp->utf8encode((LPCWSTR)(szMirMsg+strlen(szMirMsg)+1)); } else { diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 26eeb0f1ee..0bef6112b6 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -120,7 +120,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara MoveWindow((HWND)tci.lParam,5,26,rcClient.right-8,rcClient.bottom-29,1); ShowWindow((HWND)tci.lParam, SW_HIDE); - if(bPGP && bPGPloaded) { + if (bPGP && bPGPloaded) { tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_TAB_PGP),hwnd,DlgProcOptionsPGP); tci.pszText = (LPSTR)sim214; TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 3, &tci); @@ -128,7 +128,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ShowWindow((HWND)tci.lParam, SW_HIDE); } - if(bGPG && bGPGloaded) { + if (bGPG && bGPGloaded) { tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_TAB_GPG),hwnd,DlgProcOptionsGPG); tci.pszText = (LPSTR)sim226; TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 4, &tci); @@ -320,11 +320,11 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_SETPSK: { idx = ListView_GetSelectionMark(hLV); ptr = (pUinKey) getListViewParam(hLV,idx); - if(ptr) { + if (ptr) { LPSTR buffer = (LPSTR)alloca(PSKSIZE+1); getContactName(ptr->hContact, buffer); int res = DialogBoxParam(g_hInst,MAKEINTRESOURCE(IDD_PSK),NULL,DlgProcSetPSK,(LPARAM)buffer); - if(res == IDOK) { + if (res == IDOK) { setListViewPSK(hLV,idx,1); DBWriteContactSettingString(ptr->hContact,szModuleName,"tPSK",buffer); } @@ -335,7 +335,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_DELPSK: { idx = ListView_GetSelectionMark(hLV); ptr = (pUinKey) getListViewParam(hLV,idx); - if(ptr) { + if (ptr) { setListViewPSK(hLV,idx,0); DBDeleteContactSetting(ptr->hContact, szModuleName, "tPSK"); } @@ -345,7 +345,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_DELPUBL: { idx = ListView_GetSelectionMark(hLV); ptr = (pUinKey) getListViewParam(hLV,idx); - if(ptr) { + if (ptr) { setListViewPUB(hLV,idx,0); } } @@ -354,7 +354,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_EXPPUBL: { idx = ListView_GetSelectionMark(hLV); ptr = (pUinKey) getListViewParam(hLV,idx); - if(ptr) { + if (ptr) { if ( !ptr->keyLoaded ) { createRSAcntx(ptr); loadRSAkey(ptr); @@ -373,7 +373,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_IMPPUBL: { idx = ListView_GetSelectionMark(hLV); ptr = (pUinKey) getListViewParam(hLV,idx); - if(ptr) { + if (ptr) { createRSAcntx(ptr); LPSTR pub = (LPSTR) alloca(RSASIZE); if ( !LoadImportRSAKeyDlg(hDlg,pub,0)) return TRUE; @@ -463,7 +463,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case IDC_STD_USERLIST: { switch(((LPNMHDR)lParam)->code) { case NM_DBLCLK: { - if(LPNMLISTVIEW(lParam)->iSubItem == 2) { + if (LPNMLISTVIEW(lParam)->iSubItem == 2) { idx = LPNMLISTVIEW(lParam)->iItem; ptr = (pUinKey) getListViewParam(hLV,idx); if (ptr) { @@ -476,11 +476,11 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); } } - if(LPNMLISTVIEW(lParam)->iSubItem == 3) { + if (LPNMLISTVIEW(lParam)->iSubItem == 3) { idx = LPNMLISTVIEW(lParam)->iItem; ptr = (pUinKey) getListViewParam(hLV,idx); if (ptr) { - ptr->tstatus++; if(ptr->tstatus>(ptr->tmode==MODE_RSAAES?1:2)) ptr->tstatus=0; + ptr->tstatus++; if (ptr->tstatus>(ptr->tmode==MODE_RSAAES?1:2)) ptr->tstatus=0; setListViewStatus(hLV,idx,ptr->tstatus); setListViewIcon(hLV,idx,ptr); SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); @@ -761,7 +761,7 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l char PubRingPath[MAX_PATH], SecRingPath[MAX_PATH]; PubRingPath[0]='\0'; SecRingPath[0]='\0'; bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath); - if(bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) { + if (bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) { DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath); DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath); } @@ -780,9 +780,9 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l break; case IDC_LOAD_PRIVKEY: { char KeyPath[MAX_PATH]; KeyPath[0]='\0'; - if(ShowSelectKeyDlg(hDlg,KeyPath)) { + if (ShowSelectKeyDlg(hDlg,KeyPath)) { char *priv = LoadKeys(KeyPath,true); - if(priv) { + if (priv) { DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv); mir_free(priv); } @@ -911,9 +911,9 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l switch(LOWORD(wParam)) { /* case IDC_LOAD_PRIVKEY: { char KeyPath[MAX_PATH] = {0}; - if(ShowSelectKeyDlg(hDlg,KeyPath)) { + if (ShowSelectKeyDlg(hDlg,KeyPath)) { char *priv = LoadKeys(KeyPath,true); - if(priv) { + if (priv) { DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv); mir_free(priv); } @@ -985,7 +985,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l case IDC_GPG_USERLIST: { switch(((LPNMHDR)lParam)->code) { case NM_DBLCLK: { - if(LPNMLISTVIEW(lParam)->iSubItem == 3) { + if (LPNMLISTVIEW(lParam)->iSubItem == 3) { idx = LPNMLISTVIEW(lParam)->iItem; ptr = (pUinKey) getListViewParam(hLV,idx); if ( !ptr ) break; @@ -1034,7 +1034,7 @@ INT_PTR CALLBACK DlgProcSetPSK(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) switch(LOWORD(wParam)) { case IDOK: { int len = GetDlgItemTextA(hDlg,IDC_EDIT1,buffer,PSKSIZE); - if(len<8) { + if (len<8) { msgbox1(hDlg,sim211,szModuleName,MB_OK|MB_ICONEXCLAMATION); return TRUE; } @@ -1218,7 +1218,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) { EnableWindow(GetDlgItem(hDlg, IDC_LOAD_PRIVKEY), !bUseKeyrings); SetDlgItemText(hDlg, IDC_PGP_PRIVKEY, bPGPprivkey?Translate(sim222):Translate(sim223)); - if(bPGPloaded && ver) { + if (bPGPloaded && ver) { char pgpVerStr[64]; sprintf(pgpVerStr, Translate(sim218), ver >> 24, (ver >> 16) & 255, (ver >> 8) & 255); SetDlgItemText(hDlg, IDC_PGP_SDK, pgpVerStr); @@ -1276,19 +1276,19 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { Sent_NetLog("RefreshGPGDlg"); #endif path = myDBGetString(0,szModuleName,"gpgExec"); - if(path) { + if (path) { SetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, path); mir_free(path); } path = myDBGetString(0,szModuleName,"gpgHome"); - if(path) { + if (path) { SetDlgItemText(hDlg, IDC_GPGHOME_EDIT, path); mir_free(path); } BOOL bGPGLogFlag = db_get_b(0, szModuleName, "gpgLogFlag",0); SendMessage(GetDlgItem(hDlg,IDC_LOGGINGON_CBOX),BM_SETCHECK,(bGPGLogFlag)?BST_CHECKED:BST_UNCHECKED,0L); path = myDBGetString(0,szModuleName,"gpgLog"); - if(path) { + if (path) { SetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, path); mir_free(path); } @@ -1296,7 +1296,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { BOOL bGPGTmpFlag = db_get_b(0, szModuleName, "gpgTmpFlag",0); SendMessage(GetDlgItem(hDlg,IDC_TMPPATHON_CBOX),BM_SETCHECK,(bGPGTmpFlag)?BST_CHECKED:BST_UNCHECKED,0L); path = myDBGetString(0,szModuleName,"gpgTmp"); - if(path) { + if (path) { SetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, path); mir_free(path); } @@ -1420,7 +1420,7 @@ void ApplyGeneralSettings(HWND hDlg) { // Key Exchange Timeout GetDlgItemText(hDlg,IDC_KET,timeout,5); - tmp = atoi(timeout); if(tmp > 65535) tmp = 65535; + tmp = atoi(timeout); if (tmp > 65535) tmp = 65535; DBWriteContactSettingWord(0,szModuleName,"ket",tmp); exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10)); mir_itoa(tmp,timeout,10); @@ -1428,7 +1428,7 @@ void ApplyGeneralSettings(HWND hDlg) { // Offline Key Timeout GetDlgItemText(hDlg,IDC_OKT,timeout,5); - tmp = atoi(timeout); if(tmp > 65535) tmp = 65535; + tmp = atoi(timeout); if (tmp > 65535) tmp = 65535; DBWriteContactSettingWord(0,szModuleName,"okt",tmp); mir_itoa(tmp,timeout,10); SetDlgItemText(hDlg,IDC_OKT,timeout); @@ -1450,16 +1450,16 @@ void ApplyGeneralSettings(HWND hDlg) { { tmp = 0; i = SendMessage(GetDlgItem(hDlg, IDC_PGP),BM_GETCHECK,0L,0L)==BST_CHECKED; - if(i!=bPGP) { + if (i!=bPGP) { bPGP = i; tmp++; db_set_b(0, szModuleName, "pgp", bPGP); } i = SendMessage(GetDlgItem(hDlg, IDC_GPG),BM_GETCHECK,0L,0L)==BST_CHECKED; - if(i!=bGPG) { + if (i!=bGPG) { bGPG = i; tmp++; db_set_b(0, szModuleName, "gpg", bGPG); } - if(tmp) msgbox1(hDlg, sim224, szModuleName, MB_OK|MB_ICONINFORMATION); + if (tmp) msgbox1(hDlg, sim224, szModuleName, MB_OK|MB_ICONINFORMATION); } HWND hLV = GetDlgItem(hDlg,IDC_STD_USERLIST); @@ -1473,7 +1473,7 @@ void ApplyGeneralSettings(HWND hDlg) { } if ( ptr->status!=ptr->tstatus ) { ptr->status = ptr->tstatus; - if(ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID"); + if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID"); else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status); } if ( ptr->mode==MODE_NATIVE ) { @@ -1525,7 +1525,7 @@ void ApplyPGPSettings(HWND hDlg) { db_set_b(0,szModuleName,"ukr",bUseKeyrings); char *priv = myDBGetString(0,szModuleName,"tpgpPrivKey"); - if(priv) { + if (priv) { bPGPprivkey = true; pgp_set_priv_key(priv); myDBWriteStringEncode(0,szModuleName,"pgpPrivKey",priv); @@ -1551,14 +1551,14 @@ void ApplyGPGSettings(HWND hDlg) { db_set_b(0,szModuleName,"gpgLogFlag",bgpgLogFlag); GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, sizeof(tmp)); DBWriteContactSettingString(0,szModuleName,"gpgLog",tmp); - if(bgpgLogFlag) gpg_set_log(tmp); + if (bgpgLogFlag) gpg_set_log(tmp); else gpg_set_log(0); BOOL bgpgTmpFlag = (SendMessage(GetDlgItem(hDlg, IDC_TMPPATHON_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED); db_set_b(0,szModuleName,"gpgTmpFlag",bgpgTmpFlag); GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, sizeof(tmp)); DBWriteContactSettingString(0,szModuleName,"gpgTmp",tmp); - if(bgpgTmpFlag) gpg_set_tmp(tmp); + if (bgpgTmpFlag) gpg_set_tmp(tmp); else gpg_set_tmp(0); HWND hLV = GetDlgItem(hDlg,IDC_GPG_USERLIST); @@ -1684,7 +1684,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { int s,d,m=1; DBVARIANT dbv1,dbv2; - if(lParamSort&0x100) { + if (lParamSort&0x100) { lParamSort&=0xFF; m=-1; } @@ -1714,7 +1714,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"pgp_abbr",&dbv2); s=(dbv1.type==DBVT_ASCIIZ); d=(dbv2.type==DBVT_ASCIIZ); - if(s && d) { + if (s && d) { s=strcmp(dbv1.pszVal,dbv2.pszVal); d=0; } @@ -1727,7 +1727,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"gpg",&dbv2); s=(dbv1.type==DBVT_ASCIIZ); d=(dbv2.type==DBVT_ASCIIZ); - if(s && d) { + if (s && d) { s=strcmp(dbv1.pszVal,dbv2.pszVal); d=0; } @@ -1767,7 +1767,7 @@ void ListView_Sort(HWND hLV, LPARAM lParamSort) { // restore sort order sprintf(t,"os%02x",(UINT)lParamSort); int m=db_get_b(0, szModuleName, t, 0); - if(bChangeSortOrder){ m=!m; db_set_b(0, szModuleName, t, m); } + if (bChangeSortOrder){ m=!m; db_set_b(0, szModuleName, t, m); } ListView_SortItems(hLV,&CompareFunc,lParamSort|(m<<8)); } @@ -1804,7 +1804,7 @@ LPSTR LoadKeys(LPCSTR file,BOOL priv) { fseek(f,0,SEEK_SET); LPCSTR beg,end; - if(priv) { + if (priv) { beg = priv_beg; end = priv_end; } @@ -1820,11 +1820,11 @@ LPSTR LoadKeys(LPCSTR file,BOOL priv) { b=true; } else - if(b && strncmp(keys+i,end,strlen(end))==0) { + if (b && strncmp(keys+i,end,strlen(end))==0) { i+=(int)strlen(keys+i); b=false; } - if(b) { + if (b) { i+=(int)strlen(keys+i); } } @@ -1883,7 +1883,7 @@ BOOL LoadImportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) if ( !f ) return FALSE; fseek(f,0,SEEK_END); - int flen = ftell(f); if(flen>RSASIZE) { fclose(f); return FALSE; } + int flen = ftell(f); if (flen>RSASIZE) { fclose(f); return FALSE; } fseek(f,0,SEEK_SET); fread(key,flen,1,f); diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index eb588dde70..23db06cfef 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -171,7 +171,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk } else indic=1; - if(indic==1)SendMessage(hec,BM_SETCHECK,BST_CHECKED,0L); + if (indic==1)SendMessage(hec,BM_SETCHECK,BST_CHECKED,0L); else SendMessage(hec,BM_SETCHECK,BST_UNCHECKED,0L); // dc checkbox @@ -180,7 +180,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk } else indic=1; - if(indic==1)SendMessage(hdc,BM_SETCHECK,BST_CHECKED,0L); + if (indic==1)SendMessage(hdc,BM_SETCHECK,BST_CHECKED,0L); else SendMessage(hdc,BM_SETCHECK,BST_UNCHECKED,0L); // ks checkbox @@ -189,7 +189,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk } else indic=1; - if(indic==1)SendMessage(hks,BM_SETCHECK,BST_CHECKED,0L); + if (indic==1)SendMessage(hks,BM_SETCHECK,BST_CHECKED,0L); else SendMessage(hks,BM_SETCHECK,BST_UNCHECKED,0L); // kr checkbox @@ -198,7 +198,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk } else indic=1; - if(indic==1)SendMessage(hkr,BM_SETCHECK,BST_CHECKED,0L); + if (indic==1)SendMessage(hkr,BM_SETCHECK,BST_CHECKED,0L); else SendMessage(hkr,BM_SETCHECK,BST_UNCHECKED,0L); //ss checkbox @@ -207,7 +207,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk } else indic=0; - if(indic==1)SendMessage(hss,BM_SETCHECK,BST_CHECKED,0L); + if (indic==1)SendMessage(hss,BM_SETCHECK,BST_CHECKED,0L); else SendMessage(hss,BM_SETCHECK,BST_UNCHECKED,0L); //sr checkbox @@ -216,7 +216,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk } else indic=0; - if(indic==1)SendMessage(hsr,BM_SETCHECK,BST_CHECKED,0L); + if (indic==1)SendMessage(hsr,BM_SETCHECK,BST_CHECKED,0L); else SendMessage(hsr,BM_SETCHECK,BST_UNCHECKED,0L); DBFreeVariant(&dbv); diff --git a/plugins/SecureIM/src/secureim.h b/plugins/SecureIM/src/secureim.h index a307d1e5a2..c2c3ff3eea 100644 --- a/plugins/SecureIM/src/secureim.h +++ b/plugins/SecureIM/src/secureim.h @@ -132,41 +132,4 @@ const SIG signs[] = { #define ADV_CNT 8 #define ALL_CNT (IEC_CNT+ICO_CNT+POP_CNT) -struct ICONS { - UINT key; // Resource ID - BYTE tbl; // Table NUM - BYTE idx; // Table IDX - char *section; - char *name; - char *text; -}; - -const ICONS icons[] = { - // Contact List - {IDI_CL_DIS, TBL_IEC, IEC_CL_DIS, MODULENAME"/Contact List", "sim_cl_dis", "Connection Disabled"}, - {IDI_CL_EST, TBL_IEC, IEC_CL_EST, MODULENAME"/Contact List", "sim_cl_est", "Connection Established"}, - // Contact Menu - {IDI_CM_DIS, TBL_ICO, ICO_CM_DIS, MODULENAME"/Contact Menu", "sim_cm_dis", "Disable Secure Connection"}, - {IDI_CM_EST, TBL_ICO, ICO_CM_EST, MODULENAME"/Contact Menu", "sim_cm_est", "Establishe Secure Connection"}, - // Message Window - {IDI_MW_DIS, TBL_ICO, ICO_MW_DIS, MODULENAME"/Message Window", "sim_mw_dis", "Connection Disabled"}, - {IDI_MW_EST, TBL_ICO, ICO_MW_EST, MODULENAME"/Message Window", "sim_mw_est", "Connection Established"}, - // popup's - {IDI_PU_DIS, TBL_POP, POP_PU_DIS, MODULENAME"/Popups", "sim_pu_dis", "Secure Connection Disabled"}, - {IDI_PU_EST, TBL_POP, POP_PU_EST, MODULENAME"/Popups", "sim_pu_est", "Secure Connection Established"}, - {IDI_PU_PRC, TBL_POP, POP_PU_PRC, MODULENAME"/Popups", "sim_pu_prc", "Secure Connection In Process"}, - {IDI_PU_MSG, TBL_POP, POP_PU_MSR, MODULENAME"/Popups", "sim_pu_msr", "Recv Secured Message"}, - {IDI_PU_MSG, TBL_POP, POP_PU_MSS, MODULENAME"/Popups", "sim_pu_mss", "Sent Secured Message"}, - // statuses - {IDI_ST_DIS, TBL_ICO, ICO_ST_DIS, MODULENAME"/Menu State", "sim_st_dis", "Disabled"}, - {IDI_ST_ENA, TBL_ICO, ICO_ST_ENA, MODULENAME"/Menu State", "sim_st_ena", "Enabled"}, - {IDI_ST_TRY, TBL_ICO, ICO_ST_TRY, MODULENAME"/Menu State", "sim_st_try", "Always Try"}, - // overlay - {IDI_OV_NAT, TBL_ICO, ICO_OV_NAT, MODULENAME"/Overlays", "sim_ov_nat", "Native mode"}, - {IDI_OV_PGP, TBL_ICO, ICO_OV_PGP, MODULENAME"/Overlays", "sim_ov_pgp", "PGP mode"}, - {IDI_OV_GPG, TBL_ICO, ICO_OV_GPG, MODULENAME"/Overlays", "sim_ov_gpg", "GPG mode"}, - {IDI_OV_RSA, TBL_ICO, ICO_OV_RSA, MODULENAME"/Overlays", "sim_ov_rsa", "RSA/AES mode"}, - {0} -}; - #endif diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index ca4f0635cf..944393025b 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -68,7 +68,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) { #endif int len=0,i; for ( i=0; imessage[i]==NULL) break; + if (pm->message[i]==NULL) break; len+=(int)strlen(pm->message[i]); } if ( i==part_all ) { // combine message @@ -79,7 +79,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) { delete pm->message[i]; } delete pm->message; - if(ppm) ppm->nextMessage = pm->nextMessage; + if (ppm) ppm->nextMessage = pm->nextMessage; else ptr->msgPart = pm->nextMessage; delete pm; #if defined(_DEBUG) || defined(NETLIB_LOG) diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index a37dbf70d5..e1c1d7e19c 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -148,7 +148,7 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { } } if ( ptr->mode==MODE_GPG && bGPGloaded ) { - if(bGPGkeyrings && !isPGP) { + if (bGPGkeyrings && !isPGP) { mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isGPG+8],(LPARAM)&mi); } diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp index 77a9271994..d2b37b8155 100644 --- a/plugins/SecureIM/src/svcs_menu.cpp +++ b/plugins/SecureIM/src/svcs_menu.cpp @@ -26,9 +26,9 @@ INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) { case STATUS_ENABLED: case STATUS_ALWAYSTRY: pUinKey ptr = getUinKey((HANDLE)wParam); - if(ptr) { + if (ptr) { ptr->status=ptr->tstatus=(BYTE)lParam; - if(ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID"); + if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID"); else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status); } break; @@ -58,7 +58,7 @@ INT_PTR __cdecl Service_StatusTry(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) { - if(bPGPloaded) { + if (bPGPloaded) { DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp"); DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_mode"); DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_abbr"); @@ -75,11 +75,11 @@ INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { BOOL del = true; - if(bPGPloaded) { - if(bPGPkeyrings) { + if (bPGPloaded) { + if (bPGPkeyrings) { char szKeyID[128]; szKeyID[0]='\0'; PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID); - if(szKeyID[0]) { + if (szKeyID[0]) { DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp"); DBCONTACTWRITESETTING cws; memset(&cws,0,sizeof(cws)); @@ -95,11 +95,11 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { } } else - if(bPGPprivkey) { + if (bPGPprivkey) { char KeyPath[MAX_PATH]; KeyPath[0]='\0'; - if(ShowSelectKeyDlg(0,KeyPath)) { + if (ShowSelectKeyDlg(0,KeyPath)) { char *publ = LoadKeys(KeyPath,false); - if(publ) { + if (publ) { DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp"); myDBWriteStringEncode((HANDLE)wParam,szModuleName,"pgp",publ); db_set_b((HANDLE)wParam,szModuleName,"pgp_mode",1); @@ -111,7 +111,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { } } - if(del) Service_PGPdelKey(wParam,lParam); + if (del) Service_PGPdelKey(wParam,lParam); else { pUinKey ptr = getUinKey((HANDLE)wParam); cpp_delete_context(ptr->cntx); ptr->cntx=0; @@ -123,7 +123,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) { - if(bGPGloaded) { + if (bGPGloaded) { DBDeleteContactSetting((HANDLE)wParam, szModuleName, "gpg"); } { @@ -138,16 +138,16 @@ INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) { BOOL del = true; - if(bGPGloaded && bGPGkeyrings) { + if (bGPGloaded && bGPGkeyrings) { char szKeyID[128]; szKeyID[0]='\0'; gpg_select_keyid(GetForegroundWindow(),szKeyID); - if(szKeyID[0]) { + if (szKeyID[0]) { DBWriteContactSettingString((HANDLE)wParam,szModuleName,"gpg",szKeyID); del = false; } } - if(del) Service_GPGdelKey(wParam,lParam); + if (del) Service_GPGdelKey(wParam,lParam); else { pUinKey ptr = getUinKey((HANDLE)wParam); cpp_delete_context(ptr->cntx); ptr->cntx=0; @@ -174,7 +174,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) { case MODE_PGP: case MODE_GPG: // нужно много проверок и отключение активного контекста если необходимо - if(ptr) { + if (ptr) { if ( ptr->cntx ) { cpp_delete_context(ptr->cntx); ptr->cntx = 0; diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index eb5466c329..803ba30c8a 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -3,7 +3,7 @@ // return SignID int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg=NULL) { - if(szPlainMsg) *szPlainMsg=(LPSTR)szMsg; + if (szPlainMsg) *szPlainMsg=(LPSTR)szMsg; for(int i=0;signs[i].len;i++) { if (memcmp(szMsg,signs[i].sig,signs[i].len)==0) { /* for(int i=strlen(szMsg)-1;i;i--) { @@ -12,8 +12,8 @@ int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg=NULL) { else break; }*/ - if(szPlainMsg) *szPlainMsg = (LPSTR)(szMsg+signs[i].len); - if(signs[i].key==SiG_GAME && !bDGP) + if (szPlainMsg) *szPlainMsg = (LPSTR)(szMsg+signs[i].len); + if (signs[i].key==SiG_GAME && !bDGP) return SiG_NONE; return signs[i].key; } @@ -60,7 +60,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { SAFE_FREE(szUnrtfMsg); int len = (int)strlen(szEncMsg)+1; LPWSTR szTemp = (LPWSTR)mir_alloc(len*sizeof(WCHAR)); - if(ppre->flags & PREF_UNICODE) + if (ppre->flags & PREF_UNICODE) rtfconvW((LPWSTR)(szEncMsg+len),szTemp); else rtfconvA(szEncMsg,szTemp); @@ -118,7 +118,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("onRecvMsg: non-secure message"); #endif - if(ppre->flags & PREF_UNICODE) { + if (ppre->flags & PREF_UNICODE) { szPlainMsg = m_awstrcat(Translate(sim402),szEncMsg); } else { @@ -201,9 +201,9 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { if (!ptr->keyLoaded && bPGPloaded) ptr->keyLoaded = LoadKeyPGP(ptr); if (!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr); - if(ptr->keyLoaded==1) szOldMsg = pgp_decode(ptr->cntx, szEncMsg); + if (ptr->keyLoaded==1) szOldMsg = pgp_decode(ptr->cntx, szEncMsg); else - if(ptr->keyLoaded==2) szOldMsg = gpg_decode(ptr->cntx, szEncMsg); + if (ptr->keyLoaded==2) szOldMsg = gpg_decode(ptr->cntx, szEncMsg); if (!szOldMsg) { // error while decrypting message, send error SAFE_FREE(ptr->msgSplitted); @@ -473,7 +473,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { showPopUpKR(ptr->hContact); cpp_reset_context(ptr->cntx); - if(InitKeyB(ptr,szEncMsg)!=CPP_ERROR_NONE) { + if (InitKeyB(ptr,szEncMsg)!=CPP_ERROR_NONE) { #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("onRecvMsg: SiG_KEYA InitKeyB error"); #endif @@ -618,7 +618,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { // если можно зашифровать - шифруем if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact)) { /* - if(stat==ID_STATUS_OFFLINE) { + if (stat==ID_STATUS_OFFLINE) { if (msgbox1(0,sim110,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) { return returnNoError(pccsd->hContact); } @@ -894,8 +894,8 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { dbei.flags = DBEF_SENT; dbei.timestamp = time(NULL); dbei.eventType = EVENTTYPE_MESSAGE; - if(pccsd->wParam & PREF_RTL) dbei.flags |= DBEF_RTL; - if(pccsd->wParam & PREF_UTF) dbei.flags |= DBEF_UTF; + if (pccsd->wParam & PREF_RTL) dbei.flags |= DBEF_RTL; + if (pccsd->wParam & PREF_UTF) dbei.flags |= DBEF_UTF; dbei.cbBlob = strlen((char *)pccsd->lParam) + 1; if ( pccsd->wParam & PREF_UNICODE ) dbei.cbBlob *= ( sizeof( wchar_t )+1 ); @@ -970,7 +970,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { if ( isContactSecured(pccsd->hContact)&SECURED ) { char **file=(char **)pccsd->lParam; - if(file_idx==100) file_idx=0; + if (file_idx==100) file_idx=0; int i; for(i=0;file[i];i++) { @@ -1090,7 +1090,7 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { buf[0]='\0'; LPSTR p=strrchr(file_out,'.'); LPSTR x=strrchr(file_out,'\\'); - if(p>x) { + if (p>x) { strcpy(buf,p); pos=p; } diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 3b75840b74..18daf53c62 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -67,7 +67,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int Sent_NetLog("rsa_check_pub: manual accepted %d",v); #endif } - if(v) { + if (v) { DBCONTACTWRITESETTING cws; cws.szModule = szModuleName; cws.szSetting = "rsa_pub"; @@ -129,7 +129,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { sprintf(buf,sim510,-state); showPopUpDCmsg(ptr->hContact,buf); ShowStatusIconNotify(ptr->hContact); - if(ptr->cntx) deleteRSAcntx(ptr); + if (ptr->cntx) deleteRSAcntx(ptr); waitForExchange(ptr,3); // досылаем нешифровано return; } @@ -137,7 +137,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { case -4: { // соединение разорвано вручную другой стороной showPopUpDC(ptr->hContact); ShowStatusIconNotify(ptr->hContact); - if(ptr->cntx) deleteRSAcntx(ptr); + if (ptr->cntx) deleteRSAcntx(ptr); waitForExchange(ptr,3); // досылаем нешифровано return; } @@ -146,7 +146,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { } showPopUpDCmsg(ptr->hContact,msg); ShowStatusIconNotify(ptr->hContact); - if(ptr->cntx) deleteRSAcntx(ptr); + if (ptr->cntx) deleteRSAcntx(ptr); waitForExchange(ptr,3); // досылаем нешифровано } diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index 688246847e..6504a209ac 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -4,7 +4,7 @@ int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; - if(mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) { + if (mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) { ShowStatusIcon(mwd->hContact); } return 0; @@ -26,7 +26,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { BOOL isChat = isChatRoom(hContact); if ( !isPGP && !isGPG && !isChat ) { - if(isSecured) Service_DisableIM(wParam,0); + if (isSecured) Service_DisableIM(wParam,0); else Service_CreateIM(wParam,0); } -- cgit v1.2.3