diff options
Diffstat (limited to 'plugins/SecureIM/src/crypt_dll.cpp')
| -rw-r--r-- | plugins/SecureIM/src/crypt_dll.cpp | 32 | 
1 files changed, 5 insertions, 27 deletions
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index d7c57ea17a..a40b6c4974 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -121,18 +121,7 @@ LPSTR encrypt(pUinKey ptr, LPCSTR szEncMsg)  LPSTR encodeMsg(pUinKey ptr, LPARAM lParam)
  {
  	CCSDATA *pccsd = (CCSDATA *)lParam;
 -	LPSTR szNewMsg = NULL;
 -	LPSTR szOldMsg = (LPSTR)pccsd->lParam;
 -
 -	if (pccsd->wParam & PREF_UTF)
 -		szNewMsg = encrypt(ptr, cpp_encodeU(ptr->cntx, szOldMsg));
 -	else if (pccsd->wParam & PREF_UNICODE)
 -		szNewMsg = encrypt(ptr, cpp_encodeW(ptr->cntx, (LPWSTR)(szOldMsg + strlen(szOldMsg) + 1)));
 -	else
 -		szNewMsg = encrypt(ptr, cpp_encodeA(ptr->cntx, szOldMsg));
 -
 -	pccsd->wParam &= ~PREF_UNICODE;
 -	return szNewMsg;
 +	return encrypt(ptr, cpp_encodeU(ptr->cntx, (LPSTR)pccsd->lParam));
  }
 @@ -143,7 +132,7 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg)  	PROTORECVEVENT *ppre = (PROTORECVEVENT *)pccsd->lParam;
  	LPSTR szNewMsg = NULL;
 -	LPSTR szOldMsg = (ppre->flags&PREF_UTF) ? cpp_decodeU(ptr->cntx, szEncMsg) : cpp_decode(ptr->cntx, szEncMsg);
 +	LPSTR szOldMsg = cpp_decodeU(ptr->cntx, szEncMsg);
  	if (szOldMsg == NULL) {
  		ptr->decoded = false;
 @@ -159,23 +148,12 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg)  			szNewMsg = mir_strdup(Translate(sim101));
  			break;
  		}
 -		ppre->flags &= ~(PREF_UNICODE | PREF_UTF);
 -		pccsd->wParam &= ~(PREF_UNICODE | PREF_UTF);
  	}
  	else {
  		ptr->decoded = true;
 -		if (ppre->flags & PREF_UTF) {
 -			int olen = (int)strlen(szOldMsg) + 1;
 -			szNewMsg = (LPSTR)mir_alloc(olen);
 -			memcpy(szNewMsg, szOldMsg, olen);
 -		}
 -		else {
 -			int olen = ((int)strlen(szOldMsg) + 1)*(sizeof(WCHAR) + 1);
 -			szNewMsg = (LPSTR)mir_alloc(olen);
 -			memcpy(szNewMsg, szOldMsg, olen);
 -			ppre->flags |= PREF_UNICODE;
 -			pccsd->wParam |= PREF_UNICODE;
 -		}
 +		int olen = (int)strlen(szOldMsg) + 1;
 +		szNewMsg = (LPSTR)mir_alloc(olen);
 +		memcpy(szNewMsg, szOldMsg, olen);
  	}
  	ppre->szMessage = szNewMsg;
  	return szNewMsg;
  | 
