diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-22 16:04:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-22 16:04:17 +0000 |
commit | e2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch) | |
tree | ba79bdcede96f80039f8b88d2791f198b9ec2981 /protocols/VKontakte | |
parent | f8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (diff) |
T2Utf - handy replacement for ptrA<mir_utf8decodeT()>
git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 10 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_files.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_queue.cpp | 2 |
8 files changed, 15 insertions, 16 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index e90b7b84fd..357a094f69 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -463,9 +463,9 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul CMStringA name = getAttr(pFieldBeg, "name");
CMStringA value = getAttr(pFieldBeg, "value");
if (name == "email")
- value = ptrA(mir_utf8encodeT(ptrT(getTStringA("Login"))));
+ value = (char*)T2Utf(ptrT(getTStringA("Login")));
else if (name == "pass")
- value = ptrA(mir_utf8encodeT(ptrT(GetUserStoredPassword())));
+ value = (char*)T2Utf(ptrT(GetUserStoredPassword()));
else if (name == "captcha_key") {
char *pCaptchaBeg = strstr(pFormBeg, "<img id=\"captcha\"");
if (pCaptchaBeg != NULL)
@@ -580,9 +580,9 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact) {
debugLogA("CVkProto::DBAddAuthRequest");
- ptrA szNick(mir_utf8encodeT(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"))));
- ptrA szFirstName(mir_utf8encodeT(ptrT(db_get_tsa(hContact, m_szModuleName, "FirstName"))));
- ptrA szLastName(mir_utf8encodeT(ptrT(db_get_tsa(hContact, m_szModuleName, "LastName"))));
+ T2Utf szNick(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")));
+ T2Utf szFirstName(ptrT(db_get_tsa(hContact, m_szModuleName, "FirstName")));
+ T2Utf szLastName(ptrT(db_get_tsa(hContact, m_szModuleName, "LastName")));
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index ea75491a07..b2c7fd4060 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -376,7 +376,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) UnEscapeChatTags(buf);
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg, AsyncHttpRequest::rpHigh)
<< INT_PARAM("chat_id", cc->m_chatid)
- << CHAR_PARAM("message", mir_utf8encodeT(buf))
+ << CHAR_PARAM("message", T2Utf(buf))
<< VER_API;
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
Push(pReq);
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index cd84677cc8..966d1ccaee 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -54,7 +54,7 @@ void CVkProto::AddFeedEvent(CMString& tszBody, time_t tTime) }
MCONTACT hContact = FindUser(VK_FEED_USER, true);
- ptrA pszBody(mir_utf8encodeT(tszBody));
+ T2Utf pszBody(tszBody);
PROTORECVEVENT recv = { 0 };
recv.timestamp = tTime;
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 0bdf7aefeb..bcc509c3e4 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -48,7 +48,7 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() _tsplitpath(FileName, DRIVE, DIR, FNAME, EXT);
CMStringA fn;
- ptrA pszFNAME(mir_utf8encodeT(FNAME)), pszEXT(mir_utf8encodeT(EXT));
+ T2Utf pszFNAME(FNAME), pszEXT(EXT);
fn.AppendFormat("%s%s", pszFNAME, pszEXT);
fname = mir_strdup(fn.GetBuffer());
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index fb10ae9c05..a07b003730 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -216,6 +216,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque ptszBody = mir_tstrdup(CMString(ptszBody) + tszAttachmentDescr);
}
+ T2Utf pszBody(ptszBody);
MCONTACT hContact = FindUser(uid, true);
PROTORECVEVENT recv = { 0 };
if (isRead)
@@ -223,14 +224,13 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (isOut)
recv.flags |= PREF_SENT;
recv.timestamp = datetime;
- recv.szMessage = mir_utf8encodeT(ptszBody);
+ recv.szMessage = pszBody;
recv.lParam = isOut;
recv.pCustomData = szMid;
recv.cbCustomDataSize = (int)mir_strlen(szMid);
ProtoChainRecvMsg(hContact, &recv);
count++;
- mir_free((char*)recv.szMessage);
}
setDword(param->hContact, "lastmsgid", iLastMsgId);
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 6a9d6825ed..1c24dc30e5 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -253,8 +253,9 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe else if (m_bUserForceOnlineOnActivity)
SetInvisible(hContact);
+ T2Utf pszBody(ptszBody);
recv.timestamp = m_bUseLocalTime ? time(NULL) : datetime;
- recv.szMessage = mir_utf8encodeT(ptszBody);
+ recv.szMessage = pszBody;
recv.lParam = isOut;
recv.pCustomData = szMid;
recv.cbCustomDataSize = (int)mir_strlen(szMid);
@@ -270,8 +271,6 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (!isOut)
m_incIds.insert((HANDLE)mid);
}
-
- mir_free((char*)recv.szMessage);
}
if (!mids.IsEmpty())
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 78f417c487..0e169aceb9 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -67,7 +67,7 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP ppro->setTString("Login", str);
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
- ptrA szRawPasswd(mir_utf8encodeT(str));
+ T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
}
@@ -180,7 +180,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
- ptrA szRawPasswd(mir_utf8encodeT(str));
+ T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index c01442fa26..4934c3a29f 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -177,7 +177,7 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const CHAR_PARAM ¶m) AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const TCHAR_PARAM ¶m)
{
- ptrA szValue(mir_utf8encodeT(param.tszValue));
+ T2Utf szValue(param.tszValue);
CMStringA &s = pReq->m_szParam;
if (!s.IsEmpty())
s.AppendChar('&');
|