From 754c5e27f878dc4a46131593e00e78e054faa995 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 1 Apr 2013 19:37:35 +0000 Subject: SecureIM: - thread cleaning; - fix SRMM status icon; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4278 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/svcs_clist.cpp | 53 +++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 28 deletions(-) (limited to 'plugins/SecureIM/src/svcs_clist.cpp') diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index bcec8fb8fa..2b02df1092 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -9,15 +9,15 @@ int __cdecl onContactSettingChanged(WPARAM wParam,LPARAM lParam) { pUinKey ptr = getUinKey(hContact); int stat = getContactStatus(hContact); - if (!ptr || stat==-1) return 0; + if (!ptr || stat == -1) return 0; - if (stat==ID_STATUS_OFFLINE) { // go offline - if (ptr->mode==MODE_NATIVE && cpp_keyx(ptr->cntx)) { // have active context + if (stat == ID_STATUS_OFFLINE) { // go offline + if (ptr->mode == MODE_NATIVE && cpp_keyx(ptr->cntx)) { // have active context cpp_delete_context(ptr->cntx); ptr->cntx=0; // reset context showPopUpDC(hContact); // show popup "Disabled" ShowStatusIconNotify(hContact); // change icon in CL } - else if (ptr->mode==MODE_RSAAES && exp->rsa_get_state(ptr->cntx)==7) { + else if (ptr->mode == MODE_RSAAES && exp->rsa_get_state(ptr->cntx) == 7) { deleteRSAcntx(ptr); showPopUpDC(hContact); // show popup "Disabled" ShowStatusIconNotify(hContact); // change icon in CL @@ -58,20 +58,17 @@ int __cdecl onExtraImageListRebuilding(WPARAM, LPARAM) int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM) { - if ( isSecureProtocol((HANDLE)wParam)) + if (isSecureProtocol((HANDLE)wParam)) ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, mode2clicon( isContactSecured((HANDLE)wParam), 1)); return 0; } -int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { - -#if defined(_DEBUG) || defined(NETLIB_LOG) - Sent_NetLog("onRebuildContactMenu"); -#endif +int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) +{ HANDLE hContact = (HANDLE)wParam; BOOL bMC = isProtoMetaContacts(hContact); - if ( bMC ) hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение + if (bMC ) hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение pUinKey ptr = getUinKey(hContact); int i; @@ -83,14 +80,14 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { // hide menu bars mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN; for (i=0;imode==MODE_NATIVE || ptr->mode==MODE_RSAAES)) { + if (isSecureProto && !isChat && isMiranda && + (ptr->mode == MODE_NATIVE || ptr->mode == MODE_RSAAES)) { // Native/RSAAES mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIM_ICON; - if ( !isSecured ) { + if (!isSecured) { // create secureim connection mi.hIcon = mode2icon(ptr->mode|SECURED,2); CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[0],(LPARAM)&mi); @@ -122,8 +119,8 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[1],(LPARAM)&mi); } // set status menu - if ( bSCM && !bMC && - ( !isSecured || ptr->mode==MODE_PGP || ptr->mode==MODE_GPG )) { + if (bSCM && !bMC && + ( !isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG )) { mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; mi.hIcon = g_hICO[ICO_ST_DIS+ptr->status]; @@ -131,32 +128,32 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[2],(LPARAM)&mi); mi.flags = CMIM_FLAGS | CMIM_ICON; - for (i=0;i<=(ptr->mode==MODE_RSAAES?1:2);i++) { + for (i=0;i<=(ptr->mode == MODE_RSAAES?1:2);i++) { mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS+ptr->status] : NULL; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[3+i],(LPARAM)&mi); } } } else - if ( isSecureProto && !isChat && (ptr->mode==MODE_PGP || ptr->mode==MODE_GPG)) { + if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) { // PGP, GPG - if ( ptr->mode==MODE_PGP && bPGPloaded ) { + if (ptr->mode == MODE_PGP && bPGPloaded) { if ((bPGPkeyrings || bPGPprivkey) && !isGPG) { mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isPGP+6],(LPARAM)&mi); } } - if ( ptr->mode==MODE_GPG && bGPGloaded ) { + if (ptr->mode == MODE_GPG && bGPGloaded) { if (bGPGkeyrings && !isPGP) { mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isGPG+8],(LPARAM)&mi); } } } - if ( isSecureProto && !isChat && isMiranda ) { + if (isSecureProto && !isChat && isMiranda) { // set mode menu - if ( bMCM && !bMC && - ( !isSecured || ptr->mode==MODE_PGP || ptr->mode==MODE_GPG )) { + if (bMCM && !bMC && + ( !isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG )) { mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; mi.hIcon = g_hICO[ICO_OV_NAT+ptr->mode]; @@ -165,8 +162,8 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { mi.flags = CMIM_FLAGS | CMIM_ICON; for (i=0;imode!=MODE_PGP && !bPGP ) continue; - if ( i==MODE_GPG && ptr->mode!=MODE_GPG && !bGPG ) continue; + if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP ) continue; + if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG ) continue; mi.hIcon = (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[11+i],(LPARAM)&mi); } -- cgit v1.2.3