From 97e0ada5c34d6e7eba1cf47a8d8ac029197be6de Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Mon, 1 Dec 2014 04:22:16 +0000 Subject: VKontakte: replace all L-string to _T-string replace strlen -> mir_strlen code cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@11187 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 18 +++--- protocols/VKontakte/src/vk_avatars.cpp | 8 +-- protocols/VKontakte/src/vk_chats.cpp | 6 +- protocols/VKontakte/src/vk_files.cpp | 40 ++++++------ protocols/VKontakte/src/vk_history.cpp | 2 +- protocols/VKontakte/src/vk_proto.cpp | 6 +- protocols/VKontakte/src/vk_search.cpp | 4 +- protocols/VKontakte/src/vk_thread.cpp | 114 +++++++++++++++++---------------- 8 files changed, 101 insertions(+), 97 deletions(-) (limited to 'protocols') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 91df3a9a3f..2bf4fc1aa8 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -174,7 +174,7 @@ void CVkProto::OnReceiveSmth(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { JSONROOT pRoot; JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); - debugLog(L"CVkProto::OnReceiveSmth %s", json_as_string(pResponse)); + debugLog(_T("CVkProto::OnReceiveSmth %s"), json_as_string(pResponse)); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -224,7 +224,7 @@ static CMStringA getAttr(char *szSrc, LPCSTR szAttrName) return ""; } - p1 += strlen(szAttrName); + p1 += mir_strlen(szAttrName); if (p1[0] != '=' || p1[1] != '\"'){ *pEnd = '>'; return ""; @@ -425,7 +425,7 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact) dbei.timestamp = (DWORD)time(NULL); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + strlen(szNick) + 5); + dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + 5); PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); @@ -436,7 +436,7 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact) pCurBlob += sizeof(DWORD); // hContact(DWORD) strcpy((char*)pCurBlob, szNick); - pCurBlob += strlen(szNick) + 1; + pCurBlob += mir_strlen(szNick) + 1; *pCurBlob = '\0'; //firstName pCurBlob++; @@ -538,8 +538,8 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) bool tlstrstr(TCHAR* _s1, TCHAR* _s2) { TCHAR s1[1024], s2[1024]; - mir_sntprintf(s1, SIZEOF(s1), L"%s", _s1); - mir_sntprintf(s2, SIZEOF(s2), L"%s", _s2); + mir_sntprintf(s1, SIZEOF(s1), _T("%s"), _s1); + mir_sntprintf(s2, SIZEOF(s2), _T("%s"), _s2); CharLowerBuff(s1, SIZEOF(s1)); CharLowerBuff(s2, SIZEOF(s2)); return _tcsstr(s1, s2) != NULL; @@ -574,7 +574,7 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) return; TCHAR ttime[64]; - _tcsftime(ttime, SIZEOF(ttime), L"%X", localtime(&time)); + _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&time)); StatusTextData st = { 0 }; st.cbSize = sizeof(st); @@ -591,8 +591,8 @@ char* CVkProto::GetStickerId(const char* Msg, int &stickerid) iRes = sscanf(Msg, "[sticker:%d]", &stickerid); if (iRes == 1){ mir_snprintf(HeadMsg, 32, "[sticker:%d]", stickerid); - size_t retLen = strlen(HeadMsg); - if (retLen < strlen(Msg)) + size_t retLen = mir_strlen(HeadMsg); + if (retLen < mir_strlen(Msg)) retMsg = mir_strdup(&Msg[retLen]); return retMsg; } diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 8f6dfa96ec..d9dbcc6476 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -26,7 +26,7 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq) GetAvatarFileName((MCONTACT)pReq->pUserInfo, AI.filename, SIZEOF(AI.filename)); AI.format = ProtoGetBufferFormat(reply->pData); - FILE *out = _tfopen(AI.filename, L"wb"); + FILE *out = _tfopen(AI.filename, _T("wb")); if (out == NULL) { ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0); return; @@ -125,7 +125,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen) { - int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -133,7 +133,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen pszDest[tPathLen++] = '\\'; - const TCHAR* szFileType = L".jpg"; + const TCHAR* szFileType = _T(".jpg"); ptrT szUrl(getTStringA(hContact, "AvatarUrl")); if (szUrl) { TCHAR *p = _tcsrchr(szUrl, '.'); @@ -142,7 +142,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen } LONG id = getDword(hContact, "ID", -1); - mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType); + mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%d%s"), id, szFileType); } void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 01ffaf8ce8..575feedb72 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -28,7 +28,7 @@ static LPCTSTR sttStatuses[] = { LPGENT("Participants"), LPGENT("Owners") }; CVkChatInfo* CVkProto::AppendChat(int id, JSONNODE *pDlg) { - debugLog(L"CVkProto::AppendChat"); + debugLog(_T("CVkProto::AppendChat")); if (id == 0) return NULL; @@ -49,7 +49,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, JSONNODE *pDlg) } CMString sid; - sid.Format(L"%S_%d", m_szModuleName, id); + sid.Format(_T("%S_%d"), m_szModuleName, id); c->m_tszId = mir_tstrdup(sid); GCSESSION gcw = { sizeof(gcw) }; @@ -292,7 +292,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int mid, int uid, int msgTime, gce.time = msgTime; gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG; gce.ptszNick = cu->m_tszNick ? mir_tstrdup(cu->m_tszNick) : mir_tstrdup(TranslateT("Unknown")); - gce.ptszText = tszBody.IsEmpty() ? mir_tstrdup(L"...") : mir_tstrdup(tszBody.GetBuffer()); + gce.ptszText = tszBody.IsEmpty() ? mir_tstrdup(_T("...")) : mir_tstrdup(tszBody.GetBuffer()); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); } diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 80242fd342..8dd2add311 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -43,8 +43,8 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() if (filetype != typeInvalid) return filetype; - TCHAR img[] = L".jpg .jpeg .png .bmp"; - TCHAR audio[] = L".mp3"; + TCHAR img[] = _T(".jpg .jpeg .png .bmp"); + TCHAR audio[] = _T(".mp3"); TCHAR DRIVE[3], DIR[256], FNAME[256], EXT[256]; _tsplitpath(FileName, DRIVE, DIR, FNAME, EXT); @@ -81,7 +81,7 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const PROTOCHAR *desc, PROTOCHAR ** void CVkProto::SendFileFiled(CVkFileUploadParam *fup, TCHAR *reason) { - debugLog(L"CVkProto::SendFileFiled <%s> Error code <%d>", reason, fup->iErrorCode); + debugLog(_T("CVkProto::SendFileFiled <%s> Error code <%d>"), reason, fup->iErrorCode); ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)fup, 0); CMString tszError; switch (fup->iErrorCode){ @@ -119,13 +119,13 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, TCHAR *reason) void CVkProto::SendFileThread(void *p) { CVkFileUploadParam *fup = (CVkFileUploadParam *)p; - debugLog(L"CVkProto::SendFileThread %d %s", fup->GetType(), fup->fileName()); + debugLog(_T("CVkProto::SendFileThread %d %s"), fup->GetType(), fup->fileName()); if (!IsOnline()){ - SendFileFiled(fup, L"NotOnline"); + SendFileFiled(fup, _T("NotOnline")); return; } if (!fup->IsAccess()){ - SendFileFiled(fup, L"FileIsNotAccess"); + SendFileFiled(fup, _T("FileIsNotAccess")); return; } @@ -144,7 +144,7 @@ void CVkProto::SendFileThread(void *p) << VER_API; break; default: - SendFileFiled(fup, L"FileTypeNotSupported"); + SendFileFiled(fup, _T("FileTypeNotSupported")); return; } pReq->pUserInfo = p; @@ -155,13 +155,13 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * { CVkFileUploadParam *fup = (CVkFileUploadParam *)pReq->pUserInfo; if (!IsOnline()){ - SendFileFiled(fup, L"NotOnline"); + SendFileFiled(fup, _T("NotOnline")); return; } debugLogA("CVkProto::OnReciveUploadServer %d", reply->resultCode); if (reply->resultCode != 200){ - SendFileFiled(fup, L"NotUploadServer"); + SendFileFiled(fup, _T("NotUploadServer")); return; } @@ -180,7 +180,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * FILE *pFile = _tfopen(fup->FileName, _T("rb")); if (pFile == NULL){ - SendFileFiled(fup, L"ErrorOpenFile"); + SendFileFiled(fup, _T("ErrorOpenFile")); return; } @@ -239,7 +239,7 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { CVkFileUploadParam *fup = (CVkFileUploadParam *)pReq->pUserInfo; if (!IsOnline()){ - SendFileFiled(fup, L"NotOnline"); + SendFileFiled(fup, _T("NotOnline")); return; } @@ -261,8 +261,8 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) switch (fup->GetType()){ case CVkFileUploadParam::typeImg: upload = json_as_string(json_get(pRoot, "photo")); - if (upload == L"[]"){ - SendFileFiled(fup, L"NotUpload Photo"); + if (upload == _T("[]")){ + SendFileFiled(fup, _T("NotUpload Photo")); } pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/photos.saveMessagesPhoto.json", true, &CVkProto::OnReciveUploadFile) << TCHAR_PARAM("server", server) @@ -272,8 +272,8 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) break; case CVkFileUploadParam::typeAudio: upload = json_as_string(json_get(pRoot, "audio")); - if (upload == L"[]"){ - SendFileFiled(fup, L"NotUpload Audio"); + if (upload == _T("[]")){ + SendFileFiled(fup, _T("NotUpload Audio")); return; } pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/audio.save.json", true, &CVkProto::OnReciveUploadFile) @@ -285,7 +285,7 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) case CVkFileUploadParam::typeDoc: upload = json_as_string(json_get(pRoot, "file")); if (upload.IsEmpty()){ - SendFileFiled(fup, L"NotUpload Doc"); + SendFileFiled(fup, _T("NotUpload Doc")); return; } pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/docs.save.json", true, &CVkProto::OnReciveUploadFile) @@ -306,7 +306,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR { CVkFileUploadParam *fup = (CVkFileUploadParam *)pReq->pUserInfo; if (!IsOnline()){ - SendFileFiled(fup, L"NotOnline"); + SendFileFiled(fup, _T("NotOnline")); return; } @@ -334,13 +334,13 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR switch (fup->GetType()){ case CVkFileUploadParam::typeImg: - Attachment.AppendFormat(L"photo%d_%d", owner_id, id); + Attachment.AppendFormat(_T("photo%d_%d"), owner_id, id); break; case CVkFileUploadParam::typeAudio: - Attachment.AppendFormat(L"audio%d_%d", owner_id, id); + Attachment.AppendFormat(_T("audio%d_%d"), owner_id, id); break; case CVkFileUploadParam::typeDoc: - Attachment.AppendFormat(L"doc%d_%d", owner_id, id); + Attachment.AppendFormat(_T("doc%d_%d"), owner_id, id); break; default: SendFileFiled(fup); diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 6a0eece936..5b95d2e8f3 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -216,7 +216,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque recv.tszMessage = ptszBody; recv.lParam = isOut; recv.pCustomData = szMid; - recv.cbCustomDataSize = (int)strlen(szMid); + recv.cbCustomDataSize = (int)mir_strlen(szMid); ProtoChainRecvMsg(hContact, &recv); count++; } diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index dbdd478119..624f14c464 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -310,7 +310,7 @@ void CVkProto::InitPopups(void) POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; - mir_sntprintf(desc, SIZEOF(desc), L"%s %s", m_tszUserName, TranslateT("Errors")); + mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Errors")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -320,7 +320,7 @@ void CVkProto::InitPopups(void) ppc.iSeconds = 60; m_hPopupClassError = Popup_RegisterClass(&ppc); - mir_sntprintf(desc, SIZEOF(desc), L"%s %s", m_tszUserName, TranslateT("Notification")); + mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Notification")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Notification"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -427,7 +427,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg) if (flags & PREF_UTF) szMsg = mir_strdup(msg); else if (flags & PREF_UNICODE) - szMsg = mir_utf8encodeW((wchar_t*)&msg[strlen(msg)+1]); + szMsg = mir_utf8encodeW((wchar_t*)&msg[mir_strlen(msg)+1]); else szMsg = mir_utf8encode(msg); diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index bb700eb18a..2acfaedd1e 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -75,8 +75,8 @@ void __cdecl CVkProto::SearchThread(void* p) PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p; TCHAR arg[200]; - mir_sntprintf(arg, SIZEOF(arg), L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName); - debugLog(L"CVkProto::SearchThread %s", arg); + mir_sntprintf(arg, SIZEOF(arg), _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName); + debugLog(_T("CVkProto::SearchThread %s"), arg); if (!IsOnline()) return; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 1729833541..3cb1de29e9 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -95,7 +95,7 @@ void CVkProto::OnLoggedOut() m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; bool bOnline = false; - for (int i=0; i < vk_Instances.getCount(); i++) + for (int i = 0; i < vk_Instances.getCount(); i++) bOnline = bOnline || vk_Instances[i]->IsOnline(); if(!bOnline) CallFunctionAsync(VKUnsetTimer, this); @@ -110,8 +110,8 @@ void CVkProto::SetServerStatus(int iNewStatus) return; int iOldStatus = m_iStatus; - CMString oldStatusMsg = db_get_tsa(0, m_szModuleName, "OldStatusMsg"); - CMString ListeningToMsg = db_get_tsa(0, m_szModuleName, "ListeningTo"); + CMString oldStatusMsg = db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"); + CMString ListeningToMsg = db_get_tsa(NULL, m_szModuleName, "ListeningTo"); if (iNewStatus == ID_STATUS_OFFLINE) { m_iStatus = ID_STATUS_OFFLINE; @@ -179,7 +179,8 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq Push(pReq); } } - else ConnectionFailed(LOGINERR_NOSERVER); + else + ConnectionFailed(LOGINERR_NOSERVER); return; } @@ -297,8 +298,8 @@ MCONTACT CVkProto::SetContactInfo(JSONNODE* pItem, bool flag, bool self) tszValue = json_as_string(json_get(pItem, "bdate")); if (!tszValue.IsEmpty()) { int d, m, y, iReadCount; - iReadCount = _stscanf(tszValue.GetBuffer(), L"%d.%d.%d", &d, &m, &y); - if (iReadCount> 1) { + iReadCount = _stscanf(tszValue.GetBuffer(), _T("%d.%d.%d"), &d, &m, &y); + if (iReadCount > 1) { setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); if (iReadCount == 3) @@ -336,6 +337,7 @@ MCONTACT CVkProto::SetContactInfo(JSONNODE* pItem, bool flag, bool self) tszValue = json_as_string(json_get(pItem, "mobile_phone")); if (!tszValue.IsEmpty()) setTString(hContact, "Cellular", tszValue.GetBuffer()); + tszValue = json_as_string(json_get(pItem, "home_phone")); if (!tszValue.IsEmpty()) setTString(hContact, "Phone", tszValue.GetBuffer()); @@ -374,8 +376,9 @@ void CVkProto::RetrieveUserInfo(LONG userID) debugLogA("CVkProto::RetrieveUserInfo (%d)", userID); if (!IsOnline()) return; + CMString userIDs, code; - userIDs.AppendFormat(L"%i", userID); + userIDs.AppendFormat(_T("%i"), userID); CMString codeformat("var userIDs=\"%s\";" "return{\"users\":API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"})};"); @@ -398,7 +401,7 @@ void CVkProto::RetrieveUsersInfo(bool flag) continue; if (!userIDs.IsEmpty()) userIDs.AppendChar(','); - userIDs.AppendFormat(L"%i", userID); + userIDs.AppendFormat(_T("%i"), userID); } CMString codeformat("var userIDs=\"%s\";"); @@ -516,7 +519,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq JSONNODE *pItems = json_get(pResponse, "items"); if (pItems) - for (int i = 0; iresultCode); - if (reply->resultCode == 200){ - JSONROOT pRoot; - JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); - if (pResponse != NULL){ - JSONNODE *pAudio = json_get(pResponse, "audio"); - if (pAudio == NULL){ - CMString StatusText = json_as_string(json_get(pResponse, "text")); - if (StatusText.GetBuffer()[0] != TCHAR(9835)) - setTString("OldStatusMsg", StatusText.GetBuffer()); - } - } + if (reply->resultCode != 200) + return; + JSONROOT pRoot; + JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); + if (pResponse == NULL) + return; + JSONNODE *pAudio = json_get(pResponse, "audio"); + if (pAudio == NULL){ + CMString StatusText = json_as_string(json_get(pResponse, "text")); + if (StatusText.GetBuffer()[0] != TCHAR(9835)) + setTString("OldStatusMsg", StatusText.GetBuffer()); } } @@ -979,6 +982,7 @@ void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg) debugLogA("CVkProto::RetrieveStatusMsg"); if (!IsOnline()) return; + Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/status.set.json", true, &CVkProto::OnReceiveSmth) << TCHAR_PARAM("text", StatusMsg) << VER_API); @@ -1003,12 +1007,12 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) else { if (m_iMusicSendMetod == sendBroadcastOnly){ CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var OldMsg=API.status.get();" - "var Tracks = API.audio.search({\"q\":StatusMsg,\"count\":CntLmt, \"search_own\":1});" - "var Cnt=Tracks.count;if (Cnt>CntLmt){Cnt=CntLmt;}" - "if (Cnt == 0){API.audio.setBroadcast();}" - "else{var i = 0;var j = 0;var Track=\" \";" - "while (iCntLmt){Cnt=CntLmt;}" + "if(Cnt==0){API.audio.setBroadcast();}" + "else{var i=0;var j=0;var Track=\" \";" + "while (iCntLmt){Cnt=CntLmt;}" - "if (Cnt == 0){Track = \"♫ \"+StatusMsg; API.status.set({\"text\":Track});}" - "else{var i = 0;var j = -1;" - "while (iCntLmt){Cnt=CntLmt;}" + "if(Cnt==0){Track=\"♫ \"+StatusMsg;API.status.set({\"text\":Track});}" + "else{var i=0;var j=-1;" + "while(idwFlags & LTI_UNICODE) { if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)) - wszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo)); + wszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)_T("%artist% - %title%"), (LPARAM)pliInfo)); else - wszListeningTo.Format(L"%s - %s", - pliInfo->ptszArtist ? pliInfo->ptszArtist : L"", - pliInfo->ptszTitle ? pliInfo->ptszTitle : L""); + wszListeningTo.Format(_T("%s - %s"), + pliInfo->ptszArtist ? pliInfo->ptszArtist : _T(""), + pliInfo->ptszTitle ? pliInfo->ptszTitle : _T("")); setTString("ListeningTo", wszListeningTo); } RetrieveStatusMusic(wszListeningTo); @@ -1171,8 +1175,8 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) ptszMsg.AppendFormat(formatstr, tszNick.IsEmpty() ? TranslateT("(Unknown contact)") : tszNick.GetBuffer(), - tszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"), - tszVarWarning.IsEmpty() ? L"\n" : tszVarWarning.GetBuffer()); + tszVarWarning.IsEmpty() ? _T(" ") : TranslateT("\nIt will also"), + tszVarWarning.IsEmpty() ? _T("\n") : tszVarWarning.GetBuffer()); if (IDNO == MessageBox(NULL, ptszMsg.GetBuffer(), TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO)) return 1; @@ -1250,7 +1254,7 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) for (int k = 0; (pAttach = json_at(pAttachments, k)) != NULL; k++) { res.AppendChar('\t'); ptrT ptszType(json_as_string(json_get(pAttach, "type"))); - if (!mir_tstrcmp(ptszType, L"photo")) { + if (!mir_tstrcmp(ptszType, _T("photo"))) { JSONNODE *pPhoto = json_get(pAttach, "photo"); if (pPhoto == NULL) continue; @@ -1268,9 +1272,9 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) int iHeight = json_as_int(json_get(pPhoto, "height")); res.AppendFormat(_T("%s: %s (%dx%d)"), TranslateT("Photo"), ptszLink, iWidth, iHeight); if (m_bAddImgBbc) - res.AppendFormat(L"\n\t[img]%s[/img]", ptszLink); + res.AppendFormat(_T("\n\t[img]%s[/img]"), ptszLink); } - else if (!mir_tstrcmp(ptszType, L"audio")) { + else if (!mir_tstrcmp(ptszType, _T("audio"))) { JSONNODE *pAudio = json_get(pAttach, "audio"); if (pAudio == NULL) continue; @@ -1278,10 +1282,10 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) ptrT ptszArtist(json_as_string(json_get(pAudio, "artist"))); ptrT ptszTitle(json_as_string(json_get(pAudio, "title"))); ptrT ptszUrl(json_as_string(json_get(pAudio, "url"))); - res.AppendFormat(L"%s: (%s - %s) - %s", + res.AppendFormat(_T("%s: (%s - %s) - %s"), TranslateT("Audio"), ptszArtist, ptszTitle, ptszUrl); } - else if (!mir_tstrcmp(ptszType, L"video")) { + else if (!mir_tstrcmp(ptszType, _T("video"))) { JSONNODE *pVideo = json_get(pAttach, "video"); if (pVideo == NULL) continue; @@ -1289,18 +1293,18 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) ptrT ptszTitle(json_as_string(json_get(pVideo, "title"))); int vid = json_as_int(json_get(pVideo, "id")); int ownerID = json_as_int(json_get(pVideo, "owner_id")); - res.AppendFormat(L"%s: %s - http://vk.com/video%d_%d", TranslateT("Video"), ptszTitle, ownerID, vid); + res.AppendFormat(_T("%s: %s - http://vk.com/video%d_%d"), TranslateT("Video"), ptszTitle, ownerID, vid); } - else if (!mir_tstrcmp(ptszType, L"doc")) { + else if (!mir_tstrcmp(ptszType, _T("doc"))) { JSONNODE *pDoc = json_get(pAttach, "doc"); if (pDoc == NULL) continue; ptrT ptszTitle(json_as_string(json_get(pDoc, "title"))); ptrT ptszUrl(json_as_string(json_get(pDoc, "url"))); - res.AppendFormat(L"%s: (%s) - %s", TranslateT("Document"), ptszTitle, ptszUrl); + res.AppendFormat(_T("%s: (%s) - %s"), TranslateT("Document"), ptszTitle, ptszUrl); } - else if (!mir_tstrcmp(ptszType, L"wall")) { + else if (!mir_tstrcmp(ptszType, _T("wall"))) { JSONNODE *pWall = json_get(pAttach, "wall"); if (pWall == NULL) continue; @@ -1308,7 +1312,7 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) ptrT ptszText(json_as_string(json_get(pWall, "text"))); int id = json_as_int(json_get(pWall, "id")); int fromID = json_as_int(json_get(pWall, "from_id")); - res.AppendFormat(L"%s: %s - http://vk.com/wall%d_%d", TranslateT("Wall post"), ptszText ? ptszText : L" ", fromID, id); + res.AppendFormat(_T("%s: %s - http://vk.com/wall%d_%d"), TranslateT("Wall post"), ptszText ? ptszText : _T(" "), fromID, id); } else if (!mir_tstrcmp(ptszType, _T("sticker"))) { JSONNODE *pSticker = json_get(pAttach, "sticker"); @@ -1318,7 +1322,7 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) if (m_bStikersAsSmyles){ int id = json_as_int(json_get(pSticker, "id")); - res.AppendFormat(L"[sticker:%d]", id); + res.AppendFormat(_T("[sticker:%d]"), id); } else { ptrT ptszLink; @@ -1329,10 +1333,10 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) break; } } - res.AppendFormat(L"%s", ptszLink); + res.AppendFormat(_T("%s"), ptszLink); if (m_bAddImgBbc) - res.AppendFormat(L"[img]%s[/img]", ptszLink); + res.AppendFormat(_T("[img]%s[/img]"), ptszLink); } } else res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), ptszType); -- cgit v1.2.3