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_menu.cpp | 63 ++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 34 deletions(-) (limited to 'plugins/SecureIM/src/svcs_menu.cpp') diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp index ece52aa842..c9432ba1a0 100644 --- a/plugins/SecureIM/src/svcs_menu.cpp +++ b/plugins/SecureIM/src/svcs_menu.cpp @@ -1,19 +1,17 @@ #include "commonheaders.h" - INT_PTR __cdecl Service_IsContactSecured(WPARAM wParam, LPARAM lParam) { return (isContactSecured(wParam)&SECURED) || isContactPGP(wParam) || isContactGPG(wParam); } - -INT_PTR __cdecl Service_CreateIM(WPARAM wParam,LPARAM lParam) +INT_PTR __cdecl Service_CreateIM(WPARAM wParam, LPARAM lParam) { CallContactService(wParam, PSS_MESSAGE, PREF_METANODB, (LPARAM)SIG_INIT); return 1; } -INT_PTR __cdecl Service_DisableIM(WPARAM wParam,LPARAM lParam) +INT_PTR __cdecl Service_DisableIM(WPARAM wParam, LPARAM lParam) { CallContactService(wParam, PSS_MESSAGE, PREF_METANODB, (LPARAM)SIG_DEIN); return 1; @@ -21,13 +19,13 @@ INT_PTR __cdecl Service_DisableIM(WPARAM wParam,LPARAM lParam) INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) { - switch(--lParam) { + switch (--lParam) { case STATUS_DISABLED: case STATUS_ENABLED: case STATUS_ALWAYSTRY: pUinKey ptr = getUinKey(wParam); if (ptr) { - ptr->status=ptr->tstatus=(BYTE)lParam; + ptr->status = ptr->tstatus = (BYTE)lParam; if (ptr->status == STATUS_ENABLED) db_unset(ptr->hContact, MODULENAME, "StatusID"); else db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status); } @@ -39,17 +37,17 @@ INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl Service_StatusDis(WPARAM wParam, LPARAM lParam) { - return Service_Status(wParam,STATUS_DISABLED+1); + return Service_Status(wParam, STATUS_DISABLED + 1); } INT_PTR __cdecl Service_StatusEna(WPARAM wParam, LPARAM lParam) { - return Service_Status(wParam,STATUS_ENABLED+1); + return Service_Status(wParam, STATUS_ENABLED + 1); } INT_PTR __cdecl Service_StatusTry(WPARAM wParam, LPARAM lParam) { - return Service_Status(wParam,STATUS_ALWAYSTRY+1); + return Service_Status(wParam, STATUS_ALWAYSTRY + 1); } INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) @@ -61,7 +59,7 @@ INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) } { pUinKey ptr = getUinKey(wParam); - cpp_delete_context(ptr->cntx); ptr->cntx=0; + cpp_delete_context(ptr->cntx); ptr->cntx = 0; } ShowStatusIconNotify(wParam); return 1; @@ -72,8 +70,8 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) BOOL del = true; if (bPGPloaded) { if (bPGPkeyrings) { - char szKeyID[128]; szKeyID[0]='\0'; - PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID); + char szKeyID[128]; szKeyID[0] = '\0'; + PVOID KeyID = pgp_select_keyid(GetForegroundWindow(), szKeyID); if (szKeyID[0]) { db_unset(wParam, MODULENAME, "pgp"); db_set_blob(wParam, MODULENAME, "pgp", KeyID, pgp_size_keyid()); @@ -83,9 +81,9 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) } } else if (bPGPprivkey) { - char KeyPath[MAX_PATH]; KeyPath[0]='\0'; - if (ShowSelectKeyDlg(0,KeyPath)) { - char *publ = LoadKeys(KeyPath,false); + char KeyPath[MAX_PATH]; KeyPath[0] = '\0'; + if (ShowSelectKeyDlg(0, KeyPath)) { + char *publ = LoadKeys(KeyPath, false); if (publ) { db_unset(wParam, MODULENAME, "pgp"); db_set_s(wParam, MODULENAME, "pgp", publ); @@ -99,10 +97,10 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) } if (del) - Service_PGPdelKey(wParam,lParam); + Service_PGPdelKey(wParam, lParam); else { pUinKey ptr = getUinKey(wParam); - cpp_delete_context(ptr->cntx); ptr->cntx=0; + cpp_delete_context(ptr->cntx); ptr->cntx = 0; } ShowStatusIconNotify(wParam); return 1; @@ -114,7 +112,7 @@ INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) db_unset(wParam, MODULENAME, "gpg"); { pUinKey ptr = getUinKey(wParam); - cpp_delete_context(ptr->cntx); ptr->cntx=0; + cpp_delete_context(ptr->cntx); ptr->cntx = 0; } ShowStatusIconNotify(wParam); return 1; @@ -124,18 +122,18 @@ INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) { bool del = true; if (bGPGloaded && bGPGkeyrings) { - char szKeyID[128]; szKeyID[0]='\0'; - gpg_select_keyid(GetForegroundWindow(),szKeyID); + char szKeyID[128]; szKeyID[0] = '\0'; + gpg_select_keyid(GetForegroundWindow(), szKeyID); if (szKeyID[0]) { db_set_s(wParam, MODULENAME, "gpg", szKeyID); del = false; } } - if (del) Service_GPGdelKey(wParam,lParam); + if (del) Service_GPGdelKey(wParam, lParam); else { pUinKey ptr = getUinKey(wParam); - cpp_delete_context(ptr->cntx); ptr->cntx=0; + cpp_delete_context(ptr->cntx); ptr->cntx = 0; } ShowStatusIconNotify(wParam); return 1; @@ -145,15 +143,15 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) { pUinKey ptr = getUinKey(wParam); - switch(--lParam) { + switch (--lParam) { case MODE_NATIVE: case MODE_RSAAES: if (isContactSecured(wParam)&SECURED) { msgbox(NULL, sim111, MODULENAME, MB_OK); return 0; } - if (lParam != MODE_NATIVE && ptr->status>STATUS_ENABLED ) - Service_Status(wParam,STATUS_ENABLED+1); + if (lParam != MODE_NATIVE && ptr->status > STATUS_ENABLED) + Service_Status(wParam, STATUS_ENABLED + 1); case MODE_PGP: case MODE_GPG: @@ -164,7 +162,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) ptr->cntx = 0; ptr->keyLoaded = 0; } - ptr->mode=(BYTE)lParam; + ptr->mode = (BYTE)lParam; db_set_b(wParam, MODULENAME, "mode", (BYTE)lParam); } ShowStatusIcon(wParam); @@ -176,23 +174,20 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl Service_ModeNative(WPARAM wParam, LPARAM lParam) { - return Service_Mode(wParam, MODE_NATIVE+1); + return Service_Mode(wParam, MODE_NATIVE + 1); } INT_PTR __cdecl Service_ModePGP(WPARAM wParam, LPARAM lParam) { - return Service_Mode(wParam, MODE_PGP+1); + return Service_Mode(wParam, MODE_PGP + 1); } INT_PTR __cdecl Service_ModeGPG(WPARAM wParam, LPARAM lParam) { - return Service_Mode(wParam, MODE_GPG+1); + return Service_Mode(wParam, MODE_GPG + 1); } - + INT_PTR __cdecl Service_ModeRSAAES(WPARAM wParam, LPARAM lParam) { - return Service_Mode(wParam, MODE_RSAAES+1); + return Service_Mode(wParam, MODE_RSAAES + 1); } - - -// EOF -- cgit v1.2.3