diff options
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 126 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_avatars.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 52 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 84 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_files.cpp | 14 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 16 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 8 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 26 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_search.cpp | 26 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_status.cpp | 26 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_struct.h | 18 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 40 |
15 files changed, 227 insertions, 227 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 494ef63183..4f1a9c6cb4 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -292,7 +292,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) pReq->m_iRetry--;
}
else {
- CMString msg(FORMAT, TranslateT("Error %d. Data will not be sent or received."), pReq->m_iErrorCode);
+ CMStringW msg(FORMAT, TranslateT("Error %d. Data will not be sent or received."), pReq->m_iErrorCode);
MsgPopup(NULL, msg, TranslateT("Error"), true);
debugLogA("CVkProto::CheckJsonResult SendError");
}
@@ -413,7 +413,7 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul return true;
}
-CMString CVkProto::RunConfirmationCode()
+CMStringW CVkProto::RunConfirmationCode()
{
ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_PASSWORD;
@@ -421,10 +421,10 @@ CMString CVkProto::RunConfirmationCode() pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "confirmcode_";
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
}
-CMString CVkProto::RunRenameNick(LPCWSTR pwszOldName)
+CMStringW CVkProto::RunRenameNick(LPCWSTR pwszOldName)
{
ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_COMBO;
@@ -433,7 +433,7 @@ CMString CVkProto::RunRenameNick(LPCWSTR pwszOldName) pForm.ptszInitVal = pwszOldName;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "renamenick_";
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -589,7 +589,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) return;
}
- CMString MirVer, OldMirVer(ptrW(db_get_wsa(hContact, m_szModuleName, "MirVer")));
+ CMStringW MirVer, OldMirVer(ptrW(db_get_wsa(hContact, m_szModuleName, "MirVer")));
bool bSetFlag = true;
switch (platform) {
@@ -830,7 +830,7 @@ int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedback, VKObjType& vkParent)
+CMStringW CVkProto::SpanVKNotificationType(CMStringW& wszType, VKObjType& vkFeedback, VKObjType& vkParent)
{
CVKNotification vkNotification[] = {
// type, parent, feedback, string for translate
@@ -866,7 +866,7 @@ CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedba { L"mention_comment_video", vkVideo, vkComment, L"mentioned you in comment to video" }
};
- CMString wszRes;
+ CMStringW wszRes;
vkFeedback = vkParent = vkNull;
for (int i = 0; i < _countof(vkNotification); i++)
if (wszType == vkNotification[i].pwszType) {
@@ -878,14 +878,14 @@ CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedba return wszRes;
}
-CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC)
+CMStringW CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC)
{
- CMString wszRes;
+ CMStringW wszRes;
if (!jnPhoto)
return wszRes;
- CMString wszLink, wszPreviewLink;
+ CMStringW wszLink, wszPreviewLink;
for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnPhoto[szImageTypes[i]];
if (n) {
@@ -913,14 +913,14 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) wszRes.AppendFormat(L"%s (%dx%d)", SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, wszLink), iWidth, iHeight);
if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
wszRes.AppendFormat(L"\n\t%s", SetBBCString(!wszPreviewLink.IsEmpty() ? wszPreviewLink : (!wszLink.IsEmpty() ? wszLink : L""), bbcBasic, vkbbcImg));
- CMString wszText(jnPhoto["text"].as_mstring());
+ CMStringW wszText(jnPhoto["text"].as_mstring());
if (!wszText.IsEmpty())
wszRes += L"\n" + wszText;
return wszRes;
}
-CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString)
+CMStringW CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString)
{
CVKBBCItem bbcItem[] = {
{ vkbbcB, bbcNo, L"%s" },
@@ -953,7 +953,7 @@ CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType b };
if (IsEmpty(pwszString))
- return CMString();
+ return CMStringW();
wchar_t *pwszFormat = NULL;
for (int i = 0; i < _countof(bbcItem); i++)
@@ -962,9 +962,9 @@ CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType b break;
}
- CMString res;
+ CMStringW res;
if (pwszFormat == NULL)
- return CMString(pwszString);
+ return CMStringW(pwszString);
if (bbcType == vkbbcUrl && iBBC != bbcAdvanced)
res.AppendFormat(pwszFormat, pwszString, wszAddString ? wszAddString : L"");
@@ -976,12 +976,12 @@ CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType b return res;
}
-CMString& CVkProto::ClearFormatNick(CMString& wszText)
+CMStringW& CVkProto::ClearFormatNick(CMStringW& wszText)
{
int iNameEnd = wszText.Find(L"],"), iNameBeg = wszText.Find(L"|");
if (iNameEnd != -1 && iNameBeg != -1 && iNameBeg < iNameEnd) {
- CMString wszName = wszText.Mid(iNameBeg + 1, iNameEnd - iNameBeg - 1);
- CMString wszBody = wszText.Mid(iNameEnd + 2);
+ CMStringW wszName = wszText.Mid(iNameBeg + 1, iNameEnd - iNameBeg - 1);
+ CMStringW wszBody = wszText.Mid(iNameEnd + 2);
if (!wszName.IsEmpty() && !wszBody.IsEmpty())
wszText = wszName + L"," + wszBody;
}
@@ -991,10 +991,10 @@ CMString& CVkProto::ClearFormatNick(CMString& wszText) /////////////////////////////////////////////////////////////////////////////////////////
-CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC)
+CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC)
{
debugLogA("CVkProto::GetAttachmentDescr");
- CMString res;
+ CMStringW res;
if (!jnAttachments) {
debugLogA("CVkProto::GetAttachmentDescr pAttachments == NULL");
return res;
@@ -1007,7 +1007,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnAttach = (*it);
res.AppendChar('\t');
- CMString wszType(jnAttach["type"].as_mstring());
+ CMStringW wszType(jnAttach["type"].as_mstring());
if (wszType == L"photo") {
const JSONNode &jnPhoto = jnAttach["photo"];
if (!jnPhoto)
@@ -1020,10 +1020,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnAudio)
continue;
- CMString wszArtist(jnAudio["artist"].as_mstring());
- CMString wszTitle(jnAudio["title"].as_mstring());
- CMString wszUrl(jnAudio["url"].as_mstring());
- CMString wszAudio(FORMAT, L"%s - %s", wszArtist, wszTitle);
+ CMStringW wszArtist(jnAudio["artist"].as_mstring());
+ CMStringW wszTitle(jnAudio["title"].as_mstring());
+ CMStringW wszUrl(jnAudio["url"].as_mstring());
+ CMStringW wszAudio(FORMAT, L"%s - %s", wszArtist, wszTitle);
int iParamPos = wszUrl.Find(L"?");
if (m_vkOptions.bShortenLinksForAudio && iParamPos != -1)
@@ -1038,10 +1038,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnVideo)
continue;
- CMString wszTitle(jnVideo["title"].as_mstring());
+ CMStringW wszTitle(jnVideo["title"].as_mstring());
int vid = jnVideo["id"].as_int();
int ownerID = jnVideo["owner_id"].as_int();
- CMString wszUrl(FORMAT, L"https://vk.com/video%d_%d", ownerID, vid);
+ CMStringW wszUrl(FORMAT, L"https://vk.com/video%d_%d", ownerID, vid);
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Video"), iBBC, vkbbcB),
SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl));
@@ -1051,8 +1051,8 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnDoc)
continue;
- CMString wszTitle(jnDoc["title"].as_mstring());
- CMString wszUrl(jnDoc["url"].as_mstring());
+ CMStringW wszTitle(jnDoc["title"].as_mstring());
+ CMStringW wszUrl(jnDoc["url"].as_mstring());
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Document"), iBBC, vkbbcB),
SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl));
@@ -1062,10 +1062,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnWall)
continue;
- CMString wszText(jnWall["text"].as_mstring());
+ CMStringW wszText(jnWall["text"].as_mstring());
int id = jnWall["id"].as_int();
int fromID = jnWall["from_id"].as_int();
- CMString wszUrl(FORMAT, L"https://vk.com/wall%d_%d", fromID, id);
+ CMStringW wszUrl(FORMAT, L"https://vk.com/wall%d_%d", fromID, id);
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, wszUrl),
wszText.IsEmpty() ? L" " : wszText);
@@ -1074,10 +1074,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport for (auto aCHit = jnCopyHystory.begin(); aCHit != jnCopyHystory.end(); ++aCHit) {
const JSONNode &jnCopyHystoryItem = (*aCHit);
- CMString wszCHText(jnCopyHystoryItem["text"].as_mstring());
+ CMStringW wszCHText(jnCopyHystoryItem["text"].as_mstring());
int iCHid = jnCopyHystoryItem["id"].as_int();
int iCHfromID = jnCopyHystoryItem["from_id"].as_int();
- CMString wszCHUrl(FORMAT, L"https://vk.com/wall%d_%d", iCHfromID, iCHid);
+ CMStringW wszCHUrl(FORMAT, L"https://vk.com/wall%d_%d", iCHfromID, iCHid);
wszCHText.Replace(L"\n", L"\n\t\t");
res.AppendFormat(L"\n\t\t%s: %s",
SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, wszCHUrl),
@@ -1086,7 +1086,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnSubAttachments = jnCopyHystoryItem["attachments"];
if (jnSubAttachments) {
debugLogA("CVkProto::GetAttachmentDescr SubAttachments");
- CMString wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
+ CMStringW wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
wszAttachmentDescr.Replace(L"\n", L"\n\t\t");
res += L"\n\t\t" + wszAttachmentDescr;
}
@@ -1095,7 +1095,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnSubAttachments = jnWall["attachments"];
if (jnSubAttachments) {
debugLogA("CVkProto::GetAttachmentDescr SubAttachments");
- CMString wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
+ CMStringW wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
wszAttachmentDescr.Replace(L"\n", L"\n\t");
res += L"\n\t" + wszAttachmentDescr;
}
@@ -1111,7 +1111,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport res.AppendFormat(L"[sticker:%d]", id);
}
else {
- CMString wszLink;
+ CMStringW wszLink;
for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnSticker[szImageTypes[i]];
if (n) {
@@ -1130,10 +1130,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnLink)
continue;
- CMString wszUrl(jnLink["url"].as_mstring());
- CMString wszTitle(jnLink["title"].as_mstring());
- CMString wszCaption(jnLink["caption"].as_mstring());
- CMString wszDescription(jnLink["description"].as_mstring());
+ CMStringW wszUrl(jnLink["url"].as_mstring());
+ CMStringW wszTitle(jnLink["title"].as_mstring());
+ CMStringW wszCaption(jnLink["caption"].as_mstring());
+ CMStringW wszDescription(jnLink["description"].as_mstring());
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Link"), iBBC, vkbbcB),
@@ -1153,10 +1153,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport int id = jnMarket["id"].as_int();
int ownerID = jnMarket["owner_id"].as_int();
- CMString wszTitle(jnMarket["title"].as_mstring());
- CMString wszDescription(jnMarket["description"].as_mstring());
- CMString wszPhoto(jnMarket["thumb_photo"].as_mstring());
- CMString wszUrl(FORMAT, L"https://vk.com/%s%d?w=product%d_%d",
+ CMStringW wszTitle(jnMarket["title"].as_mstring());
+ CMStringW wszDescription(jnMarket["description"].as_mstring());
+ CMStringW wszPhoto(jnMarket["thumb_photo"].as_mstring());
+ CMStringW wszUrl(FORMAT, L"https://vk.com/%s%d?w=product%d_%d",
ownerID > 0 ? L"id" : L"club",
ownerID > 0 ? ownerID : (-1)*ownerID,
ownerID,
@@ -1184,7 +1184,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnGift)
continue;
- CMString wszLink;
+ CMStringW wszLink;
for (int i = 0; i < _countof(szGiftTypes); i++) {
const JSONNode &n = jnGift[szGiftTypes[i]];
if (n) {
@@ -1208,9 +1208,9 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport return res;
}
-CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC)
+CMStringW CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC)
{
- CMString res;
+ CMStringW res;
debugLogA("CVkProto::GetFwdMessages");
if (!jnMessages) {
debugLogA("CVkProto::GetFwdMessages pMessages == NULL");
@@ -1223,8 +1223,8 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnUser = (*it);
int iUserId = jnUser["id"].as_int();
- CMString wszNick(FORMAT, L"%s %s", jnUser["first_name"].as_mstring(), jnUser["last_name"].as_mstring());
- CMString wszLink(FORMAT, L"https://vk.com/id%d", iUserId);
+ CMStringW wszNick(FORMAT, L"%s %s", jnUser["first_name"].as_mstring(), jnUser["last_name"].as_mstring());
+ CMStringW wszLink(FORMAT, L"https://vk.com/id%d", iUserId);
CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, wszNick, wszLink, FindUser(iUserId));
vkUsers.insert(vkUser);
@@ -1236,7 +1236,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn UINT uid = jnMsg["user_id"].as_int();
CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&uid);
- CMString wszNick, wszUrl;
+ CMStringW wszNick, wszUrl;
if (vkUser) {
wszNick = vkUser->m_wszUserNick;
@@ -1257,11 +1257,11 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn _wcsftime_l(ttime, _countof(ttime), L"%x %X", localtime(&datetime), locale);
_free_locale(locale);
- CMString wszBody(jnMsg["body"].as_mstring());
+ CMStringW wszBody(jnMsg["body"].as_mstring());
const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
+ CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
if (!wszBody.IsEmpty())
wszFwdMessages = L"\n" + wszFwdMessages;
wszBody += wszFwdMessages;
@@ -1269,7 +1269,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
+ CMStringW wszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
if (!wszBody.IsEmpty())
wszAttachmentDescr = L"\n" + wszAttachmentDescr;
wszBody += wszAttachmentDescr;
@@ -1277,7 +1277,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn wszBody.Replace(L"\n", L"\n\t");
wchar_t tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' ';
- CMString wszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n",
+ CMStringW wszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n",
SetBBCString(TranslateT("Message from"), iBBC, vkbbcB),
SetBBCString(wszNick, iBBC, vkbbcUrl, wszUrl),
tcSplit,
@@ -1310,7 +1310,7 @@ void CVkProto::SetInvisible(MCONTACT hContact) setDword(hContact, "InvisibleTS", (DWORD)now);
}
-CMString CVkProto::RemoveBBC(CMString& wszSrc)
+CMStringW CVkProto::RemoveBBC(CMStringW& wszSrc)
{
static const wchar_t *wszSimpleBBCodes[][2] = {
{ L"[b]", L"[/b]" },
@@ -1326,13 +1326,13 @@ CMString CVkProto::RemoveBBC(CMString& wszSrc) { L"[color=", L"[/color]" },
};
- CMString wszRes(wszSrc);
- CMString wszLow(wszSrc);
+ CMStringW wszRes(wszSrc);
+ CMStringW wszLow(wszSrc);
wszLow.MakeLower();
for (int i = 0; i < _countof(wszSimpleBBCodes); i++) {
- CMString wszOpenTag(wszSimpleBBCodes[i][0]);
- CMString wszCloseTag(wszSimpleBBCodes[i][1]);
+ CMStringW wszOpenTag(wszSimpleBBCodes[i][0]);
+ CMStringW wszCloseTag(wszSimpleBBCodes[i][1]);
int lenOpen = wszOpenTag.GetLength();
int lenClose = wszCloseTag.GetLength();
@@ -1357,8 +1357,8 @@ CMString CVkProto::RemoveBBC(CMString& wszSrc) }
for (int i = 0; i < _countof(wszParamBBCodes); i++) {
- CMString wszOpenTag(wszParamBBCodes[i][0]);
- CMString wszCloseTag(wszParamBBCodes[i][1]);
+ CMStringW wszOpenTag(wszParamBBCodes[i][0]);
+ CMStringW wszCloseTag(wszParamBBCodes[i][1]);
int lenOpen = wszOpenTag.GetLength();
int lenClose = wszCloseTag.GetLength();
@@ -1396,7 +1396,7 @@ void CVkProto::ShowCaptchaInBrowser(HBITMAP hBitmap) if (!GetEnvironmentVariable(L"TEMP", wszTempDir, MAX_PATH))
return;
- CMString wszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", wszTempDir);
+ CMStringW wszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", wszTempDir);
FILE *pFile = _wfopen(wszHTMLPath, L"w");
if (pFile == NULL)
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 61a05f3002..1bb02b1287 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -130,7 +130,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen)
{
- int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pwszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -150,9 +150,9 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cb mir_snwprintf(pwszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
}
-void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &wszUrl)
+void CVkProto::SetAvatarUrl(MCONTACT hContact, CMStringW &wszUrl)
{
- CMString oldUrl(getWStringA(hContact, "AvatarUrl"));
+ CMStringW oldUrl(getWStringA(hContact, "AvatarUrl"));
if (wszUrl == oldUrl)
return;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index ff8cee7677..4b0853d9d2 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -30,7 +30,7 @@ extern JSONNode nullNode; CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
{
- debugLog(L"CVkProto::AppendChat");
+ debugLogW(L"CVkProto::AppendChat");
if (id == 0)
return NULL;
@@ -42,14 +42,14 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) if (c != NULL)
return c;
- CMString wszTitle;
+ CMStringW wszTitle;
c = new CVkChatInfo(id);
if (jnDlg) {
wszTitle = jnDlg["title"].as_mstring();
c->m_wszTopic = mir_wstrdup(!wszTitle.IsEmpty() ? wszTitle : L"");
}
- CMString sid;
+ CMStringW sid;
sid.Format(L"%S_%d", m_szModuleName, id);
c->m_wszId = mir_wstrdup(sid);
@@ -73,13 +73,13 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
for (int i = _countof(sttStatuses)-1; i >= 0; i--) {
- gce.ptszStatus = TranslateTS(sttStatuses[i]);
+ gce.ptszStatus = TranslateW(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
setDword(gci.hContact, "vk_chat_id", id);
- CMString wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id);
+ CMStringW wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id);
setWString(gci.hContact, "Homepage", wszHomepage);
db_unset(gci.hContact, m_szModuleName, "off");
@@ -183,10 +183,10 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe bNew = cu->m_bUnknown;
cu->m_bDel = false;
- CMString wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
+ CMStringW wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
if (wszNick.IsEmpty()) {
- CMString fName(jnUser["first_name"].as_mstring());
- CMString lName(jnUser["last_name"].as_mstring());
+ CMStringW fName(jnUser["first_name"].as_mstring());
+ CMStringW lName(jnUser["last_name"].as_mstring());
wszNick = fName.Trim() + L" " + lName.Trim();
}
cu->m_wszNick = mir_wstrdup(wszNick);
@@ -198,7 +198,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe gce.bIsMe = uid == m_myUserId;
gce.ptszUID = wszId;
gce.ptszNick = wszNick;
- gce.ptszStatus = TranslateTS(sttStatuses[uid == cc->m_admin_id]);
+ gce.ptszStatus = TranslateW(sttStatuses[uid == cc->m_admin_id]);
gce.dwItemData = (INT_PTR)cu;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
}
@@ -217,7 +217,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe gce.ptszUID = wszId;
gce.dwFlags = GCEF_REMOVECONTACT | GCEF_NOTNOTIFY;
gce.time = time(NULL);
- gce.ptszNick = mir_wstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId));
+ gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
cc->m_users.remove(i);
@@ -268,7 +268,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCWSTR wszTopic)
{
- debugLog(L"CVkProto::SetChatTitle");
+ debugLogW(L"CVkProto::SetChatTitle");
if (!cc)
return;
@@ -302,11 +302,11 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (!msgTime || msgTime > now)
msgTime = now;
- CMString wszBody(jnMsg["body"].as_mstring());
+ CMStringW wszBody(jnMsg["body"].as_mstring());
const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, bbcNo);
+ CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, bbcNo);
if (!wszBody.IsEmpty())
wszFwdMessages = L"\n" + wszFwdMessages;
wszBody += wszFwdMessages;
@@ -314,7 +314,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo);
+ CMStringW wszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo);
if (!wszBody.IsEmpty())
wszAttachmentDescr = L"\n" + wszAttachmentDescr;
wszBody += wszAttachmentDescr;
@@ -322,18 +322,18 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (jnMsg["action"]) {
bIsAction = true;
- CMString wszAction = jnMsg["action"].as_mstring();
+ CMStringW wszAction = jnMsg["action"].as_mstring();
if (wszAction == L"chat_create") {
- CMString wszActionText = jnMsg["action_text"].as_mstring();
+ CMStringW wszActionText = jnMsg["action_text"].as_mstring();
wszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), wszActionText.IsEmpty() ? L" " : wszActionText);
}
else if (wszAction == L"chat_kick_user") {
- CMString wszActionMid = jnMsg["action_mid"].as_mstring();
+ CMStringW wszActionMid = jnMsg["action_mid"].as_mstring();
if (wszActionMid.IsEmpty())
wszBody = TranslateT("kick user");
else {
- CMString wszUid(FORMAT, L"%d", uid);
+ CMStringW wszUid(FORMAT, L"%d", uid);
if (wszUid == wszActionMid) {
if (cc->m_bHistoryRead)
return;
@@ -355,11 +355,11 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & }
}
else if (wszAction == L"chat_invite_user") {
- CMString wszActionMid = jnMsg["action_mid"].as_mstring();
+ CMStringW wszActionMid = jnMsg["action_mid"].as_mstring();
if (wszActionMid.IsEmpty())
wszBody = TranslateT("invite user");
else {
- CMString wszUid(FORMAT, L"%d", uid);
+ CMStringW wszUid(FORMAT, L"%d", uid);
if (wszUid == wszActionMid)
wszBody.AppendFormat(L" (https://vk.com/id%s) %s", wszUid, TranslateT("returned to chat"));
else {
@@ -378,7 +378,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & }
}
else if (wszAction == L"chat_title_update") {
- CMString wszTitle = jnMsg["action_text"].as_mstring();
+ CMStringW wszTitle = jnMsg["action_text"].as_mstring();
wszBody.AppendFormat(L"%s \"%s\"", TranslateT("change chat title to"), wszTitle.IsEmpty() ? L" " : wszTitle);
if (!bIsHistory)
@@ -419,7 +419,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
if (cu == NULL) {
cc->m_users.insert(cu = new CVkChatUser(uid));
- CMString wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
+ CMStringW wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
cu->m_wszNick = mir_wstrdup(wszNick.IsEmpty() ? (hContact ? ptrW(db_get_wsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : wszNick);
cu->m_bUnknown = true;
}
@@ -514,7 +514,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) db_set_dw(hContact, "Ignore", "Mask1", 0);
RetrieveUserInfo(_wtoi(gch->ptszUID));
}
- CallService(MS_MSG_SENDMESSAGET, hContact);
+ CallService(MS_MSG_SENDMESSAGEW, hContact);
}
break;
@@ -691,7 +691,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con return;
MCONTACT hContact = FindUser(user_id, false);
- CMString msg(jnMsg["body"].as_mstring());
+ CMStringW msg(jnMsg["body"].as_mstring());
if (msg.IsEmpty()) {
msg = TranslateT("You've been kicked by ");
if (hContact != NULL)
@@ -782,14 +782,14 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) case IDM_VISIT_PROFILE:
hContact = FindUser(cu->m_uid);
if (hContact == NULL)
- Utils_OpenUrlW(CMString(FORMAT, L"https://vk.com/id%d", cu->m_uid));
+ Utils_OpenUrlW(CMStringW(FORMAT, L"https://vk.com/id%d", cu->m_uid));
else
SvcVisitProfile(hContact, 0);
break;
case IDM_CHANGENICK:
{
- CMString wszNewNick = RunRenameNick(cu->m_wszNick);
+ CMStringW wszNewNick = RunRenameNick(cu->m_wszNick);
if (wszNewNick.IsEmpty() || wszNewNick == cu->m_wszNick)
break;
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 889ded760b..0c9f5287a1 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -120,7 +120,7 @@ void CVkWallPostForm::OnInitDialog() {
Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_WALL));
- CMString wszTitle(FORMAT, L"%s %s", TranslateT("Wall message for"), m_param->pwszNick);
+ CMStringW wszTitle(FORMAT, L"%s %s", TranslateT("Wall message for"), m_param->pwszNick);
SetCaption(wszTitle);
m_btnShare.Disable();
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 2d52d12b9c..64c020b12a 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -32,7 +32,7 @@ void CVkProto::AddFeedSpecialUser() hContact = FindUser(VK_FEED_USER, true);
setWString(hContact, "Nick", TranslateT("VKontakte"));
- CMString wszUrl = L"https://vk.com/press/Simple.png";
+ CMStringW wszUrl = L"https://vk.com/press/Simple.png";
SetAvatarUrl(hContact, wszUrl);
ReloadAvatarInfo(hContact);
@@ -102,8 +102,8 @@ CVkUserInfo* CVkProto::GetVkUserInfo(LONG iUserId, OBJLIST<CVkUserInfo> &vkUsers CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&iUserId);
if (vkUser == NULL) {
- CMString wszNick = TranslateT("Unknown");
- CMString wszLink(L"https://vk.com/");
+ CMStringW wszNick = TranslateT("Unknown");
+ CMStringW wszLink(L"https://vk.com/");
if (iUserId) {
wszLink += bIsGroup ? "club" : "id";
wszLink.AppendFormat(L"%d", bIsGroup ? -iUserId : iUserId);
@@ -130,11 +130,11 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod continue;
LONG UserId = jnProfile["id"].as_int();
- CMString wszNick(jnProfile["first_name"].as_mstring());
+ CMStringW wszNick(jnProfile["first_name"].as_mstring());
wszNick.AppendChar(' ');
wszNick += jnProfile["last_name"].as_mstring();
- CMString wszLink = L"https://vk.com/";
- CMString wszScreenName(jnProfile["screen_name"].as_mstring());
+ CMStringW wszLink = L"https://vk.com/";
+ CMStringW wszScreenName(jnProfile["screen_name"].as_mstring());
if (wszScreenName.IsEmpty())
wszScreenName.AppendFormat(L"id%d", UserId);
wszLink += wszScreenName;
@@ -150,8 +150,8 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod continue;
LONG UserId = - jnProfile["id"].as_int();
- CMString wszNick(jnProfile["name"].as_mstring());
- CMString wszLink = L"https://vk.com/";
+ CMStringW wszNick(jnProfile["name"].as_mstring());
+ CMStringW wszLink = L"https://vk.com/";
wszLink += jnProfile["screen_name"].as_mstring();
CVkUserInfo *vkUser = new CVkUserInfo(UserId, true, wszNick, wszLink);
vkUsers.insert(vkUser);
@@ -169,8 +169,8 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo LONG iSourceId = !jnItem["source_id"] ? jnItem["owner_id"].as_int() : jnItem["source_id"].as_int();
LONG iPostId = jnItem["post_id"].as_int();
- CMString wszText(jnItem["text"].as_mstring());
- CMString wszPopupText(wszText);
+ CMStringW wszText(jnItem["text"].as_mstring());
+ CMStringW wszPopupText(wszText);
vkNewsItem->wszType = jnItem["type"].as_mstring();
vkNewsItem->vkUser = GetVkUserInfo(iSourceId, vkUsers);
@@ -180,7 +180,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo if (!wszText.IsEmpty())
wszText += L"\n";
- debugLog(L"CVkProto::GetVkNewsItem %d %d %s", iSourceId, iPostId, vkNewsItem->wszType);
+ debugLogW(L"CVkProto::GetVkNewsItem %d %d %s", iSourceId, iPostId, vkNewsItem->wszType);
if (vkNewsItem->wszType == L"photo_tag") {
bPostLink = false;
@@ -246,7 +246,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo }
}
- CMString wszResFormat, wszTitleFormat;
+ CMStringW wszResFormat, wszTitleFormat;
if (!isRepost) {
wszResFormat = Translate("News from %s\n%s");
@@ -266,26 +266,26 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo vkNewsItem->wszId.AppendFormat(L"%d_%d", vkNewsItem->vkUser->m_UserId, iPostId);
if (bPostLink) {
- vkNewsItem->wszLink = CMString(L"https://vk.com/wall") + vkNewsItem->wszId;
+ vkNewsItem->wszLink = CMStringW(L"https://vk.com/wall") + vkNewsItem->wszId;
vkNewsItem->wszText.AppendChar('\n');
vkNewsItem->wszText += SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNewsItem->wszLink);
}
- debugLog(L"CVkProto::GetVkNewsItem %d %d <\n%s\n>", iSourceId, iPostId, vkNewsItem->wszText);
+ debugLogW(L"CVkProto::GetVkNewsItem %d %d <\n%s\n>", iSourceId, iPostId, vkNewsItem->wszText);
return vkNewsItem;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
-CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser)
+CMStringW CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser)
{
debugLogA("CVkProto::GetVkFeedback");
- CMString wszRes;
+ CMStringW wszRes;
if (!jnFeedback || !vkFeedbackType)
return wszRes;
- CMString wszFormat;
+ CMStringW wszFormat;
LONG iUserId = 0;
if (vkFeedbackType == vkComment) {
@@ -299,7 +299,7 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac else if (vkFeedbackType == VKObjType::vkUsers || vkFeedbackType == vkCopy) {
const JSONNode &jnUsers = jnFeedback["items"];
- CMString wszUsers;
+ CMStringW wszUsers;
for (auto it = jnUsers.begin(); it != jnUsers.end(); ++it) {
const JSONNode &jnUserItem = (*it);
if (!jnUserItem["from_id"])
@@ -317,7 +317,7 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac if (iUserId) {
vkUser = GetVkUserInfo(iUserId, vkUsers);
- CMString wszText(jnFeedback["text"].as_mstring());
+ CMStringW wszText(jnFeedback["text"].as_mstring());
wszText.Replace(L"%", L"%%");
wszRes.AppendFormat(wszFormat, SetBBCString(vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_wszLink), ClearFormatNick(wszText));
}
@@ -328,14 +328,14 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCWSTR pwszReplyText, LPCWSTR pwszReplyLink)
{
debugLogA("CVkProto::GetVkParent");
- CMString wszRes;
+ CMStringW wszRes;
if (!jnParent || !vkParentType)
return NULL;
CVKNewsItem *vkNotificationItem = new CVKNewsItem();
if (vkParentType == vkPhoto) {
- CMString wszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews());
+ CMStringW wszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews());
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId);
@@ -352,11 +352,11 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT else if (vkParentType == vkVideo) {
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
- CMString wszTitle(jnParent["title"].as_mstring());
+ CMStringW wszTitle(jnParent["title"].as_mstring());
vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId);
vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/video%s", vkNotificationItem->wszId);
- CMString wszText(jnParent["text"].as_mstring());
+ CMStringW wszText(jnParent["text"].as_mstring());
ClearFormatNick(wszText);
if (!wszText.IsEmpty())
@@ -375,7 +375,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->wszId.AppendFormat(L"%d_%d", iToId, iId);
vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/wall%s%s", vkNotificationItem->wszId, pwszReplyLink ? pwszReplyLink : L"");
- CMString wszText(jnParent["text"].as_mstring());
+ CMStringW wszText(jnParent["text"].as_mstring());
ClearFormatNick(wszText);
if (!wszText.IsEmpty()) {
@@ -395,12 +395,12 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT else if (vkParentType == vkTopic) {
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
- CMString wszTitle(jnParent["title"].as_mstring());
+ CMStringW wszTitle(jnParent["title"].as_mstring());
vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId);
vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/topic%s%s",
vkNotificationItem->wszId, pwszReplyLink ? pwszReplyLink : L"");
- CMString wszText(jnParent["text"].as_mstring());
+ CMStringW wszText(jnParent["text"].as_mstring());
ClearFormatNick(wszText);
if (!wszText.IsEmpty()) {
@@ -418,7 +418,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->wszText.AppendFormat(L"\n%s", SetBBCString(wszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->wszLink));
}
else if (vkParentType == vkComment) {
- CMString wszText(jnParent["text"].as_mstring());
+ CMStringW wszText(jnParent["text"].as_mstring());
ClearFormatNick(wszText);
const JSONNode &jnPhoto = jnParent["photo"];
@@ -437,14 +437,14 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT const JSONNode &jnPost = jnParent["post"];
if (jnPost) {
- CMString wszRepl(FORMAT, L"?reply=%d", iId);
+ CMStringW wszRepl(FORMAT, L"?reply=%d", iId);
delete vkNotificationItem;
return GetVkParent(jnPost, vkPost, wszText, wszRepl);
}
const JSONNode &jnTopic = jnParent["topic"];
if (jnTopic) {
- CMString wszRepl(FORMAT, L"?reply=%d", iId);
+ CMStringW wszRepl(FORMAT, L"?reply=%d", iId);
delete vkNotificationItem;
return GetVkParent(jnTopic, vkTopic, wszText, wszRepl);
}
@@ -459,9 +459,9 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV if (!jnItem)
return NULL;
- CMString wszType(jnItem["type"].as_mstring());
+ CMStringW wszType(jnItem["type"].as_mstring());
VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
- CMString wszNotificationTranslate = SpanVKNotificationType(wszType, vkFeedbackType, vkParentType);
+ CMStringW wszNotificationTranslate = SpanVKNotificationType(wszType, vkFeedbackType, vkParentType);
const JSONNode &jnFeedback = jnItem["feedback"];
const JSONNode &jnParent = jnItem["parent"];
@@ -475,14 +475,14 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV return NULL;
CVkUserInfo *vkUser = NULL;
- CMString wszFeedback = GetVkFeedback(jnFeedback, vkFeedbackType, vkUsers, vkUser);
+ CMStringW wszFeedback = GetVkFeedback(jnFeedback, vkFeedbackType, vkUsers, vkUser);
CVKNewsItem *vkNotification = GetVkParent(jnParent, vkParentType);
if (!vkNotification)
return NULL;
if (vkNotification && !wszFeedback.IsEmpty()) {
- CMString wszNotificaton;
+ CMStringW wszNotificaton;
wszNotificaton.AppendFormat(wszFeedback, wszNotificationTranslate, vkNotification->wszText);
vkNotification->wszText = wszNotificaton;
@@ -532,16 +532,16 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser if (!jnItem)
return NULL;
- CMString wszType(jnItem["type"].as_mstring());
+ CMStringW wszType(jnItem["type"].as_mstring());
VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
- CMString wszNotificationTranslate = SpanVKNotificationType(wszType, vkFeedbackType, vkParentType);
+ CMStringW wszNotificationTranslate = SpanVKNotificationType(wszType, vkFeedbackType, vkParentType);
if (!jnItem["id"])
return NULL;
LONG iGroupId = jnItem["id"].as_int();
- CMString wszId(FORMAT, L"%d,", iGroupId);
- CMString wszIds(ptrW(db_get_wsa(NULL, m_szModuleName, "InviteGroupIds")));
+ CMStringW wszId(FORMAT, L"%d,", iGroupId);
+ CMStringW wszIds(ptrW(db_get_wsa(NULL, m_szModuleName, "InviteGroupIds")));
if (wszIds.Find(wszId, 0) != -1)
return NULL;
@@ -555,12 +555,12 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser vkNotification->vkFeedbackType = vkFeedbackType;
vkNotification->vkParentType = vkParentType;
- CMString wszGroupName;
- CMString wszGName = jnItem["name"].as_mstring();
- CMString wszGLink(FORMAT, L"https://vk.com/%s", jnItem["screen_name"].as_mstring());
+ CMStringW wszGroupName;
+ CMStringW wszGName = jnItem["name"].as_mstring();
+ CMStringW wszGLink(FORMAT, L"https://vk.com/%s", jnItem["screen_name"].as_mstring());
wszGroupName = SetBBCString(wszGName, m_vkOptions.BBCForNews(), vkbbcUrl, wszGLink);
- CMString wszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_wszLink : L"https://vk.com/");
+ CMStringW wszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_wszLink : L"https://vk.com/");
vkNotification->wszText.AppendFormat(L"%s %s %s", wszUsers, wszNotificationTranslate, wszGroupName);
vkNotification->wszPopupTitle.AppendFormat(L"%s %s %s", iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), wszNotificationTranslate, wszGName);
@@ -708,7 +708,7 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) if (time(NULL) - tLastNotificationsReqTime < 3 * 60)
return;
- CMString code(FORMAT, L"return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s",
+ CMStringW code(FORMAT, L"return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s",
(LONG)(tLastNotificationsTime + 1),
m_vkOptions.bNotificationFilterInvites ? L",\"groupinvates\":API.groups.getInvites({\"extended\":1})};" : L"};");
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index af491c5729..2d977768fb 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -32,7 +32,7 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode)
{
- CMString wszError;
+ CMStringW wszError;
switch (ErrorCode) {
case VKERR_OFFLINE:
wszError = TranslateT("Protocol is offline");
@@ -89,7 +89,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) wszError = TranslateT("Unknown error occurred");
}
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ErrorCode== VKERR_AUDIO_DEL_COPYRIGHT ? ACKRESULT_DENIED : ACKRESULT_FAILED, (HANDLE)fup);
- debugLog(L"CVkProto::SendFileFiled error code = %d (%s)", ErrorCode, wszError);
+ debugLogW(L"CVkProto::SendFileFiled error code = %d (%s)", ErrorCode, wszError);
MsgPopup(NULL, wszError, TranslateT("File upload error"), true);
delete fup;
}
@@ -97,7 +97,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) void CVkProto::SendFileThread(void *p)
{
CVkFileUploadParam *fup = (CVkFileUploadParam *)p;
- debugLog(L"CVkProto::SendFileThread %d %s", fup->GetType(), fup->fileName());
+ debugLogW(L"CVkProto::SendFileThread %d %s", fup->GetType(), fup->fileName());
if (!IsOnline()) {
SendFileFiled(fup, VKERR_OFFLINE);
return;
@@ -252,9 +252,9 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) return;
}
- CMString server(jnRoot["server"].as_mstring());
- CMString hash(jnRoot["hash"].as_mstring());
- CMString upload;
+ CMStringW server(jnRoot["server"].as_mstring());
+ CMStringW hash(jnRoot["hash"].as_mstring());
+ CMStringW upload;
AsyncHttpRequest *pUploadReq;
@@ -330,7 +330,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR return;
}
- CMString Attachment;
+ CMStringW Attachment;
switch (fup->GetType()) {
case CVkFileUploadParam::typeImg:
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index ed5671492e..706f38568e 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -168,7 +168,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque mir_cslock lck(m_csLoadHistoryTask);
if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- debugLog(L"CVkProto::OnReceiveHistoryMessages error m_iLoadHistoryTask=%d", m_iLoadHistoryTask);
+ debugLogW(L"CVkProto::OnReceiveHistoryMessages error m_iLoadHistoryTask=%d", m_iLoadHistoryTask);
MsgPopup(NULL, TranslateT("Error loading message history from server"), TranslateT("Error"), true);
if (m_iLoadHistoryTask == 0 && m_bNotifyForEndLoadingHistoryAllContact) {
@@ -189,10 +189,10 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque m_iLoadHistoryTask--;
ptrW pwszNick(db_get_wsa(param->hContact, m_szModuleName, "Nick"));
- CMString str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), pwszNick);
+ CMStringW str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), pwszNick);
MsgPopup(param->hContact, str, TranslateT("Error"), true);
- debugLog(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask);
+ debugLogW(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask);
if (m_iLoadHistoryTask == 0 && m_bNotifyForEndLoadingHistoryAllContact) {
MsgPopup(NULL, TranslateT("Loading messages for all contacts is completed"), TranslateT("Loading history"));
@@ -223,7 +223,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque char szMid[40];
_itoa(mid, szMid, 10);
- CMString wszBody(jnMsg["body"].as_mstring());
+ CMStringW wszBody(jnMsg["body"].as_mstring());
int datetime = jnMsg["date"].as_int();
int isOut = jnMsg["out"].as_int();
int isRead = jnMsg["read_state"].as_int();
@@ -231,7 +231,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
if (!wszBody.IsEmpty())
wszFwdMessages = L"\n" + wszFwdMessages;
wszBody += wszFwdMessages;
@@ -239,7 +239,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
+ CMStringW wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
if (!wszBody.IsEmpty())
wszAttachmentDescr = L"\n" + wszAttachmentDescr;
wszBody += wszAttachmentDescr;
@@ -281,8 +281,8 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque m_iLoadHistoryTask--;
ptrW pwszNick(db_get_wsa(param->hContact, m_szModuleName, "Nick"));
- CMString str(FORMAT, TranslateT("Loading messages for %s is completed"), pwszNick);
- debugLog(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask);
+ CMStringW str(FORMAT, TranslateT("Loading messages for %s is completed"), pwszNick);
+ debugLogW(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask);
if (m_bNotifyForEndLoadingHistory)
MsgPopup(param->hContact, str, TranslateT("Loading history"));
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index bf5cb8bc7f..1ebed06e69 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -242,7 +242,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe }
UINT mid = jnMsg["id"].as_int();
- CMString wszBody(jnMsg["body"].as_mstring());
+ CMStringW wszBody(jnMsg["body"].as_mstring());
int datetime = jnMsg["date"].as_int();
int isOut = jnMsg["out"].as_int();
int isRead = jnMsg["read_state"].as_int();
@@ -250,13 +250,13 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
if (!wszBody.IsEmpty())
wszFwdMessages = L"\n" + wszFwdMessages;
wszBody += wszFwdMessages;
}
- CMString wszAttachmentDescr;
+ CMStringW wszAttachmentDescr;
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
@@ -280,7 +280,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (chat_id != 0) {
debugLogA("CVkProto::OnReceiveMessages chat_id != 0");
- CMString action_chat = jnMsg["action"].as_mstring();
+ CMStringW action_chat = jnMsg["action"].as_mstring();
int action_mid = _wtoi(jnMsg["action_mid"].as_mstring());
if ((action_chat == "chat_kick_user") && (action_mid == m_myUserId))
KickFromChat(chat_id, uid, jnMsg, jnFUsers);
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 9007aaeef3..c30fed271d 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -181,7 +181,7 @@ void CVkOptionAccountForm::OnInitDialog() }
for (size_t i = 0; i < _countof(vkLangCodes); i++) {
- int cur = m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
+ int cur = m_cbxVKLang.AddString(TranslateW(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.pwszVKLang))
m_cbxVKLang.SetCurSel(cur);
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 984799dad1..0ebfaf6079 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -65,7 +65,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) : mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = {sizeof(nlu)};
- nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
+ nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szSettingsModule = m_szModuleName;
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -120,7 +120,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CVkProto::OnDbEventRead);
HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged);
//Sounds
- SkinAddNewSoundExT("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event"));
+ SkinAddNewSoundExW("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event"));
InitPopups();
InitMenus();
@@ -228,7 +228,7 @@ void CVkProto::InitMenus() // Contact Menu Items
mi.root = NULL;
- mi.flags = CMIF_TCHAR;
+ mi.flags = CMIF_UNICODE;
mi.pszService = PS_VISITPROFILE;
mi.position = -200001000 + CMI_VISITPROFILE;
@@ -575,7 +575,7 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * int iRet = jnResponse.as_int();
setByte(param->hContact, "Auth", 0);
if (iRet == 2) {
- CMString msg,
+ CMStringW msg,
wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick")));
if (wszNick.IsEmpty())
wszNick = TranslateT("(Unknown contact)");
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 65f127836b..ae91f9d5f0 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -268,7 +268,7 @@ private: CVKNewsItem* GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers);
CVKNewsItem* GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers);
void OnFriendAccepted(const JSONNode &jnFeedback);
- CMString GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser);
+ CMStringW GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser);
CVKNewsItem* GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCWSTR pwszReplyText = NULL, LPCWSTR pwszReplyLink = NULL);
void RetrieveUnreadNews(time_t tLastNewsTime);
void OnReceiveUnreadNews(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
@@ -284,8 +284,8 @@ private: void SetServerStatus(int);
void RetrieveUsersInfo(bool flag = false, bool bRepeat = false);
- void RetrieveStatusMsg(const CMString &StatusMsg);
- void RetrieveStatusMusic(const CMString &StatusMsg);
+ void RetrieveStatusMsg(const CMStringW &StatusMsg);
+ void RetrieveStatusMusic(const CMStringW &StatusMsg);
void OnReceiveStatus(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveStatusMsg(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
MCONTACT SetContactInfo(const JSONNode &jnItem, bool flag = false, bool self = false);
@@ -325,8 +325,8 @@ private: bool CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &Node);
void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
bool AutoFillForm(char*, CMStringA&, CMStringA&);
- CMString RunConfirmationCode();
- CMString RunRenameNick(LPCWSTR pwszOldName);
+ CMStringW RunConfirmationCode();
+ CMStringW RunRenameNick(LPCWSTR pwszOldName);
void GrabCookies(NETLIBHTTPREQUEST *nhr);
void ApplyCookies(AsyncHttpRequest*);
void __cdecl DBAddAuthRequestThread(void *p);
@@ -338,14 +338,14 @@ private: void MarkDialogAsRead(MCONTACT hContact);
char* GetStickerId(const char *Msg, int& stickerid);
CMStringA GetAttachmentsFromMessage(const char * Msg);
- CMString SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedback, VKObjType& vkParent);
- CMString GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC);
- CMString SetBBCString(LPCWSTR wszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString = NULL);
- CMString& ClearFormatNick(CMString& wszText);
- CMString GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC = bbcNo);
- CMString GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC = bbcNo);
+ CMStringW SpanVKNotificationType(CMStringW& wszType, VKObjType& vkFeedback, VKObjType& vkParent);
+ CMStringW GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC);
+ CMStringW SetBBCString(LPCWSTR wszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString = NULL);
+ CMStringW& ClearFormatNick(CMStringW& wszText);
+ CMStringW GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC = bbcNo);
+ CMStringW GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC = bbcNo);
void SetInvisible(MCONTACT hContact);
- CMString RemoveBBC(CMString& wszSrc);
+ CMStringW RemoveBBC(CMStringW& wszSrc);
void InitQueue();
void UninitQueue();
void ExecuteRequest(AsyncHttpRequest*);
@@ -357,7 +357,7 @@ private: void OnLoggedIn();
void OnLoggedOut();
void ShutdownSession();
- void SetAvatarUrl(MCONTACT hContact, CMString &wszUrl);
+ void SetAvatarUrl(MCONTACT hContact, CMStringW &wszUrl);
void GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen);
void ReloadAvatarInfo(MCONTACT hContact);
void __cdecl SendMsgAck(void *param);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index b56376b265..7b08a446da 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -70,7 +70,7 @@ void __cdecl CVkProto::SearchThread(void *p) wchar_t arg[200];
mir_snwprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
- debugLog(L"CVkProto::SearchThread %s", arg);
+ debugLogW(L"CVkProto::SearchThread %s", arg);
if (!IsOnline())
return;
@@ -118,13 +118,13 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) break;
PROTOSEARCHRESULT psr = { sizeof(psr) };
- psr.flags = PSR_TCHAR;
+ psr.flags = PSR_UNICODE;
- CMString Id(FORMAT, L"%d", jnRecord["id"].as_int());
- CMString FirstName(jnRecord["first_name"].as_mstring());
- CMString LastName(jnRecord["last_name"].as_mstring());
- CMString Nick(jnRecord["nickname"].as_mstring());
- CMString Domain(jnRecord["domain"].as_mstring());
+ CMStringW Id(FORMAT, L"%d", jnRecord["id"].as_int());
+ CMStringW FirstName(jnRecord["first_name"].as_mstring());
+ CMStringW LastName(jnRecord["last_name"].as_mstring());
+ CMStringW Nick(jnRecord["nickname"].as_mstring());
+ CMStringW Domain(jnRecord["domain"].as_mstring());
psr.id.w = mir_wstrdup(Id);
psr.firstName.w = mir_wstrdup(FirstName);
@@ -176,13 +176,13 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) break;
PROTOSEARCHRESULT psr = { sizeof(psr) };
- psr.flags = PSR_TCHAR;
+ psr.flags = PSR_UNICODE;
- CMString Id(FORMAT, L"%d", jnRecord["id"].as_int());
- CMString FirstName(jnRecord["first_name"].as_mstring());
- CMString LastName(jnRecord["last_name"].as_mstring());
- CMString Nick(jnRecord["nickname"].as_mstring());
- CMString Email(jnRecord["contact"].as_mstring());
+ CMStringW Id(FORMAT, L"%d", jnRecord["id"].as_int());
+ CMStringW FirstName(jnRecord["first_name"].as_mstring());
+ CMStringW LastName(jnRecord["last_name"].as_mstring());
+ CMStringW Nick(jnRecord["nickname"].as_mstring());
+ CMStringW Email(jnRecord["contact"].as_mstring());
psr.id.w = mir_wstrdup(Id);
psr.firstName.w = mir_wstrdup(FirstName);
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 5f58c9dcf3..6bba4870c6 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -69,7 +69,7 @@ void CVkProto::SetServerStatus(int iNewStatus) return;
int iOldStatus = m_iStatus;
- CMString oldStatusMsg(ptrW(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg")));
+ CMStringW oldStatusMsg(ptrW(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg")));
ptrW pwszListeningToMsg(db_get_wsa(NULL, m_szModuleName, "ListeningTo"));
if (iNewStatus == ID_STATUS_OFFLINE) {
@@ -127,7 +127,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR OnReceiveStatus(reply, pReq);
ptrW pwszOldStatusMsg(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg"));
- CMString wszOldStatusMsg(pwszOldStatusMsg);
+ CMStringW wszOldStatusMsg(pwszOldStatusMsg);
ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_MULTILINE;
@@ -139,7 +139,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (!EnterString(&pForm))
return;
- CMString wszNewStatusMsg(ptrW(pForm.ptszResult));
+ CMStringW wszNewStatusMsg(ptrW(pForm.ptszResult));
if (wszOldStatusMsg == wszNewStatusMsg)
return;
@@ -159,13 +159,13 @@ void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnAudio = jnResponse["audio"];
if (!jnAudio) {
- CMString wszStatusText(jnResponse["text"].as_mstring());
+ CMStringW wszStatusText(jnResponse["text"].as_mstring());
if (wszStatusText[0] != wchar_t(9835))
setWString("OldStatusMsg", wszStatusText);
}
}
-void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg)
+void CVkProto::RetrieveStatusMsg(const CMStringW &StatusMsg)
{
debugLogA("CVkProto::RetrieveStatusMsg");
if (!IsOnline())
@@ -175,26 +175,26 @@ void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg) << WCHAR_PARAM("text", StatusMsg));
}
-void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg)
+void CVkProto::RetrieveStatusMusic(const CMStringW &StatusMsg)
{
debugLogA("CVkProto::RetrieveStatusMusic");
if (!IsOnline() || m_iStatus == ID_STATUS_INVISIBLE || m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone)
return;
- CMString code;
- CMString wszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg"));
+ CMStringW code;
+ CMStringW wszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg"));
if (StatusMsg.IsEmpty()) {
if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly)
code = "API.audio.setBroadcast();return null;";
else {
- CMString codeformat("API.status.set({text:\"%s\"});return null;");
+ CMStringW codeformat("API.status.set({text:\"%s\"});return null;");
code.AppendFormat(codeformat, wszOldStatusMsg);
}
m_bSetBroadcast = false;
}
else {
if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly) {
- CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var OldMsg=API.status.get();"
+ CMStringW 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();}"
@@ -205,13 +205,13 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) code.AppendFormat(codeformat, StatusMsg);
}
else if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendStatusOnly) {
- CMString codeformat("var StatusMsg=\"♫ %s\";var OldMsg=API.status.get();"
+ CMStringW codeformat("var StatusMsg=\"♫ %s\";var OldMsg=API.status.get();"
"API.status.set({\"text\":StatusMsg});"
"return OldMsg;");
code.AppendFormat(codeformat, StatusMsg);
}
else if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastAndStatus) {
- CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var Track=\" \";var OldMsg=API.status.get();"
+ CMStringW codeformat("var StatusMsg=\"%s\";var CntLmt=100;var Track=\" \";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){Track=\"♫ \"+StatusMsg;API.status.set({\"text\":Track});}"
@@ -235,7 +235,7 @@ INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam) return 1;
LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
- CMString wszListeningTo;
+ CMStringW wszListeningTo;
if (pliInfo == NULL || pliInfo->cbSize != sizeof(LISTENINGTOINFO))
db_unset(NULL, m_szModuleName, "ListeningTo");
else if (pliInfo->dwFlags & LTI_UNICODE) {
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 54813f388f..8d787a6101 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -185,7 +185,7 @@ struct CVkUserInfo : public MZeroedObject { m_bIsGroup(false)
{}
- CVkUserInfo(LONG _UserId, bool _bIsGroup, CMString& _wszUserNick, CMString& _wszLink, MCONTACT _hContact = NULL) :
+ CVkUserInfo(LONG _UserId, bool _bIsGroup, CMStringW& _wszUserNick, CMStringW& _wszLink, MCONTACT _hContact = NULL) :
m_UserId(_UserId),
m_bIsGroup(_bIsGroup),
m_wszUserNick(_wszUserNick),
@@ -195,8 +195,8 @@ struct CVkUserInfo : public MZeroedObject { LONG m_UserId;
MCONTACT m_hContact;
- CMString m_wszUserNick;
- CMString m_wszLink;
+ CMStringW m_wszUserNick;
+ CMStringW m_wszLink;
bool m_bIsGroup;
};
@@ -218,14 +218,14 @@ struct CVKNewsItem : public MZeroedObject { vkParentType(vkNull)
{}
- CMString wszId;
+ CMStringW wszId;
time_t tDate;
CVkUserInfo *vkUser;
- CMString wszText;
- CMString wszLink;
- CMString wszType;
- CMString wszPopupTitle;
- CMString wszPopupText;
+ CMStringW wszText;
+ CMStringW wszLink;
+ CMStringW wszType;
+ CMStringW wszPopupTitle;
+ CMStringW wszPopupText;
VKObjType vkFeedbackType, vkParentType;
bool bIsGroup;
bool bIsRepost;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 05cf3f6daa..d2022cb2df 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -271,7 +271,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) else if (hContact == NULL)
return NULL;
- CMString wszNick, wszValue;
+ CMStringW wszNick, wszValue;
int iValue;
wszValue = jnItem["first_name"].as_mstring();
@@ -355,14 +355,14 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) setWString(hContact, "Phone", wszValue);
wszValue = jnItem["status"].as_mstring();
- CMString wszOldStatus(ptrW(db_get_wsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
+ CMStringW wszOldStatus(ptrW(db_get_wsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
if (wszValue != wszOldStatus)
db_set_ws(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", wszValue);
- CMString wszOldListeningTo(ptrW(db_get_wsa(hContact, m_szModuleName, "ListeningTo")));
+ CMStringW wszOldListeningTo(ptrW(db_get_wsa(hContact, m_szModuleName, "ListeningTo")));
const JSONNode &jnAudio = jnItem["status_audio"];
if (jnAudio) {
- CMString wszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring());
+ CMStringW wszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring());
if (wszListeningTo != wszOldListeningTo) {
setWString(hContact, "ListeningTo", wszListeningTo);
setWString(hContact, "AudioUrl", jnAudio["url"].as_mstring());
@@ -447,7 +447,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) wszValue = jnItem["domain"].as_mstring();
if (!wszValue.IsEmpty()) {
setWString(hContact, "domain", wszValue);
- CMString wszUrl("https://vk.com/");
+ CMStringW wszUrl("https://vk.com/");
wszUrl.Append(wszValue);
setWString(hContact, "Homepage", wszUrl);
}
@@ -461,8 +461,8 @@ void CVkProto::RetrieveUserInfo(LONG userID) if (userID == VK_FEED_USER || !IsOnline())
return;
- CMString code(FORMAT, L"var userIDs=\"%i\";var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});return{\"freeoffline\":0,\"norepeat\":1,\"usercount\":res.length,\"users\":res};",
- userID, CMString(fieldsName));
+ CMStringW code(FORMAT, L"var userIDs=\"%i\";var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});return{\"freeoffline\":0,\"norepeat\":1,\"usercount\":res.length,\"users\":res};",
+ userID, CMStringW(fieldsName));
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
<< WCHAR_PARAM("code", code));
}
@@ -473,7 +473,7 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) if (!IsOnline())
return;
- CMString userIDs, code;
+ CMStringW userIDs, code;
int i = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
LONG userID = getDword(hContact, "ID", -1);
@@ -488,22 +488,22 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) i++;
}
- CMString codeformat("var userIDs=\"%s\";var _fields=\"%s\";");
+ CMStringW codeformat("var userIDs=\"%s\";var _fields=\"%s\";");
if (m_bNeedSendOnline)
codeformat += L"API.account.setOnline();";
if (bFreeOffline && !m_vkOptions.bLoadFullCList)
- codeformat += CMString("var US=[];var res=[];var t=10;while(t>0){"
+ codeformat += CMStringW("var US=[];var res=[];var t=10;while(t>0){"
"US=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});"
"var index=US.length;while(index>0){"
"index=index-1;if(US[index].online!=0){res.push(US[index]);};};"
"t=t-1;if(res.length>0)t=0;};"
"return{\"freeoffline\":1,\"norepeat\":%d,\"usercount\":res.length,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
else
- codeformat += CMString("var res=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});"
+ codeformat += CMStringW("var res=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});"
"return{\"freeoffline\":0,\"norepeat\":%d,\"usercount\":res.length,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
- code.AppendFormat(codeformat, userIDs, CMString(bFreeOffline ? "online,status" : fieldsName), (int)bRepeat);
+ code.AppendFormat(codeformat, userIDs, CMStringW(bFreeOffline ? "online,status" : fieldsName), (int)bRepeat);
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
<< WCHAR_PARAM("code", code));
@@ -679,7 +679,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) return 1;
ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
- CMString pwszMsg;
+ CMStringW pwszMsg;
if (flag == 0) {
pwszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick);
if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
@@ -699,10 +699,10 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (jnResponse) {
- CMString wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick")));
+ CMStringW wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick")));
if (wszNick.IsEmpty())
wszNick = TranslateT("(Unknown contact)");
- CMString msgformat, msg;
+ CMStringW msgformat, msg;
if (jnResponse["success"].as_bool()) {
if (jnResponse["friend_deleted"].as_bool())
@@ -739,7 +739,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) return 1;
CMStringA code(FORMAT, "var userID=\"%d\";API.account.banUser({\"user_id\":userID});", userID);
- CMString wszVarWarning;
+ CMStringW wszVarWarning;
if (m_vkOptions.bReportAbuse) {
debugLogA("CVkProto::SvcBanUser m_vkOptions.bReportAbuse = true");
@@ -772,7 +772,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) code += "return 1;";
ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
- CMString pwszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"),
+ CMStringW pwszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"),
IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick,
wszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"),
wszVarWarning.IsEmpty() ? L"\n" : wszVarWarning);
@@ -796,7 +796,7 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- CMString wszNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"))),
+ CMStringW wszNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"))),
pwszMsg(FORMAT, TranslateT("Are you sure to report abuse on %s?"), wszNick.IsEmpty() ? TranslateT("(Unknown contact)") : wszNick);
if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
@@ -812,7 +812,7 @@ INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcOpenBroadcast");
- CMString wszAudio(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl")));
+ CMStringW wszAudio(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl")));
if (!wszAudio.IsEmpty())
Utils_OpenUrlW(wszAudio);
@@ -832,7 +832,7 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) LONG userID = getDword(hContact, "ID", -1);
ptrW wszDomain(db_get_wsa(hContact, m_szModuleName, "domain"));
- CMString wszUrl("https://vk.com/");
+ CMStringW wszUrl("https://vk.com/");
if (wszDomain)
wszUrl.Append(wszDomain);
else
|