diff options
Diffstat (limited to 'plugins/SecureIM/svcs_proto.cpp')
-rw-r--r-- | plugins/SecureIM/svcs_proto.cpp | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/plugins/SecureIM/svcs_proto.cpp b/plugins/SecureIM/svcs_proto.cpp index e6e538c60a..a69d7d720d 100644 --- a/plugins/SecureIM/svcs_proto.cpp +++ b/plugins/SecureIM/svcs_proto.cpp @@ -7,7 +7,7 @@ int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg=NULL) { 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--) {
- if( szMsg[i] == '\x0D' || szMsg[i] == '\x0A' )
+ if ( szMsg[i] == '\x0D' || szMsg[i] == '\x0A' )
((LPSTR)szMsg)[i] = '\0';
else
break;
@@ -56,7 +56,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { #endif
// cut rtf tags
- if( pRtfconvString && memcmp(szEncMsg,"{\\rtf1",6)==0 ) {
+ if ( pRtfconvString && memcmp(szEncMsg,"{\\rtf1",6)==0 ) {
SAFE_FREE(szUnrtfMsg);
int len = (int)strlen(szEncMsg)+1;
LPWSTR szTemp = (LPWSTR)mir_alloc(len*sizeof(WCHAR));
@@ -66,7 +66,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { rtfconvA(szEncMsg,szTemp);
len = (int)wcslen(szTemp)-1;
while(len) {
- if( szTemp[len] == 0x0D || szTemp[len] == 0x0A )
+ if ( szTemp[len] == 0x0D || szTemp[len] == 0x0A )
szTemp[len] = 0;
else
break;
@@ -87,12 +87,12 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { BOOL bGPG = isContactGPG(pccsd->hContact);
// HANDLE hMetaContact = getMetaContact(pccsd->hContact);
-// if( hMetaContact ) {
+// if ( hMetaContact ) {
// ptr = getUinKey(hMetaContact);
// }
// pass any unchanged message
- if( !ptr ||
+ if ( !ptr ||
ssig==SiG_GAME ||
!isSecureProtocol(pccsd->hContact) ||
(isProtoMetaContacts(pccsd->hContact) && (pccsd->wParam & PREF_SIMNOMETA)) ||
@@ -106,7 +106,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// drop message: fake, unsigned or from invisible contacts
- if( isContactInvisible(pccsd->hContact) || ssig==SiG_FAKE ) {
+ if ( isContactInvisible(pccsd->hContact) || ssig==SiG_FAKE ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: drop unhandled (contact invisible or hidden)");
#endif
@@ -114,7 +114,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// receive non-secure message in secure mode
- if( ssig==SiG_NONE && !ptr->msgSplitted ) {
+ if ( ssig==SiG_NONE && !ptr->msgSplitted ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: non-secure message");
#endif
@@ -132,11 +132,11 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// received non-pgp secure message from disabled contact
- if( ssig!=SiG_PGPM && !bPGP && !bGPG && ptr->status==STATUS_DISABLED ) {
+ if ( ssig!=SiG_PGPM && !bPGP && !bGPG && ptr->status==STATUS_DISABLED ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: message from disabled");
#endif
- if( ptr->mode==MODE_NATIVE ) {
+ if ( ptr->mode==MODE_NATIVE ) {
// tell to the other side that we have the plugin disabled with him
pccsd->wParam |= PREF_METANODB;
pccsd->lParam = (LPARAM) SIG_DISA;
@@ -155,7 +155,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// combine message splitted by protocol (no tags)
- if( ssig==SiG_NONE && ptr->msgSplitted ) {
+ if ( ssig==SiG_NONE && ptr->msgSplitted ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: combine untagged splitted message");
#endif
@@ -171,15 +171,15 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// combine message splitted by secureim (with tags)
- if( ssig==SiG_SECP || ssig==SiG_PART ) {
+ if ( ssig==SiG_SECP || ssig==SiG_PART ) {
LPSTR msg = combineMessage(ptr,szEncMsg);
- if( !msg ) return 1;
+ if ( !msg ) return 1;
szEncMsg = ppre->szMessage = msg;
ssig = getSecureSig(msg,&szEncMsg);
}
// decrypt PGP/GPG message
- if( ssig==SiG_PGPM &&
+ if ( ssig==SiG_PGPM &&
((bPGPloaded && (bPGPkeyrings || bPGPprivkey))||
(bGPGloaded && bGPGkeyrings))
) {
@@ -187,25 +187,25 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { Sent_NetLog("onRecvMsg: PGP/GPG message");
#endif
szEncMsg = ppre->szMessage;
- if( !ptr->cntx ) {
+ if ( !ptr->cntx ) {
ptr->cntx = cpp_create_context(((bGPGloaded && bGPGkeyrings)?CPP_MODE_GPG:CPP_MODE_PGP) | ((DBGetContactSettingByte(pccsd->hContact,szModuleName,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
ptr->keyLoaded = 0;
}
- if(!strstr(szEncMsg,"-----END PGP MESSAGE-----"))
+ if (!strstr(szEncMsg,"-----END PGP MESSAGE-----"))
return 1; // no end tag, don't display it ...
LPSTR szNewMsg = NULL;
LPSTR szOldMsg = NULL;
- if(!ptr->keyLoaded && bPGPloaded) ptr->keyLoaded = LoadKeyPGP(ptr);
- if(!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr);
+ 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);
else
if(ptr->keyLoaded==2) szOldMsg = gpg_decode(ptr->cntx, szEncMsg);
- if(!szOldMsg) { // error while decrypting message, send error
+ if (!szOldMsg) { // error while decrypting message, send error
SAFE_FREE(ptr->msgSplitted);
ppre->flags &= ~(PREF_UNICODE|PREF_UTF);
pccsd->wParam &= ~(PREF_UNICODE|PREF_UTF);
@@ -214,7 +214,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// receive encrypted message in non-encrypted mode
- if(!isContactPGP(pccsd->hContact) && !isContactGPG(pccsd->hContact)) {
+ if (!isContactPGP(pccsd->hContact) && !isContactGPG(pccsd->hContact)) {
szNewMsg = m_ustrcat(TranslateU(sim403),szOldMsg);
szOldMsg = szNewMsg;
}
@@ -242,18 +242,18 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: RSA/AES message");
#endif
- if( ptr->mode==MODE_NATIVE ) {
+ if ( ptr->mode==MODE_NATIVE ) {
ptr->mode = MODE_RSAAES;
deleteRSAcntx(ptr);
DBWriteContactSettingByte(ptr->hContact, szModuleName, "mode", ptr->mode);
}
createRSAcntx(ptr);
loadRSAkey(ptr);
- if( exp->rsa_get_state(ptr->cntx)==0 )
+ if ( exp->rsa_get_state(ptr->cntx)==0 )
showPopUpKR(ptr->hContact);
LPSTR szOldMsg = exp->rsa_recv(ptr->cntx,szEncMsg);
- if( !szOldMsg ) return 1; // don't display it ...
+ if ( !szOldMsg ) return 1; // don't display it ...
LPSTR szNewMsg = utf8_to_miranda(szOldMsg,ppre->flags); pccsd->wParam = ppre->flags;
ppre->szMessage = szNewMsg;
@@ -271,10 +271,10 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: Native SiG_ENON message");
#endif
- if( cpp_keyx(ptr->cntx) ) {
+ if ( cpp_keyx(ptr->cntx) ) {
// decrypting message
szPlainMsg = decodeMsg(ptr,lParam,szEncMsg);
- if(!ptr->decoded) {
+ if (!ptr->decoded) {
mir_free(szPlainMsg);
SAFE_FREE(ptr->msgSplitted);
ptr->msgSplitted=mir_strdup(szEncMsg);
@@ -322,7 +322,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if( DBGetContactSetting(ptr->hContact,szModuleName,"offlineKey",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,szModuleName,"offlineKey",&dbv) == 0 ) {
// if valid key is succefully retrieved
ptr->offlineKey = true;
InitKeyX(ptr,dbv.pbVal);
@@ -377,7 +377,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { case SiG_KEYR: // key3 message
case SiG_KEYA: // keyA message
case SiG_KEYB: { // keyB message
- if( ptr->mode==MODE_RSAAES ) {
+ if ( ptr->mode==MODE_RSAAES ) {
ptr->mode = MODE_NATIVE;
cpp_delete_context(ptr->cntx);
ptr->cntx = 0;
@@ -392,12 +392,12 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { // receive KeyB from user;
showPopUpKR(ptr->hContact);
- if( ptr->cntx && cpp_keyb(ptr->cntx) ) {
+ if ( ptr->cntx && cpp_keyb(ptr->cntx) ) {
// reinit key exchange if an old key from user is found
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_KEYR InitKeyB error");
#endif
@@ -416,7 +416,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// other side support RSA mode ?
- if( ptr->features & CPP_FEATURES_RSA ) {
+ if ( ptr->features & CPP_FEATURES_RSA ) {
// switch to RSAAES mode
ptr->mode = MODE_RSAAES;
DBWriteContactSettingByte(ptr->hContact, szModuleName, "mode", ptr->mode);
@@ -431,7 +431,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// other side support new key format ?
- if( ptr->features & CPP_FEATURES_NEWPG ) {
+ if ( ptr->features & CPP_FEATURES_NEWPG ) {
cpp_reset_context(ptr->cntx);
LPSTR keyToSend = InitKeyA(ptr,CPP_FEATURES_NEWPG|KEY_A_SIG); // calculate NEW public and private key
@@ -450,7 +450,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { }
// auto send my public key to keyB user if not done before
- if( !cpp_keya(ptr->cntx) ) {
+ if ( !cpp_keya(ptr->cntx) ) {
LPSTR keyToSend = InitKeyA(ptr,0); // calculate public and private key
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: Sending KEYA %s", keyToSend);
@@ -510,7 +510,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { showPopUpKR(ptr->hContact);
// clear all and send DISA if received KeyB, and not exist KeyA or error on InitKeyB
- if(!cpp_keya(ptr->cntx) || InitKeyB(ptr,szEncMsg)!=CPP_ERROR_NONE) {
+ if (!cpp_keya(ptr->cntx) || InitKeyB(ptr,szEncMsg)!=CPP_ERROR_NONE) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: SiG_KEYB InitKeyB error");
#endif
@@ -534,7 +534,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { /* common part (CalcKeyX & SendQueue) */
// calculate KeyX
- if( cpp_keya(ptr->cntx) && cpp_keyb(ptr->cntx) && !cpp_keyx(ptr->cntx) )
+ if ( cpp_keya(ptr->cntx) && cpp_keyb(ptr->cntx) && !cpp_keyx(ptr->cntx) )
CalculateKeyX(ptr,ptr->hContact);
ShowStatusIconNotify(ptr->hContact);
@@ -550,7 +550,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { } //switch
// receive message
- if( cpp_keyx(ptr->cntx) && (ssig==SiG_ENON||ssig==SiG_ENOF) ) {
+ if ( cpp_keyx(ptr->cntx) && (ssig==SiG_ENON||ssig==SiG_ENOF) ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: message received");
#endif
@@ -568,10 +568,10 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { // SendMsgW handler
INT_PTR __cdecl onSendMsgW(WPARAM wParam, LPARAM lParam) {
- if(!lParam) return 0;
+ if (!lParam) return 0;
CCSDATA *ccs = (CCSDATA *) lParam;
- if( !(ccs->wParam & PREF_UTF) )
+ if ( !(ccs->wParam & PREF_UTF) )
ccs->wParam |= PREF_UNICODE;
return onSendMsg(wParam, lParam);
@@ -587,7 +587,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { int stat = getContactStatus(pccsd->hContact);
// HANDLE hMetaContact = getMetaContact(pccsd->hContact);
-// if( hMetaContact ) {
+// if ( hMetaContact ) {
// ptr = getUinKey(hMetaContact);
// }
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -611,12 +611,12 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { //
// PGP/GPG mode
//
- if( ptr->mode==MODE_PGP || ptr->mode==MODE_GPG ) {
+ if ( ptr->mode==MODE_PGP || ptr->mode==MODE_GPG ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: PGP|GPG mode");
#endif
// если можно зашифровать - шифруем
- if( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact) ) {
+ if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact) ) {
/*
if(stat==ID_STATUS_OFFLINE) {
if (msgbox1(0,sim110,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) {
@@ -626,25 +626,25 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
*/
- if( !ptr->cntx ) {
+ if ( !ptr->cntx ) {
ptr->cntx = cpp_create_context((isContactGPG(ptr->hContact)?CPP_MODE_GPG:CPP_MODE_PGP) | ((DBGetContactSettingByte(ptr->hContact,szModuleName,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
ptr->keyLoaded = 0;
}
- if( !ptr->keyLoaded && bPGPloaded ) ptr->keyLoaded = LoadKeyPGP(ptr);
- if( !ptr->keyLoaded && bGPGloaded ) ptr->keyLoaded = LoadKeyGPG(ptr);
- if( !ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
+ if ( !ptr->keyLoaded && bPGPloaded ) ptr->keyLoaded = LoadKeyPGP(ptr);
+ if ( !ptr->keyLoaded && bGPGloaded ) ptr->keyLoaded = LoadKeyGPG(ptr);
+ if ( !ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
LPSTR szNewMsg = NULL;
LPSTR szUtfMsg = miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam);
- if( ptr->keyLoaded == 1 ) { // PGP
+ if ( ptr->keyLoaded == 1 ) { // PGP
szNewMsg = pgp_encode(ptr->cntx,szUtfMsg);
}
else
- if( ptr->keyLoaded == 2 ) { // GPG
+ if ( ptr->keyLoaded == 2 ) { // GPG
szNewMsg = gpg_encode(ptr->cntx,szUtfMsg);
}
mir_free(szUtfMsg);
- if( !szNewMsg ) {
+ if ( !szNewMsg ) {
return returnError(pccsd->hContact,Translate(sim109));
}
@@ -667,22 +667,22 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { //
// RSA/AES mode
//
- if( ptr->mode==MODE_RSAAES ) {
+ if ( ptr->mode==MODE_RSAAES ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: RSA/AES mode");
#endif
// contact is offline
if ( stat==ID_STATUS_OFFLINE ) {
- if( ptr->cntx ) {
- if( exp->rsa_get_state(ptr->cntx)!=0 ) {
+ if ( ptr->cntx ) {
+ if ( exp->rsa_get_state(ptr->cntx)!=0 ) {
resetRSAcntx(ptr);
}
}
else {
createRSAcntx(ptr);
}
- if( !bSOM || (!isClientMiranda(ptr,1) && !isSecureIM(ptr,1)) || !loadRSAkey(ptr) ) {
- if( ssig==SiG_NONE ) {
+ if ( !bSOM || (!isClientMiranda(ptr,1) && !isSecureIM(ptr,1)) || !loadRSAkey(ptr) ) {
+ if ( ssig==SiG_NONE ) {
// просто шлем незашифрованное в оффлайн
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
@@ -699,12 +699,12 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { return returnNoError(pccsd->hContact);
}
// SecureIM connection with this contact is disabled
- if( stid==STATUS_DISABLED ) {
- if( ptr->cntx ) {
+ if ( stid==STATUS_DISABLED ) {
+ if ( ptr->cntx ) {
exp->rsa_disabled(ptr->cntx);
deleteRSAcntx(ptr);
}
- if( ssig==SiG_NONE ) {
+ if ( ssig==SiG_NONE ) {
// просто шлем незашифрованное
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
@@ -712,8 +712,8 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { return returnNoError(pccsd->hContact);
}
// разорвать соединение
- if( ssig==SiG_DEIN ) {
- if( ptr->cntx ) {
+ if ( ssig==SiG_DEIN ) {
+ if ( ptr->cntx ) {
exp->rsa_disconnect(ptr->cntx);
deleteRSAcntx(ptr);
}
@@ -721,7 +721,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { return returnNoError(pccsd->hContact);
}
// соединение установлено
- if( ptr->cntx && exp->rsa_get_state(ptr->cntx)==7 ) {
+ if ( ptr->cntx && exp->rsa_get_state(ptr->cntx)==7 ) {
LPSTR szUtfMsg = miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam);
exp->rsa_send(ptr->cntx,szUtfMsg);
mir_free(szUtfMsg);
@@ -729,7 +729,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { return returnNoError(pccsd->hContact);
}
// просто сообщение (без тэгов, нет контекста и работают AIP & NOL)
- if( ssig==SiG_NONE && isSecureIM(ptr->hContact) ) {
+ if ( ssig==SiG_NONE && isSecureIM(ptr->hContact) ) {
// добавим его в очередь
addMsg2Queue(ptr, pccsd->wParam, (LPSTR)pccsd->lParam);
// запускаем процесс установки соединения
@@ -738,7 +738,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { waitForExchange(ptr);
}
// установить соединение
- if( ssig==SiG_INIT ) {
+ if ( ssig==SiG_INIT ) {
createRSAcntx(ptr);
loadRSAkey(ptr);
exp->rsa_connect(ptr->cntx);
@@ -758,12 +758,12 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { #endif
// SecureIM connection with this contact is disabled
- if( stid==STATUS_DISABLED ) {
+ if ( stid==STATUS_DISABLED ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: message for Disabled");
#endif
// if user try initialize connection
- if( ssig==SiG_INIT ) {
+ if ( ssig==SiG_INIT ) {
// secure IM is disabled ...
return returnError(pccsd->hContact,Translate(sim105));
}
@@ -785,17 +785,17 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { }
// contact is offline
- if( stat==ID_STATUS_OFFLINE ) {
+ if ( stat==ID_STATUS_OFFLINE ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: message for offline");
#endif
- if( ssig==SiG_INIT && cpp_keyx(ptr->cntx) ) {
+ if ( ssig==SiG_INIT && cpp_keyx(ptr->cntx) ) {
// reinit key exchange
cpp_reset_context(ptr->cntx);
}
- if( !bSOM ) {
- if( ssig!=SiG_NONE ) {
+ if ( !bSOM ) {
+ if ( ssig!=SiG_NONE ) {
return returnNoError(pccsd->hContact);
}
// exit and send unencrypted message
@@ -803,10 +803,10 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { }
BOOL isMiranda = isClientMiranda(ptr->hContact);
- if( stid==STATUS_ALWAYSTRY && isMiranda ) { // always try && Miranda
+ if ( stid==STATUS_ALWAYSTRY && isMiranda ) { // always try && Miranda
// set key for offline user
DBVARIANT dbv; dbv.type = DBVT_BLOB;
- if( DBGetContactSettingDword(ptr->hContact, szModuleName, "offlineKeyTimeout", 0) > gettime() &&
+ if ( DBGetContactSettingDword(ptr->hContact, szModuleName, "offlineKeyTimeout", 0) > gettime() &&
DBGetContactSetting(ptr->hContact, szModuleName, "offlineKey", &dbv) == 0
) {
// if valid key is succefully retrieved
@@ -829,7 +829,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { int res=msgbox1(0,"User is offline now, Do you want to send your message ?\nIt will be unencrypted !","Can't Send Encrypted Message !",MB_YESNO);
if (res==IDNO) return 1;
}*/
- if( ssig!=SiG_NONE ) {
+ if ( ssig!=SiG_NONE ) {
return returnNoError(pccsd->hContact);
}
// exit and send unencrypted message
@@ -842,7 +842,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { Sent_NetLog("onSendMsg: message for online");
#endif
// contact is online and we use an offline key -> reset offline key
- if( ptr->offlineKey ) {
+ if ( ptr->offlineKey ) {
cpp_reset_context(ptr->cntx);
ptr->offlineKey = false;
ShowStatusIconNotify(ptr->hContact);
@@ -850,7 +850,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { }
// if init is called from contact menu list reinit secure im connection
- if( ssig==SiG_INIT ) {
+ if ( ssig==SiG_INIT ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: SiG_INIT");
#endif
@@ -858,7 +858,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { }
// if deinit is called from contact menu list deinit secure im connection
- if( ssig==SiG_DEIN ) {
+ if ( ssig==SiG_DEIN ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: SiG_DEIN");
#endif
@@ -875,17 +875,17 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { return returnNoError(pccsd->hContact);
}
- if( cpp_keya(ptr->cntx) && cpp_keyb(ptr->cntx) && !cpp_keyx(ptr->cntx) )
+ if ( cpp_keya(ptr->cntx) && cpp_keyb(ptr->cntx) && !cpp_keyx(ptr->cntx) )
CalculateKeyX(ptr,ptr->hContact);
ShowStatusIconNotify(pccsd->hContact);
// if cryptokey exist
- if( cpp_keyx(ptr->cntx) ) {
+ if ( cpp_keyx(ptr->cntx) ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: cryptokey exist");
#endif
-/* if( !hMetaContact && isProtoMetaContacts(pccsd->hContact) && (DBGetContactSettingByte(NULL, "MetaContacts", "SubcontactHistory", 1) == 1)) {
+/* if ( !hMetaContact && isProtoMetaContacts(pccsd->hContact) && (DBGetContactSettingByte(NULL, "MetaContacts", "SubcontactHistory", 1) == 1)) {
// add sent event to subcontact
DBEVENTINFO dbei; HANDLE hC = getMostOnline(pccsd->hContact);
ZeroMemory(&dbei, sizeof(dbei));
@@ -926,11 +926,11 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { Sent_NetLog("onSendMsg: cryptokey not exist, try establishe connection");
#endif
// send KeyA if init || always_try || waitkey || always_if_possible
- if( ssig==SiG_INIT || (stid==STATUS_ALWAYSTRY && isClientMiranda(ptr->hContact)) || isSecureIM(ptr->hContact) || ptr->waitForExchange ) {
+ if ( ssig==SiG_INIT || (stid==STATUS_ALWAYSTRY && isClientMiranda(ptr->hContact)) || isSecureIM(ptr->hContact) || ptr->waitForExchange ) {
if (ssig==SiG_NONE) {
addMsg2Queue(ptr, pccsd->wParam, (LPSTR)pccsd->lParam);
}
- if( !ptr->waitForExchange ) {
+ if ( !ptr->waitForExchange ) {
// init || always_try || always_if_possible
LPSTR keyToSend = InitKeyA(ptr,0); // calculate public and private key & fill KeyA
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -967,7 +967,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { pUinKey ptr = getUinKey(pccsd->hContact);
if (!ptr || !bSFT) return CallService(PSS_FILE, wParam, lParam);
- if( isContactSecured(pccsd->hContact)&SECURED ) {
+ if ( isContactSecured(pccsd->hContact)&SECURED ) {
char **file=(char **)pccsd->lParam;
if(file_idx==100) file_idx=0;
@@ -977,7 +977,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { if (strstr(file[i],".AESHELL")) continue;
char *name = strrchr(file[i],'\\');
- if( !name ) name = file[i];
+ if ( !name ) name = file[i];
else name++;
char *file_out = (char*) mir_alloc(TEMP_SIZE+strlen(name)+20);
@@ -987,7 +987,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { sprintf(buf,"%s\n%s",Translate(sim011),file[i]);
showPopUp(buf,NULL,g_hPOP[POP_PU_MSS],2);
- if( ptr->mode==MODE_RSAAES ) {
+ if ( ptr->mode==MODE_RSAAES ) {
exp->rsa_encrypt_file(ptr->cntx,file[i],file_out);
}
else {
@@ -997,13 +997,13 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { mir_free(file[i]);
file[i]=file_out;
}
- if( ptr->fileSend ) { // очистим сохраненный список
+ if ( ptr->fileSend ) { // очистим сохраненный список
for(int j=0;ptr->fileSend[j];j++) {
mir_free(ptr->fileSend[j]);
}
SAFE_FREE(ptr->fileSend);
}
- if( i ) { // скопируем новый список
+ if ( i ) { // скопируем новый список
ptr->fileSend = (char **) mir_alloc(sizeof(char*)*(i+1));
for(i=0;file[i];i++) {
ptr->fileSend[i] = mir_strdup(file[i]);
@@ -1042,35 +1042,35 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { pUinKey ptr = getUinKey(ack->hContact);
if (!ptr || (f && (f->flags & PFTS_SENDING) && !bSFT)) return 0;
- if( isContactSecured(ack->hContact)&SECURED ) {
+ if ( isContactSecured(ack->hContact)&SECURED ) {
switch(ack->result) {
// case ACKRESULT_FILERESUME:
case ACKRESULT_DATA: {
- if( !( f->flags & PFTS_SENDING )) {
+ if ( !( f->flags & PFTS_SENDING )) {
ptr->finFileRecv = (f->currentFileSize == f->currentFileProgress);
- if( !ptr->lastFileRecv ) ptr->lastFileRecv = mir_strdup(f->szCurrentFile);
+ if ( !ptr->lastFileRecv ) ptr->lastFileRecv = mir_strdup(f->szCurrentFile);
}
else
- if( f->flags & PFTS_SENDING ) {
+ if ( f->flags & PFTS_SENDING ) {
ptr->finFileSend = (f->currentFileSize == f->currentFileProgress);
- if( !ptr->lastFileSend ) ptr->lastFileSend = mir_strdup(f->szCurrentFile);
+ if ( !ptr->lastFileSend ) ptr->lastFileSend = mir_strdup(f->szCurrentFile);
}
} break;
// case ACKRESULT_INITIALISING:
case ACKRESULT_DENIED:
case ACKRESULT_FAILED: {
- if( ptr->lastFileRecv ) {
+ if ( ptr->lastFileRecv ) {
if (strstr(ptr->lastFileRecv,".AESHELL")) mir_unlink(ptr->lastFileRecv);
SAFE_FREE(ptr->lastFileRecv);
}
- if( ptr->lastFileSend ) {
+ if ( ptr->lastFileSend ) {
if (strstr(ptr->lastFileSend,".AESHELL")) mir_unlink(ptr->lastFileSend);
SAFE_FREE(ptr->lastFileSend);
}
- if( ptr->fileSend ) {
+ if ( ptr->fileSend ) {
char **file=ptr->fileSend;
for(int j=0;file[j];j++) {
- if( strstr(file[j],".AESHELL") ) mir_unlink(file[j]);
+ if ( strstr(file[j],".AESHELL") ) mir_unlink(file[j]);
mir_free(file[j]);
}
SAFE_FREE(ptr->fileSend);
@@ -1079,14 +1079,14 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { } break;
case ACKRESULT_NEXTFILE:
case ACKRESULT_SUCCESS: {
- if( ptr->finFileRecv && ptr->lastFileRecv ) {
- if( strstr(ptr->lastFileRecv,".AESHELL") ) {
+ if ( ptr->finFileRecv && ptr->lastFileRecv ) {
+ if ( strstr(ptr->lastFileRecv,".AESHELL") ) {
char buf[MAX_PATH];
LPSTR file_out=mir_strdup(ptr->lastFileRecv);
LPSTR pos=strrchr(file_out,'.'); //find last .
if (pos) *pos='\0'; //remove AESHELL from name
- if( isFileExist(file_out) ) {
+ if ( isFileExist(file_out) ) {
buf[0]='\0';
LPSTR p=strrchr(file_out,'.');
LPSTR x=strrchr(file_out,'\\');
@@ -1096,14 +1096,14 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { }
for(int i=1;i<10000;i++) {
sprintf(pos," (%d)%s",i,buf);
- if( !isFileExist(file_out) ) break;
+ if ( !isFileExist(file_out) ) break;
}
}
sprintf(buf,"%s\n%s",Translate(sim012),file_out);
showPopUp(buf,NULL,g_hPOP[POP_PU_MSR],2);
- if( ptr->mode==MODE_RSAAES ) {
+ if ( ptr->mode==MODE_RSAAES ) {
exp->rsa_decrypt_file(ptr->cntx,ptr->lastFileRecv,file_out);
}
else {
@@ -1115,8 +1115,8 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { SAFE_FREE(ptr->lastFileRecv);
ptr->finFileRecv = false;
}
- if( ptr->finFileSend && ptr->lastFileSend ) {
- if( strstr(ptr->lastFileSend,".AESHELL") ) mir_unlink(ptr->lastFileSend);
+ if ( ptr->finFileSend && ptr->lastFileSend ) {
+ if ( strstr(ptr->lastFileSend,".AESHELL") ) mir_unlink(ptr->lastFileSend);
SAFE_FREE(ptr->lastFileSend);
ptr->finFileSend = false;
}
|