diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-21 16:11:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-21 16:11:58 +0000 |
commit | 48266e479d1fcf5153b29c612866845990fccad8 (patch) | |
tree | c8cbc908cd3c5f08731e5e8d7eaac6b568007d09 /plugins/SecureIM/src/crypt_dll.cpp | |
parent | ebdb556f152734035846f120eb8112f88ef91281 (diff) |
war against atavisms continues
- everything that goes to PSS_MESSAGE should be sent as utf8 string;
- thus PREF_UNICODE & PREF_UTF support discontinued, these constants are removed;
- support for PREF_UNICODE & PREF_UTF in protocols also removed;
- PREF_UNICODE used in file transfers (PROTOFILERECVT) replaced with PRFF_UNICODE / PRFF_TCHAR
git-svn-id: http://svn.miranda-ng.org/main/trunk@13734 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
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;
|