From 62ab18a9fda2f19c08ae63a14c7a262ca62f0cce Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 8 Jul 2014 15:49:18 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@9732 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/svcs_clist.cpp | 51 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 27 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 bb1f422cbe..0b677659c0 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -1,10 +1,9 @@ #include "commonheaders.h" - int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam) { - DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - if (!hContact || strcmp(cws->szSetting,"Status")) return 0; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; + if (!hContact || strcmp(cws->szSetting, "Status")) return 0; pUinKey ptr = getUinKey(hContact); int stat = getContactStatus(hContact); @@ -12,7 +11,7 @@ int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam) 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 + cpp_delete_context(ptr->cntx); ptr->cntx = 0; // reset context showPopupDC(hContact); // show popup "Disabled" ShowStatusIconNotify(hContact); // change icon in CL } @@ -34,7 +33,7 @@ int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam) // wParam=(MCONTACT)hContact // lParam=0 -int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) +int __cdecl onContactAdded(WPARAM wParam, LPARAM lParam) { addContact(wParam); return 0; @@ -43,7 +42,7 @@ int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) // wParam=(MCONTACT)hContact // lParam=0 -int __cdecl onContactDeleted(WPARAM wParam,LPARAM lParam) +int __cdecl onContactDeleted(WPARAM wParam, LPARAM lParam) { delContact(wParam); return 0; @@ -64,9 +63,9 @@ int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM) return 0; } -int __cdecl onRebuildContactMenu(WPARAM hContact,LPARAM lParam) +int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) { - BOOL bMC = isProtoMetaContacts(hContact); + BOOL bMC = db_mc_isMeta(hContact); if (bMC) hContact = db_mc_getMostOnline(hContact); // возьмем тот, через который пойдет сообщение pUinKey ptr = getUinKey(hContact); @@ -78,7 +77,7 @@ int __cdecl onRebuildContactMenu(WPARAM hContact,LPARAM lParam) // check offline/online if (!ptr) { // hide menu bars - for (i=0; i < SIZEOF(g_hMenu); i++) + for (i = 0; i < SIZEOF(g_hMenu); i++) Menu_ShowItem(g_hMenu[i], false); return 0; } @@ -91,35 +90,35 @@ int __cdecl onRebuildContactMenu(WPARAM hContact,LPARAM lParam) bool isMiranda = isClientMiranda(hContact); // hide all menu bars - for (i=0; i < SIZEOF(g_hMenu); i++) + for (i = 0; i < SIZEOF(g_hMenu); i++) Menu_ShowItem(g_hMenu[i], false); - if (isSecureProto && !isChat && isMiranda && - (ptr->mode == 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) { // create secureim connection - mi.hIcon = mode2icon(ptr->mode|SECURED,2); + mi.hIcon = mode2icon(ptr->mode | SECURED, 2); Menu_ModifyItem(g_hMenu[0], &mi); } else { // disable secureim connection - mi.hIcon = mode2icon(ptr->mode,2); + mi.hIcon = mode2icon(ptr->mode, 2); Menu_ModifyItem(g_hMenu[1], &mi); } // set status menu 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]; + mi.hIcon = g_hICO[ICO_ST_DIS + ptr->status]; mi.pszName = (LPSTR)sim312[ptr->status]; Menu_ModifyItem(g_hMenu[2], &mi); mi.flags = CMIM_FLAGS | CMIM_ICON; - for (i=0;i<=(ptr->mode == MODE_RSAAES?1:2);i++) { - mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS+ptr->status] : NULL; - Menu_ModifyItem(g_hMenu[3+i], &mi); + for (i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++) { + mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL; + Menu_ModifyItem(g_hMenu[3 + i], &mi); } } } @@ -127,31 +126,29 @@ int __cdecl onRebuildContactMenu(WPARAM hContact,LPARAM lParam) // PGP, GPG if (ptr->mode == MODE_PGP && bPGPloaded) if ((bPGPkeyrings || bPGPprivkey) && !isGPG) - Menu_ShowItem(g_hMenu[isPGP+6], true); + Menu_ShowItem(g_hMenu[isPGP + 6], true); if (ptr->mode == MODE_GPG && bGPGloaded) if (bGPGkeyrings && !isPGP) - Menu_ShowItem(g_hMenu[isGPG+8], true); + Menu_ShowItem(g_hMenu[isGPG + 8], true); } if (isSecureProto && !isChat && isMiranda) { // set mode menu 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]; + mi.hIcon = g_hICO[ICO_OV_NAT + ptr->mode]; mi.pszName = (LPSTR)sim311[ptr->mode]; Menu_ModifyItem(g_hMenu[10], &mi); mi.flags = CMIM_FLAGS | CMIM_ICON; - for (i=0;imode != MODE_PGP && !bPGP ) continue; - if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG ) continue; + for (i = 0; i < MODE_CNT; i++) { + 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; - Menu_ModifyItem(g_hMenu[11+i], &mi); + Menu_ModifyItem(g_hMenu[11 + i], &mi); } } } return 0; } - -// EOF -- cgit v1.2.3