diff options
22 files changed, 822 insertions, 822 deletions
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index ef8c14bb0c..37b4d45afa 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -56,9 +56,9 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO /////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CVkProto* vkProtoInit(const char *pszProtoName, const wchar_t *tszUserName)
+static CVkProto* vkProtoInit(const char *pszProtoName, const wchar_t *wszUserName)
{
- CVkProto *ppro = new CVkProto(pszProtoName, tszUserName);
+ CVkProto *ppro = new CVkProto(pszProtoName, wszUserName);
return ppro;
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 31865ddd4a..eb2f59380b 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -27,7 +27,7 @@ static const char *szVKLinkParam[] = { "?z=", "?w=", "&z=", "&w=" }; JSONNode nullNode(JSON_NULL);
-bool IsEmpty(LPCTSTR str)
+bool IsEmpty(LPCWSTR str)
{
return (str == NULL || str[0] == 0);
}
@@ -46,7 +46,7 @@ LPCSTR findHeader(NETLIBHTTPREQUEST *pReq, LPCSTR szField) return NULL;
}
-bool tlstrstr(wchar_t *_s1, wchar_t *_s2)
+bool wlstrstr(wchar_t *_s1, wchar_t *_s2)
{
wchar_t s1[1024], s2[1024];
@@ -193,7 +193,7 @@ MCONTACT CVkProto::FindUser(LONG dwUserid, bool bCreate) MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD);
Proto_AddToContact(hNewContact, m_szModuleName);
setDword(hNewContact, "ID", dwUserid);
- db_set_ts(hNewContact, "CList", "Group", m_vkOptions.ptszDefaultGroup);
+ db_set_ws(hNewContact, "CList", "Group", m_vkOptions.pwszDefaultGroup);
return hNewContact;
}
@@ -389,7 +389,7 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul CMStringA name = getAttr(pFieldBeg, "name");
CMStringA value = getAttr(pFieldBeg, "value");
if (name == "email")
- value = (char*)T2Utf(ptrW(getTStringA("Login")));
+ value = (char*)T2Utf(ptrW(getWStringA("Login")));
else if (name == "pass")
value = (char*)T2Utf(ptrW(GetUserStoredPassword()));
else if (name == "captcha_key") {
@@ -424,13 +424,13 @@ CMString CVkProto::RunConfirmationCode() return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
-CMString CVkProto::RunRenameNick(LPCTSTR ptszOldName)
+CMString CVkProto::RunRenameNick(LPCWSTR pwszOldName)
{
ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_COMBO;
pForm.recentCount = 0;
pForm.caption = TranslateT("Enter new nickname");
- pForm.ptszInitVal = ptszOldName;
+ pForm.ptszInitVal = pwszOldName;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "renamenick_";
return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
@@ -504,7 +504,7 @@ void __cdecl CVkProto::DBAddAuthRequestThread(void *p) if (param->hContact == NULL || param->hContact == INVALID_CONTACT_ID || !IsOnline())
return;
- for (int i = 0; i < MAX_RETRIES && IsEmpty(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick"))); i++) {
+ for (int i = 0; i < MAX_RETRIES && IsEmpty(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick"))); i++) {
Sleep(1500);
if (!IsOnline())
@@ -519,9 +519,9 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added) {
debugLogA("CVkProto::DBAddAuthRequest");
- T2Utf szNick(ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")));
- T2Utf szFirstName(ptrW(db_get_tsa(hContact, m_szModuleName, "FirstName")));
- T2Utf szLastName(ptrW(db_get_tsa(hContact, m_szModuleName, "LastName")));
+ T2Utf szNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick")));
+ T2Utf szFirstName(ptrW(db_get_wsa(hContact, m_szModuleName, "FirstName")));
+ T2Utf szLastName(ptrW(db_get_wsa(hContact, m_szModuleName, "LastName")));
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
@@ -589,7 +589,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) return;
}
- CMString MirVer, OldMirVer(ptrW(db_get_tsa(hContact, m_szModuleName, "MirVer")));
+ CMString MirVer, OldMirVer(ptrW(db_get_wsa(hContact, m_szModuleName, "MirVer")));
bool bSetFlag = true;
switch (platform) {
@@ -641,7 +641,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) return;
if (bSetFlag)
- setTString(hContact, "MirVer", MirVer);
+ setWString(hContact, "MirVer", MirVer);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -830,7 +830,7 @@ int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-CMString CVkProto::SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedback, VKObjType& vkParent)
+CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedback, VKObjType& vkParent)
{
CVKNotification vkNotification[] = {
// type, parent, feedback, string for translate
@@ -866,61 +866,61 @@ CMString CVkProto::SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedba { L"mention_comment_video", vkVideo, vkComment, L"mentioned you in comment to video" }
};
- CMString tszRes;
+ CMString wszRes;
vkFeedback = vkParent = vkNull;
for (int i = 0; i < _countof(vkNotification); i++)
- if (tszType == vkNotification[i].ptszType) {
+ if (wszType == vkNotification[i].pwszType) {
vkFeedback = vkNotification[i].vkFeedback;
vkParent = vkNotification[i].vkParent;
- tszRes = vkNotification[i].ptszTranslate;
+ wszRes = vkNotification[i].pwszTranslate;
break;
}
- return tszRes;
+ return wszRes;
}
CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC)
{
- CMString tszRes;
+ CMString wszRes;
if (!jnPhoto)
- return tszRes;
+ return wszRes;
- CMString tszLink, tszPreviewLink;
+ CMString wszLink, wszPreviewLink;
for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnPhoto[szImageTypes[i]];
if (n) {
- tszLink = n.as_mstring();
+ wszLink = n.as_mstring();
break;
}
}
switch (m_vkOptions.iIMGBBCSupport) {
case imgNo:
- tszPreviewLink = L"";
+ wszPreviewLink = L"";
break;
case imgFullSize:
- tszPreviewLink = tszLink;
+ wszPreviewLink = wszLink;
break;
case imgPreview130:
case imgPreview604:
- tszPreviewLink = jnPhoto[m_vkOptions.iIMGBBCSupport == imgPreview130 ? "photo_130" : "photo_604"].as_mstring();
+ wszPreviewLink = jnPhoto[m_vkOptions.iIMGBBCSupport == imgPreview130 ? "photo_130" : "photo_604"].as_mstring();
break;
}
int iWidth = jnPhoto["width"].as_int();
int iHeight = jnPhoto["height"].as_int();
- tszRes.AppendFormat(L"%s (%dx%d)", SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, tszLink), iWidth, iHeight);
+ wszRes.AppendFormat(L"%s (%dx%d)", SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, wszLink), iWidth, iHeight);
if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
- tszRes.AppendFormat(L"\n\t%s", SetBBCString(!tszPreviewLink.IsEmpty() ? tszPreviewLink : (!tszLink.IsEmpty() ? tszLink : L""), bbcBasic, vkbbcImg));
- CMString tszText(jnPhoto["text"].as_mstring());
- if (!tszText.IsEmpty())
- tszRes += L"\n" + tszText;
+ wszRes.AppendFormat(L"\n\t%s", SetBBCString(!wszPreviewLink.IsEmpty() ? wszPreviewLink : (!wszLink.IsEmpty() ? wszLink : L""), bbcBasic, vkbbcImg));
+ CMString wszText(jnPhoto["text"].as_mstring());
+ if (!wszText.IsEmpty())
+ wszRes += L"\n" + wszText;
- return tszRes;
+ return wszRes;
}
-CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType bbcType, LPCTSTR tszAddString)
+CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString)
{
CVKBBCItem bbcItem[] = {
{ vkbbcB, bbcNo, L"%s" },
@@ -952,41 +952,41 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b { vkbbcColor, bbcAdvanced, L"[color=%s]%s[/color]" },
};
- if (IsEmpty(ptszString))
+ if (IsEmpty(pwszString))
return CMString();
- wchar_t *ptszFormat = NULL;
+ wchar_t *pwszFormat = NULL;
for (int i = 0; i < _countof(bbcItem); i++)
if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) {
- ptszFormat = bbcItem[i].ptszTempate;
+ pwszFormat = bbcItem[i].pwszTempate;
break;
}
CMString res;
- if (ptszFormat == NULL)
- return CMString(ptszString);
+ if (pwszFormat == NULL)
+ return CMString(pwszString);
if (bbcType == vkbbcUrl && iBBC != bbcAdvanced)
- res.AppendFormat(ptszFormat, ptszString, tszAddString ? tszAddString : L"");
+ res.AppendFormat(pwszFormat, pwszString, wszAddString ? wszAddString : L"");
else if (iBBC == bbcAdvanced && bbcType >= vkbbcUrl)
- res.AppendFormat(ptszFormat, tszAddString ? tszAddString : L"", ptszString);
+ res.AppendFormat(pwszFormat, wszAddString ? wszAddString : L"", pwszString);
else
- res.AppendFormat(ptszFormat, ptszString);
+ res.AppendFormat(pwszFormat, pwszString);
return res;
}
-CMString& CVkProto::ClearFormatNick(CMString& tszText)
+CMString& CVkProto::ClearFormatNick(CMString& wszText)
{
- int iNameEnd = tszText.Find(L"],"), iNameBeg = tszText.Find(L"|");
+ int iNameEnd = wszText.Find(L"],"), iNameBeg = wszText.Find(L"|");
if (iNameEnd != -1 && iNameBeg != -1 && iNameBeg < iNameEnd) {
- CMString tszName = tszText.Mid(iNameBeg + 1, iNameEnd - iNameBeg - 1);
- CMString tszBody = tszText.Mid(iNameEnd + 2);
- if (!tszName.IsEmpty() && !tszBody.IsEmpty())
- tszText = tszName + L"," + tszBody;
+ CMString wszName = wszText.Mid(iNameBeg + 1, iNameEnd - iNameBeg - 1);
+ CMString wszBody = wszText.Mid(iNameEnd + 2);
+ if (!wszName.IsEmpty() && !wszBody.IsEmpty())
+ wszText = wszName + L"," + wszBody;
}
- return tszText;
+ return wszText;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1007,100 +1007,100 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnAttach = (*it);
res.AppendChar('\t');
- CMString tszType(jnAttach["type"].as_mstring());
- if (tszType == L"photo") {
+ CMString wszType(jnAttach["type"].as_mstring());
+ if (wszType == L"photo") {
const JSONNode &jnPhoto = jnAttach["photo"];
if (!jnPhoto)
continue;
res += GetVkPhotoItem(jnPhoto, iBBC);
}
- else if (tszType ==L"audio") {
+ else if (wszType ==L"audio") {
const JSONNode &jnAudio = jnAttach["audio"];
if (!jnAudio)
continue;
- CMString tszArtist(jnAudio["artist"].as_mstring());
- CMString tszTitle(jnAudio["title"].as_mstring());
- CMString tszUrl(jnAudio["url"].as_mstring());
- CMString tszAudio(FORMAT, L"%s - %s", tszArtist, tszTitle);
+ 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);
- int iParamPos = tszUrl.Find(L"?");
+ int iParamPos = wszUrl.Find(L"?");
if (m_vkOptions.bShortenLinksForAudio && iParamPos != -1)
- tszUrl = tszUrl.Left(iParamPos);
+ wszUrl = wszUrl.Left(iParamPos);
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Audio"), iBBC, vkbbcB),
- SetBBCString(tszAudio, iBBC, vkbbcUrl, tszUrl));
+ SetBBCString(wszAudio, iBBC, vkbbcUrl, wszUrl));
}
- else if (tszType ==L"video") {
+ else if (wszType ==L"video") {
const JSONNode &jnVideo = jnAttach["video"];
if (!jnVideo)
continue;
- CMString tszTitle(jnVideo["title"].as_mstring());
+ CMString wszTitle(jnVideo["title"].as_mstring());
int vid = jnVideo["id"].as_int();
int ownerID = jnVideo["owner_id"].as_int();
- CMString tszUrl(FORMAT, L"https://vk.com/video%d_%d", ownerID, vid);
+ CMString wszUrl(FORMAT, L"https://vk.com/video%d_%d", ownerID, vid);
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Video"), iBBC, vkbbcB),
- SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
+ SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl));
}
- else if (tszType == L"doc") {
+ else if (wszType == L"doc") {
const JSONNode &jnDoc = jnAttach["doc"];
if (!jnDoc)
continue;
- CMString tszTitle(jnDoc["title"].as_mstring());
- CMString tszUrl(jnDoc["url"].as_mstring());
+ CMString wszTitle(jnDoc["title"].as_mstring());
+ CMString wszUrl(jnDoc["url"].as_mstring());
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Document"), iBBC, vkbbcB),
- SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
+ SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl));
}
- else if (tszType == L"wall") {
+ else if (wszType == L"wall") {
const JSONNode &jnWall = jnAttach["wall"];
if (!jnWall)
continue;
- CMString tszText(jnWall["text"].as_mstring());
+ CMString wszText(jnWall["text"].as_mstring());
int id = jnWall["id"].as_int();
int fromID = jnWall["from_id"].as_int();
- CMString tszUrl(FORMAT, L"https://vk.com/wall%d_%d", fromID, id);
+ CMString wszUrl(FORMAT, L"https://vk.com/wall%d_%d", fromID, id);
res.AppendFormat(L"%s: %s",
- SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, tszUrl),
- tszText.IsEmpty() ? L" " : tszText);
+ SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, wszUrl),
+ wszText.IsEmpty() ? L" " : wszText);
const JSONNode &jnCopyHystory = jnWall["copy_history"];
for (auto aCHit = jnCopyHystory.begin(); aCHit != jnCopyHystory.end(); ++aCHit) {
const JSONNode &jnCopyHystoryItem = (*aCHit);
- CMString tszCHText(jnCopyHystoryItem["text"].as_mstring());
+ CMString wszCHText(jnCopyHystoryItem["text"].as_mstring());
int iCHid = jnCopyHystoryItem["id"].as_int();
int iCHfromID = jnCopyHystoryItem["from_id"].as_int();
- CMString tszCHUrl(FORMAT, L"https://vk.com/wall%d_%d", iCHfromID, iCHid);
- tszCHText.Replace(L"\n", L"\n\t\t");
+ CMString 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, tszCHUrl),
- tszCHText.IsEmpty() ? L" " : tszCHText);
+ SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, wszCHUrl),
+ wszCHText.IsEmpty() ? L" " : wszCHText);
const JSONNode &jnSubAttachments = jnCopyHystoryItem["attachments"];
if (jnSubAttachments) {
debugLogA("CVkProto::GetAttachmentDescr SubAttachments");
- CMString tszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
- tszAttachmentDescr.Replace(L"\n", L"\n\t\t");
- res += L"\n\t\t" + tszAttachmentDescr;
+ CMString wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
+ wszAttachmentDescr.Replace(L"\n", L"\n\t\t");
+ res += L"\n\t\t" + wszAttachmentDescr;
}
}
const JSONNode &jnSubAttachments = jnWall["attachments"];
if (jnSubAttachments) {
debugLogA("CVkProto::GetAttachmentDescr SubAttachments");
- CMString tszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
- tszAttachmentDescr.Replace(L"\n", L"\n\t");
- res += L"\n\t" + tszAttachmentDescr;
+ CMString wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
+ wszAttachmentDescr.Replace(L"\n", L"\n\t");
+ res += L"\n\t" + wszAttachmentDescr;
}
}
- else if (tszType == L"sticker") {
+ else if (wszType == L"sticker") {
const JSONNode &jnSticker = jnAttach["sticker"];
if (!jnSticker)
continue;
@@ -1111,52 +1111,52 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport res.AppendFormat(L"[sticker:%d]", id);
}
else {
- CMString tszLink;
+ CMString wszLink;
for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnSticker[szImageTypes[i]];
if (n) {
- tszLink = n.as_mstring();
+ wszLink = n.as_mstring();
break;
}
}
- res.AppendFormat(L"%s", tszLink);
+ res.AppendFormat(L"%s", wszLink);
if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
- res += SetBBCString(tszLink, iBBC, vkbbcImg);
+ res += SetBBCString(wszLink, iBBC, vkbbcImg);
}
}
- else if (tszType == L"link") {
+ else if (wszType == L"link") {
const JSONNode &jnLink = jnAttach["link"];
if (!jnLink)
continue;
- CMString tszUrl(jnLink["url"].as_mstring());
- CMString tszTitle(jnLink["title"].as_mstring());
- CMString tszCaption(jnLink["caption"].as_mstring());
- CMString tszDescription(jnLink["description"].as_mstring());
+ CMString wszUrl(jnLink["url"].as_mstring());
+ CMString wszTitle(jnLink["title"].as_mstring());
+ CMString wszCaption(jnLink["caption"].as_mstring());
+ CMString wszDescription(jnLink["description"].as_mstring());
res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Link"), iBBC, vkbbcB),
- SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
+ SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl));
- if (!tszCaption.IsEmpty())
- res.AppendFormat(L"\n\t%s", SetBBCString(tszCaption, iBBC, vkbbcI));
+ if (!wszCaption.IsEmpty())
+ res.AppendFormat(L"\n\t%s", SetBBCString(wszCaption, iBBC, vkbbcI));
if (jnLink["photo"])
res.AppendFormat(L"\n\t%s", GetVkPhotoItem(jnLink["photo"], iBBC));
- if (!tszDescription.IsEmpty())
- res.AppendFormat(L"\n\t%s", tszDescription);
+ if (!wszDescription.IsEmpty())
+ res.AppendFormat(L"\n\t%s", wszDescription);
}
- else if (tszType == L"market") {
+ else if (wszType == L"market") {
const JSONNode &jnMarket = jnAttach["market"];
int id = jnMarket["id"].as_int();
int ownerID = jnMarket["owner_id"].as_int();
- CMString tszTitle(jnMarket["title"].as_mstring());
- CMString tszDescription(jnMarket["description"].as_mstring());
- CMString tszPhoto(jnMarket["thumb_photo"].as_mstring());
- CMString tszUrl(FORMAT, L"https://vk.com/%s%d?w=product%d_%d",
+ 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",
ownerID > 0 ? L"id" : L"club",
ownerID > 0 ? ownerID : (-1)*ownerID,
ownerID,
@@ -1164,43 +1164,43 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport res.AppendFormat(L"%s: %s",
SetBBCString(TranslateT("Product"), iBBC, vkbbcB),
- SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
+ SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl));
- if (!tszPhoto.IsEmpty())
+ if (!wszPhoto.IsEmpty())
res.AppendFormat(L"\n\t%s: %s",
SetBBCString(TranslateT("Photo"), iBBC, vkbbcB),
- SetBBCString(tszPhoto, iBBC, vkbbcImg));
+ SetBBCString(wszPhoto, iBBC, vkbbcImg));
if (jnMarket["price"] && jnMarket["price"]["text"])
res.AppendFormat(L"\n\t%s: %s",
SetBBCString(TranslateT("Price"), iBBC, vkbbcB),
jnMarket["price"]["text"].as_mstring());
- if (!tszDescription.IsEmpty())
- res.AppendFormat(L"\n\t%s", tszDescription);
+ if (!wszDescription.IsEmpty())
+ res.AppendFormat(L"\n\t%s", wszDescription);
}
- else if (tszType == L"gift") {
+ else if (wszType == L"gift") {
const JSONNode &jnGift = jnAttach["gift"];
if (!jnGift)
continue;
- CMString tszLink;
+ CMString wszLink;
for (int i = 0; i < _countof(szGiftTypes); i++) {
const JSONNode &n = jnGift[szGiftTypes[i]];
if (n) {
- tszLink = n.as_mstring();
+ wszLink = n.as_mstring();
break;
}
}
- if (tszLink.IsEmpty())
+ if (wszLink.IsEmpty())
continue;
- res += SetBBCString(TranslateT("Gift"), iBBC, vkbbcUrl, tszLink);
+ res += SetBBCString(TranslateT("Gift"), iBBC, vkbbcUrl, wszLink);
if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
- res.AppendFormat(L"\n\t%s", SetBBCString(tszLink, iBBC, vkbbcImg));
+ res.AppendFormat(L"\n\t%s", SetBBCString(wszLink, iBBC, vkbbcImg));
}
else
- res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), SetBBCString(tszType, iBBC, vkbbcB));
+ res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), SetBBCString(wszType, iBBC, vkbbcB));
res.AppendChar('\n');
}
@@ -1223,10 +1223,10 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnUser = (*it);
int iUserId = jnUser["id"].as_int();
- CMString tszNick(FORMAT, L"%s %s", jnUser["first_name"].as_mstring(), jnUser["last_name"].as_mstring());
- CMString tszLink(FORMAT, L"https://vk.com/id%d", iUserId);
+ 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);
- CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, tszNick, tszLink, FindUser(iUserId));
+ CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, wszNick, wszLink, FindUser(iUserId));
vkUsers.insert(vkUser);
}
@@ -1236,19 +1236,19 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn UINT uid = jnMsg["user_id"].as_int();
CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&uid);
- CMString tszNick, tszUrl;
+ CMString wszNick, wszUrl;
if (vkUser) {
- tszNick = vkUser->m_tszUserNick;
- tszUrl = vkUser->m_tszLink;
+ wszNick = vkUser->m_wszUserNick;
+ wszUrl = vkUser->m_wszLink;
}
else {
MCONTACT hContact = FindUser(uid);
if (hContact || uid == m_msgId)
- tszNick = ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ wszNick = ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"));
else
- tszNick = TranslateT("(Unknown contact)");
- tszUrl.AppendFormat(L"https://vk.com/id%d", uid);
+ wszNick = TranslateT("(Unknown contact)");
+ wszUrl.AppendFormat(L"https://vk.com/id%d", uid);
}
time_t datetime = (time_t)jnMsg["date"].as_int();
@@ -1257,37 +1257,37 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn _wcsftime_l(ttime, _countof(ttime), L"%x %X", localtime(&datetime), locale);
_free_locale(locale);
- CMString tszBody(jnMsg["body"].as_mstring());
+ CMString wszBody(jnMsg["body"].as_mstring());
const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
- if (!tszBody.IsEmpty())
- tszFwdMessages = L"\n" + tszFwdMessages;
- tszBody += tszFwdMessages;
+ CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszFwdMessages = L"\n" + wszFwdMessages;
+ wszBody += wszFwdMessages;
}
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
- if (!tszBody.IsEmpty())
- tszAttachmentDescr = L"\n" + tszAttachmentDescr;
- tszBody += tszAttachmentDescr;
+ CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszAttachmentDescr = L"\n" + wszAttachmentDescr;
+ wszBody += wszAttachmentDescr;
}
- tszBody.Replace(L"\n", L"\n\t");
+ wszBody.Replace(L"\n", L"\n\t");
wchar_t tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' ';
- CMString tszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n",
+ CMString wszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n",
SetBBCString(TranslateT("Message from"), iBBC, vkbbcB),
- SetBBCString(tszNick, iBBC, vkbbcUrl, tszUrl),
+ SetBBCString(wszNick, iBBC, vkbbcUrl, wszUrl),
tcSplit,
SetBBCString(TranslateT("at"), iBBC, vkbbcB),
ttime,
- SetBBCString(tszBody, iBBC, vkbbcCode));
+ SetBBCString(wszBody, iBBC, vkbbcCode));
if (!res.IsEmpty())
res.AppendChar('\n');
- res += tszMes;
+ res += wszMes;
}
vkUsers.destroy();
@@ -1310,95 +1310,95 @@ void CVkProto::SetInvisible(MCONTACT hContact) setDword(hContact, "InvisibleTS", (DWORD)now);
}
-CMString CVkProto::RemoveBBC(CMString& tszSrc)
+CMString CVkProto::RemoveBBC(CMString& wszSrc)
{
- static const wchar_t *tszSimpleBBCodes[][2] = {
+ static const wchar_t *wszSimpleBBCodes[][2] = {
{ L"[b]", L"[/b]" },
{ L"[u]", L"[/u]" },
{ L"[i]", L"[/i]" },
{ L"[s]", L"[/s]" },
};
- static const wchar_t *tszParamBBCodes[][2] = {
+ static const wchar_t *wszParamBBCodes[][2] = {
{ L"[url=", L"[/url]" },
{ L"[img=", L"[/img]" },
{ L"[size=", L"[/size]" },
{ L"[color=", L"[/color]" },
};
- CMString tszRes(tszSrc);
- CMString tszLow(tszSrc);
- tszLow.MakeLower();
+ CMString wszRes(wszSrc);
+ CMString wszLow(wszSrc);
+ wszLow.MakeLower();
- for (int i = 0; i < _countof(tszSimpleBBCodes); i++) {
- CMString tszOpenTag(tszSimpleBBCodes[i][0]);
- CMString tszCloseTag(tszSimpleBBCodes[i][1]);
+ for (int i = 0; i < _countof(wszSimpleBBCodes); i++) {
+ CMString wszOpenTag(wszSimpleBBCodes[i][0]);
+ CMString wszCloseTag(wszSimpleBBCodes[i][1]);
- int lenOpen = tszOpenTag.GetLength();
- int lenClose = tszCloseTag.GetLength();
+ int lenOpen = wszOpenTag.GetLength();
+ int lenClose = wszCloseTag.GetLength();
int posOpen = 0;
int posClose = 0;
while (true) {
- if ((posOpen = tszLow.Find(tszOpenTag, posOpen)) < 0)
+ if ((posOpen = wszLow.Find(wszOpenTag, posOpen)) < 0)
break;
- if ((posClose = tszLow.Find(tszCloseTag, posOpen + lenOpen)) < 0)
+ if ((posClose = wszLow.Find(wszCloseTag, posOpen + lenOpen)) < 0)
break;
- tszLow.Delete(posOpen, lenOpen);
- tszLow.Delete(posClose - lenOpen, lenClose);
+ wszLow.Delete(posOpen, lenOpen);
+ wszLow.Delete(posClose - lenOpen, lenClose);
- tszRes.Delete(posOpen, lenOpen);
- tszRes.Delete(posClose - lenOpen, lenClose);
+ wszRes.Delete(posOpen, lenOpen);
+ wszRes.Delete(posClose - lenOpen, lenClose);
}
}
- for (int i = 0; i < _countof(tszParamBBCodes); i++) {
- CMString tszOpenTag(tszParamBBCodes[i][0]);
- CMString tszCloseTag(tszParamBBCodes[i][1]);
+ for (int i = 0; i < _countof(wszParamBBCodes); i++) {
+ CMString wszOpenTag(wszParamBBCodes[i][0]);
+ CMString wszCloseTag(wszParamBBCodes[i][1]);
- int lenOpen = tszOpenTag.GetLength();
- int lenClose = tszCloseTag.GetLength();
+ int lenOpen = wszOpenTag.GetLength();
+ int lenClose = wszCloseTag.GetLength();
int posOpen = 0;
int posOpen2 = 0;
int posClose = 0;
while (true) {
- if ((posOpen = tszLow.Find(tszOpenTag, posOpen)) < 0)
+ if ((posOpen = wszLow.Find(wszOpenTag, posOpen)) < 0)
break;
- if ((posOpen2 = tszLow.Find(L"]", posOpen + lenOpen)) < 0)
+ if ((posOpen2 = wszLow.Find(L"]", posOpen + lenOpen)) < 0)
break;
- if ((posClose = tszLow.Find(tszCloseTag, posOpen2 + 1)) < 0)
+ if ((posClose = wszLow.Find(wszCloseTag, posOpen2 + 1)) < 0)
break;
- tszLow.Delete(posOpen, posOpen2 - posOpen + 1);
- tszLow.Delete(posClose - posOpen2 + posOpen - 1, lenClose);
+ wszLow.Delete(posOpen, posOpen2 - posOpen + 1);
+ wszLow.Delete(posClose - posOpen2 + posOpen - 1, lenClose);
- tszRes.Delete(posOpen, posOpen2 - posOpen + 1);
- tszRes.Delete(posClose - posOpen2 + posOpen - 1, lenClose);
+ wszRes.Delete(posOpen, posOpen2 - posOpen + 1);
+ wszRes.Delete(posClose - posOpen2 + posOpen - 1, lenClose);
}
}
- return tszRes;
+ return wszRes;
}
void CVkProto::ShowCaptchaInBrowser(HBITMAP hBitmap)
{
- wchar_t tszTempDir[MAX_PATH];
- if (!GetEnvironmentVariable(L"TEMP", tszTempDir, MAX_PATH))
+ wchar_t wszTempDir[MAX_PATH];
+ if (!GetEnvironmentVariable(L"TEMP", wszTempDir, MAX_PATH))
return;
- CMString tszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", tszTempDir);
+ CMString wszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", wszTempDir);
- FILE *pFile = _wfopen(tszHTMLPath, L"w");
+ FILE *pFile = _wfopen(wszHTMLPath, L"w");
if (pFile == NULL)
return;
@@ -1417,6 +1417,6 @@ void CVkProto::ShowCaptchaInBrowser(HBITMAP hBitmap) fwrite(szHTML, 1, szHTML.GetLength(), pFile);
fclose(pFile);
- tszHTMLPath = L"file://" + tszHTMLPath;
- Utils_OpenUrlT(tszHTMLPath);
+ wszHTMLPath = L"file://" + wszHTMLPath;
+ Utils_OpenUrlT(wszHTMLPath);
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 008541791c..01951832cf 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -97,12 +97,12 @@ extern mir_cs csInstances; extern HINSTANCE hInst;
LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField);
-bool tlstrstr(wchar_t *_s1, wchar_t *_s2);
+bool wlstrstr(wchar_t *_s1, wchar_t *_s2);
void InitIcons(void);
HANDLE GetIconHandle(int iCommand);
char* ExpUrlEncode(const char *szUrl, bool strict = false);
-bool IsEmpty(LPCTSTR str);
+bool IsEmpty(LPCWSTR str);
bool IsEmpty(LPCSTR str);
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 7401f2a386..61a05f3002 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -85,9 +85,9 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) if (szUrl == NULL)
return GAIR_NOAVATAR;
- wchar_t tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
- wcsncpy(pai->filename, tszFileName, _countof(pai->filename));
+ wchar_t wszFileName[MAX_PATH];
+ GetAvatarFileName(pai->hContact, wszFileName, _countof(wszFileName));
+ wcsncpy(pai->filename, wszFileName, _countof(pai->filename));
pai->format = ProtoGetAvatarFormat(pai->filename);
@@ -128,41 +128,41 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) return 0;
}
-void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen)
+void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen)
{
- int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
- DWORD dwAttributes = GetFileAttributes(pszDest);
+ DWORD dwAttributes = GetFileAttributes(pwszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeT(pszDest);
+ CreateDirectoryTreeW(pwszDest);
- pszDest[tPathLen++] = '\\';
+ pwszDest[tPathLen++] = '\\';
const wchar_t *szFileType = L".jpg";
- ptrW szUrl(getTStringA(hContact, "AvatarUrl"));
- if (szUrl) {
- wchar_t *p = wcsrchr(szUrl, '.');
+ ptrW wszUrl(getWStringA(hContact, "AvatarUrl"));
+ if (wszUrl) {
+ wchar_t *p = wcsrchr(wszUrl, '.');
if (p != NULL)
szFileType = p;
}
LONG id = getDword(hContact, "ID", -1);
- mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
+ mir_snwprintf(pwszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
}
-void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
+void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &wszUrl)
{
- CMString oldUrl(getTStringA(hContact, "AvatarUrl"));
+ CMString oldUrl(getWStringA(hContact, "AvatarUrl"));
- if (tszUrl == oldUrl)
+ if (wszUrl == oldUrl)
return;
- if (tszUrl.IsEmpty()) {
+ if (wszUrl.IsEmpty()) {
delSetting(hContact, "AvatarUrl");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL);
}
else {
- setTString(hContact, "AvatarUrl", tszUrl);
+ setWString(hContact, "AvatarUrl", wszUrl);
setByte(hContact,"NeedNewAvatar", 1);
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 33add5f629..b165fdf5d3 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -24,7 +24,7 @@ enum IDM_KICK, IDM_INFO, IDM_CHANGENICK, IDM_VISIT_PROFILE
};
-static LPCTSTR sttStatuses[] = { LPGENW("Participants"), LPGENW("Owners") };
+static LPCWSTR sttStatuses[] = { LPGENW("Participants"), LPGENW("Owners") };
extern JSONNode nullNode;
@@ -42,21 +42,21 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) if (c != NULL)
return c;
- CMString tszTitle;
+ CMString wszTitle;
c = new CVkChatInfo(id);
if (jnDlg) {
- tszTitle = jnDlg["title"].as_mstring();
- c->m_tszTopic = mir_wstrdup(!tszTitle.IsEmpty() ? tszTitle : L"");
+ wszTitle = jnDlg["title"].as_mstring();
+ c->m_wszTopic = mir_wstrdup(!wszTitle.IsEmpty() ? wszTitle : L"");
}
CMString sid;
sid.Format(L"%S_%d", m_szModuleName, id);
- c->m_tszId = mir_wstrdup(sid);
+ c->m_wszId = mir_wstrdup(sid);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
- gcw.ptszName = tszTitle;
+ gcw.ptszName = wszTitle;
gcw.ptszID = sid;
CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw);
@@ -67,7 +67,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci);
c->m_hContact = gci.hContact;
- setTString(gci.hContact, "Nick", tszTitle);
+ setWString(gci.hContact, "Nick", wszTitle);
m_chats.insert(c);
GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP };
@@ -79,8 +79,8 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) setDword(gci.hContact, "vk_chat_id", id);
- CMString tszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id);
- setTString(gci.hContact, "Homepage", tszHomepage);
+ CMString wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id);
+ setWString(gci.hContact, "Homepage", wszHomepage);
db_unset(gci.hContact, m_szModuleName, "off");
@@ -103,12 +103,12 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) void CVkProto::RetrieveChatInfo(CVkChatInfo *cc)
{
- CMStringA tszQuery(FORMAT, "var ChatId=%d;", cc->m_chatid);
- tszQuery += "var Info=API.messages.getChat({\"chat_id\":ChatId});"
+ CMStringA wszQuery(FORMAT, "var ChatId=%d;", cc->m_chatid);
+ wszQuery += "var Info=API.messages.getChat({\"chat_id\":ChatId});"
"var ChatUsers=API.messages.getChatUsers({\"chat_id\":ChatId,\"fields\":\"id,first_name,last_name\"});";
if (!cc->m_bHistoryRead) {
- tszQuery += "var ChatMsg=API.messages.getHistory({\"chat_id\":ChatId,\"count\":20,\"rev\":0});var UR=parseInt(ChatMsg.unread);"
+ wszQuery += "var ChatMsg=API.messages.getHistory({\"chat_id\":ChatId,\"count\":20,\"rev\":0});var UR=parseInt(ChatMsg.unread);"
"if(UR>20){if(UR>200)UR=200;ChatMsg=API.messages.getHistory({\"chat_id\":ChatId,\"count\":UR,\"rev\":0});};"
"var FMsgs = ChatMsg.items@.fwd_messages;var Idx = 0;var Uids =[];while (Idx < FMsgs.length){"
"var Jdx = 0;var CFMsgs = parseInt(FMsgs[Idx].length);while (Jdx < CFMsgs){"
@@ -117,18 +117,18 @@ void CVkProto::RetrieveChatInfo(CVkChatInfo *cc) "var MsgUsers=API.users.get({\"user_ids\":ChatMsg.items@.user_id,\"fields\":\"id,first_name,last_name\"});";
}
- tszQuery += "return {\"info\":Info,\"users\":ChatUsers";
+ wszQuery += "return {\"info\":Info,\"users\":ChatUsers";
if (!cc->m_bHistoryRead)
- tszQuery += ",\"msgs\":ChatMsg,\"fwd_users\":FUsers,\"msgs_users\":MsgUsers";
+ wszQuery += ",\"msgs\":ChatMsg,\"fwd_users\":FUsers,\"msgs_users\":MsgUsers";
- tszQuery +="};";
+ wszQuery +="};";
debugLogA("CVkProto::RetrieveChantInfo(%d)", cc->m_chatid);
if (!IsOnline())
return;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveChatInfo)
- << CHAR_PARAM("code", tszQuery))->pUserInfo = cc;
+ << CHAR_PARAM("code", wszQuery))->pUserInfo = cc;
}
void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
@@ -170,8 +170,8 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe break;
int uid = jnUser["id"].as_int();
- wchar_t tszId[20];
- _itow(uid, tszId, 10);
+ wchar_t wszId[20];
+ _itow(uid, wszId, 10);
bool bNew;
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
@@ -183,21 +183,21 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe bNew = cu->m_bUnknown;
cu->m_bDel = false;
- CMString tszNick(ptrW(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
- if (tszNick.IsEmpty()) {
+ CMString 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());
- tszNick = fName.Trim() + L" " + lName.Trim();
+ wszNick = fName.Trim() + L" " + lName.Trim();
}
- cu->m_tszNick = mir_wstrdup(tszNick);
+ cu->m_wszNick = mir_wstrdup(wszNick);
cu->m_bUnknown = false;
if (bNew) {
- GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_JOIN };
+ GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
gce.bIsMe = uid == m_myUserId;
- gce.ptszUID = tszId;
- gce.ptszNick = tszNick;
+ gce.ptszUID = wszId;
+ gce.ptszNick = wszNick;
gce.ptszStatus = TranslateTS(sttStatuses[uid == cc->m_admin_id]);
gce.dwItemData = (INT_PTR)cu;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -209,15 +209,15 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (!cu.m_bDel)
continue;
- wchar_t tszId[20];
- _itow(cu.m_uid, tszId, 10);
+ wchar_t wszId[20];
+ _itow(cu.m_uid, wszId, 10);
- GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_PART };
+ GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_PART };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
- gce.ptszUID = tszId;
+ 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_tszNick, tszId));
+ gce.ptszNick = mir_wstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
cc->m_users.remove(i);
@@ -261,26 +261,26 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe for (int j = 0; j < cc->m_msgs.getCount(); j++) {
CVkChatMessage &p = cc->m_msgs[j];
- AppendChatMessage(cc, p.m_uid, p.m_date, p.m_tszBody, p.m_bHistory, p.m_bIsAction);
+ AppendChatMessage(cc, p.m_uid, p.m_date, p.m_wszBody, p.m_bHistory, p.m_bIsAction);
}
cc->m_msgs.destroy();
}
-void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCTSTR tszTopic)
+void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCWSTR wszTopic)
{
debugLog(L"CVkProto::SetChatTitle");
if (!cc)
return;
- if (mir_wstrcmp(cc->m_tszTopic, tszTopic) == 0)
+ if (mir_wstrcmp(cc->m_wszTopic, wszTopic) == 0)
return;
- cc->m_tszTopic = mir_wstrdup(tszTopic);
- setTString(cc->m_hContact, "Nick", tszTopic);
+ cc->m_wszTopic = mir_wstrdup(wszTopic);
+ setWString(cc->m_hContact, "Nick", wszTopic);
- GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_CHANGESESSIONAME };
+ GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
- gce.ptszText = tszTopic;
+ gce.ptszText = wszTopic;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
}
@@ -302,102 +302,102 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (!msgTime || msgTime > now)
msgTime = now;
- CMString tszBody(jnMsg["body"].as_mstring());
+ CMString wszBody(jnMsg["body"].as_mstring());
const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, bbcNo);
- if (!tszBody.IsEmpty())
- tszFwdMessages = L"\n" + tszFwdMessages;
- tszBody += tszFwdMessages;
+ CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, bbcNo);
+ if (!wszBody.IsEmpty())
+ wszFwdMessages = L"\n" + wszFwdMessages;
+ wszBody += wszFwdMessages;
}
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo);
- if (!tszBody.IsEmpty())
- tszAttachmentDescr = L"\n" + tszAttachmentDescr;
- tszBody += tszAttachmentDescr;
+ CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo);
+ if (!wszBody.IsEmpty())
+ wszAttachmentDescr = L"\n" + wszAttachmentDescr;
+ wszBody += wszAttachmentDescr;
}
if (jnMsg["action"]) {
bIsAction = true;
- CMString tszAction = jnMsg["action"].as_mstring();
+ CMString wszAction = jnMsg["action"].as_mstring();
- if (tszAction == L"chat_create") {
- CMString tszActionText = jnMsg["action_text"].as_mstring();
- tszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), tszActionText.IsEmpty() ? L" " : tszActionText);
+ if (wszAction == L"chat_create") {
+ CMString wszActionText = jnMsg["action_text"].as_mstring();
+ wszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), wszActionText.IsEmpty() ? L" " : wszActionText);
}
- else if (tszAction == L"chat_kick_user") {
- CMString tszActionMid = jnMsg["action_mid"].as_mstring();
- if (tszActionMid.IsEmpty())
- tszBody = TranslateT("kick user");
+ else if (wszAction == L"chat_kick_user") {
+ CMString wszActionMid = jnMsg["action_mid"].as_mstring();
+ if (wszActionMid.IsEmpty())
+ wszBody = TranslateT("kick user");
else {
- CMString tszUid(FORMAT, L"%d", uid);
- if (tszUid == tszActionMid) {
+ CMString wszUid(FORMAT, L"%d", uid);
+ if (wszUid == wszActionMid) {
if (cc->m_bHistoryRead)
return;
- tszBody.AppendFormat(L" (https://vk.com/id%s) %s", tszUid, TranslateT("left chat"));
+ wszBody.AppendFormat(L" (https://vk.com/id%s) %s", wszUid, TranslateT("left chat"));
}
else {
int a_uid = 0;
- int iReadCount = swscanf(tszActionMid, L"%d", &a_uid);
+ int iReadCount = swscanf(wszActionMid, L"%d", &a_uid);
if (iReadCount == 1) {
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid);
if (cu == NULL)
- tszBody.AppendFormat(L"%s (https://vk.com/id%d)", TranslateT("kick user"), a_uid);
+ wszBody.AppendFormat(L"%s (https://vk.com/id%d)", TranslateT("kick user"), a_uid);
else
- tszBody.AppendFormat(L"%s %s (https://vk.com/id%d)", TranslateT("kick user"), cu->m_tszNick, a_uid);
+ wszBody.AppendFormat(L"%s %s (https://vk.com/id%d)", TranslateT("kick user"), cu->m_wszNick, a_uid);
}
else
- tszBody = TranslateT("kick user");
+ wszBody = TranslateT("kick user");
}
}
}
- else if (tszAction == L"chat_invite_user") {
- CMString tszActionMid = jnMsg["action_mid"].as_mstring();
- if (tszActionMid.IsEmpty())
- tszBody = TranslateT("invite user");
+ else if (wszAction == L"chat_invite_user") {
+ CMString wszActionMid = jnMsg["action_mid"].as_mstring();
+ if (wszActionMid.IsEmpty())
+ wszBody = TranslateT("invite user");
else {
- CMString tszUid(FORMAT, L"%d", uid);
- if (tszUid == tszActionMid)
- tszBody.AppendFormat(L" (https://vk.com/id%s) %s", tszUid, TranslateT("returned to chat"));
+ CMString wszUid(FORMAT, L"%d", uid);
+ if (wszUid == wszActionMid)
+ wszBody.AppendFormat(L" (https://vk.com/id%s) %s", wszUid, TranslateT("returned to chat"));
else {
int a_uid = 0;
- int iReadCount = swscanf(tszActionMid, L"%d", &a_uid);
+ int iReadCount = swscanf(wszActionMid, L"%d", &a_uid);
if (iReadCount == 1) {
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid);
if (cu == NULL)
- tszBody.AppendFormat(L"%s (https://vk.com/id%d)", TranslateT("invite user"), a_uid);
+ wszBody.AppendFormat(L"%s (https://vk.com/id%d)", TranslateT("invite user"), a_uid);
else
- tszBody.AppendFormat(L"%s %s (https://vk.com/id%d)", TranslateT("invite user"), cu->m_tszNick, a_uid);
+ wszBody.AppendFormat(L"%s %s (https://vk.com/id%d)", TranslateT("invite user"), cu->m_wszNick, a_uid);
}
else
- tszBody = TranslateT("invite user");
+ wszBody = TranslateT("invite user");
}
}
}
- else if (tszAction == L"chat_title_update") {
- CMString tszTitle = jnMsg["action_text"].as_mstring();
- tszBody.AppendFormat(L"%s \"%s\"", TranslateT("change chat title to"), tszTitle.IsEmpty() ? L" " : tszTitle);
+ else if (wszAction == L"chat_title_update") {
+ CMString wszTitle = jnMsg["action_text"].as_mstring();
+ wszBody.AppendFormat(L"%s \"%s\"", TranslateT("change chat title to"), wszTitle.IsEmpty() ? L" " : wszTitle);
if (!bIsHistory)
- SetChatTitle(cc, tszTitle);
+ SetChatTitle(cc, wszTitle);
}
- else if (tszAction == L"chat_photo_update")
- tszBody.Replace(TranslateT("Attachments:"), TranslateT("changed chat cover:"));
- else if (tszAction == L"chat_photo_remove")
- tszBody = TranslateT("deleted chat cover");
+ else if (wszAction == L"chat_photo_update")
+ wszBody.Replace(TranslateT("Attachments:"), TranslateT("changed chat cover:"));
+ else if (wszAction == L"chat_photo_remove")
+ wszBody = TranslateT("deleted chat cover");
else
- tszBody.AppendFormat(L": %s (%s)", TranslateT("chat action not supported"), tszAction);
+ wszBody.AppendFormat(L": %s (%s)", TranslateT("chat action not supported"), wszAction);
}
- tszBody.Replace(L"%", L"%%");
+ wszBody.Replace(L"%", L"%%");
if (cc->m_bHistoryRead) {
if (jnMsg["title"])
SetChatTitle(cc, jnMsg["title"].as_mstring());
- AppendChatMessage(cc, uid, msgTime, tszBody, bIsHistory, bIsAction);
+ AppendChatMessage(cc, uid, msgTime, wszBody, bIsHistory, bIsAction);
}
else {
CVkChatMessage *cm = cc->m_msgs.find((CVkChatMessage *)&mid);
@@ -406,45 +406,45 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & cm->m_uid = uid;
cm->m_date = msgTime;
- cm->m_tszBody = mir_wstrdup(tszBody);
+ cm->m_wszBody = mir_wstrdup(wszBody);
cm->m_bHistory = bIsHistory;
cm->m_bIsAction = bIsAction;
}
}
-void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR ptszBody, bool bIsHistory, bool bIsAction)
+void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR pwszBody, bool bIsHistory, bool bIsAction)
{
debugLogA("CVkProto::AppendChatMessage2");
MCONTACT hContact = FindUser(uid);
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
if (cu == NULL) {
cc->m_users.insert(cu = new CVkChatUser(uid));
- CMString tszNick(ptrW(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
- cu->m_tszNick = mir_wstrdup(tszNick.IsEmpty() ? (hContact ? ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : tszNick);
+ CMString 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;
}
- wchar_t tszId[20];
- _itow(uid, tszId, 10);
+ wchar_t wszId[20];
+ _itow(uid, wszId, 10);
- GCDEST gcd = { m_szModuleName, cc->m_tszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
+ GCDEST gcd = { m_szModuleName, cc->m_wszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
gce.bIsMe = (uid == m_myUserId);
- gce.ptszUID = tszId;
+ gce.ptszUID = wszId;
gce.time = msgTime;
gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG;
- gce.ptszNick = cu->m_tszNick ? mir_wstrdup(cu->m_tszNick) : mir_wstrdup(hContact ? ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
- gce.ptszText = IsEmpty((wchar_t *)ptszBody) ? mir_wstrdup(L"...") : mir_wstrdup(ptszBody);
+ gce.ptszNick = cu->m_wszNick ? mir_wstrdup(cu->m_wszNick) : mir_wstrdup(hContact ? ptrW(db_get_wsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
+ gce.ptszText = IsEmpty((wchar_t *)pwszBody) ? mir_wstrdup(L"...") : mir_wstrdup(pwszBody);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
StopChatContactTyping(cc->m_chatid, uid);
}
/////////////////////////////////////////////////////////////////////////////////////////
-CVkChatInfo* CVkProto::GetChatById(LPCTSTR ptszId)
+CVkChatInfo* CVkProto::GetChatById(LPCWSTR pwszId)
{
for (int i = 0; i < m_chats.getCount(); i++)
- if (!mir_wstrcmp(m_chats[i].m_tszId, ptszId))
+ if (!mir_wstrcmp(m_chats[i].m_wszId, pwszId))
return &m_chats[i];
return NULL;
@@ -454,15 +454,15 @@ CVkChatInfo* CVkProto::GetChatById(LPCTSTR ptszId) void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
- ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
- if (tszChatID == NULL)
+ ptrW wszChatID(getWStringA(hContact, "ChatRoomID"));
+ if (wszChatID == NULL)
return;
- CVkChatInfo *cc = GetChatById(tszChatID);
+ CVkChatInfo *cc = GetChatById(wszChatID);
if (cc == NULL)
return;
- GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL };
+ GCDEST gcd = { m_szModuleName, wszChatID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
CallServiceSync(MS_GC_EVENT, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, (LPARAM)&gce);
}
@@ -497,10 +497,10 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
if (IsOnline() && mir_wstrlen(gch->ptszText) > 0) {
- ptrW ptszBuf(mir_wstrdup(gch->ptszText));
- rtrimw(ptszBuf);
- UnEscapeChatTags(ptszBuf);
- SendMsg(cc->m_hContact, 0, T2Utf(ptszBuf));
+ ptrW pwszBuf(mir_wstrdup(gch->ptszText));
+ rtrimw(pwszBuf);
+ UnEscapeChatTags(pwszBuf);
+ SendMsg(cc->m_hContact, 0, T2Utf(pwszBuf));
}
break;
@@ -556,7 +556,7 @@ LPTSTR CVkProto::ChangeChatTopic(CVkChatInfo *cc) ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_MULTILINE;
pForm.caption = TranslateT("Enter new chat title");
- pForm.ptszInitVal = cc->m_tszTopic;
+ pForm.ptszInitVal = cc->m_wszTopic;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "gctopic_";
return (!EnterString(&pForm)) ? NULL : pForm.ptszResult;
@@ -569,11 +569,11 @@ void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch) switch (gch->dwData) {
case IDM_TOPIC:
- if (LPTSTR ptszNew = ChangeChatTopic(cc)) {
+ if (LPTSTR pwszNew = ChangeChatTopic(cc)) {
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.editChat.json", true, &CVkProto::OnReceiveSmth)
- << TCHAR_PARAM("title", ptszNew)
+ << WCHAR_PARAM("title", pwszNew)
<< INT_PARAM("chat_id", cc->m_chatid));
- mir_free(ptszNew);
+ mir_free(pwszNew);
}
break;
@@ -628,7 +628,7 @@ INT_PTR __cdecl CVkProto::OnJoinChat(WPARAM hContact, LPARAM) AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg, AsyncHttpRequest::rpHigh)
<< INT_PARAM("chat_id", chat_id)
- << TCHAR_PARAM("message", m_vkOptions.ptszReturnChatMessage);
+ << WCHAR_PARAM("message", m_vkOptions.pwszReturnChatMessage);
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
Push(pReq);
db_unset(hContact, m_szModuleName, "off");
@@ -641,11 +641,11 @@ INT_PTR __cdecl CVkProto::OnLeaveChat(WPARAM hContact, LPARAM) if (!IsOnline())
return 1;
- ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
- if (tszChatID == NULL)
+ ptrW wszChatID(getWStringA(hContact, "ChatRoomID"));
+ if (wszChatID == NULL)
return 1;
- CVkChatInfo *cc = GetChatById(tszChatID);
+ CVkChatInfo *cc = GetChatById(wszChatID);
if (cc == NULL)
return 1;
@@ -663,7 +663,7 @@ void CVkProto::LeaveChat(int chat_id, bool close_window, bool delete_chat) if (cc == NULL)
return;
- GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_QUIT };
+ GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_QUIT };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
gcd.iType = GC_EVENT_CONTROL;
@@ -695,7 +695,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con if (msg.IsEmpty()) {
msg = TranslateT("You've been kicked by ");
if (hContact != NULL)
- msg += ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ msg += ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"));
else
msg += TranslateT("(Unknown contact)");
}
@@ -789,26 +789,26 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) case IDM_CHANGENICK:
{
- CMString tszNewNick = RunRenameNick(cu->m_tszNick);
- if (tszNewNick.IsEmpty() || tszNewNick == cu->m_tszNick)
+ CMString wszNewNick = RunRenameNick(cu->m_wszNick);
+ if (wszNewNick.IsEmpty() || wszNewNick == cu->m_wszNick)
break;
- GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_NICK };
+ GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_NICK };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
- wchar_t tszId[20];
- _itow(cu->m_uid, tszId, 10);
+ wchar_t wszId[20];
+ _itow(cu->m_uid, wszId, 10);
- gce.ptszNick = mir_wstrdup(cu->m_tszNick);
+ gce.ptszNick = mir_wstrdup(cu->m_wszNick);
gce.bIsMe = (cu->m_uid == m_myUserId);
- gce.ptszUID = tszId;
- gce.ptszText = mir_wstrdup(tszNewNick);
+ gce.ptszUID = wszId;
+ gce.ptszText = mir_wstrdup(wszNewNick);
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- cu->m_tszNick = mir_wstrdup(tszNewNick);
- setTString(cc->m_hContact, CMStringA(FORMAT, "nick%d", cu->m_uid), tszNewNick);
+ cu->m_wszNick = mir_wstrdup(wszNewNick);
+ setWString(cc->m_hContact, CMStringA(FORMAT, "nick%d", cu->m_uid), wszNewNick);
}
break;
@@ -901,7 +901,7 @@ void CVkProto::ChatContactTypingThread(void *p) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_tszNick);
+ mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_wszNick);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
@@ -937,7 +937,7 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId) // CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, NULL) clears statusbar very slowly.
// (1-10 sec(!!!) for me on tabSRMM O_o)
- // So I call MS_MSG_SETSTATUSTEXT with st.tszText = " " for cleaning of "... is typing a message..." string.
+ // So I call MS_MSG_SETSTATUSTEXT with st.wszText = " " for cleaning of "... is typing a message..." string.
// It works instantly!
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
@@ -958,12 +958,12 @@ INT_PTR CVkProto::SvcCreateChat(WPARAM, LPARAM) return (INT_PTR)!dlg.DoModal();
}
-void CVkProto::CreateNewChat(LPCSTR uids, LPCTSTR ptszTitle)
+void CVkProto::CreateNewChat(LPCSTR uids, LPCWSTR pwszTitle)
{
if (!IsOnline())
return;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.createChat.json", true, &CVkProto::OnCreateNewChat)
- << TCHAR_PARAM("title", ptszTitle ? ptszTitle : L"")
+ << WCHAR_PARAM("title", pwszTitle ? pwszTitle : L"")
<< CHAR_PARAM("user_ids", uids));
}
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index b043e9c242..889ded760b 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -120,8 +120,8 @@ void CVkWallPostForm::OnInitDialog() {
Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_WALL));
- CMString tszTitle(FORMAT, L"%s %s", TranslateT("Wall message for"), m_param->ptszNick);
- SetCaption(tszTitle);
+ CMString wszTitle(FORMAT, L"%s %s", TranslateT("Wall message for"), m_param->pwszNick);
+ SetCaption(wszTitle);
m_btnShare.Disable();
}
@@ -133,8 +133,8 @@ void CVkWallPostForm::OnDestroy() void CVkWallPostForm::On_btnShare_Click(CCtrlButton*)
{
- m_param->ptszUrl = m_edtUrl.GetText();
- m_param->ptszMsg = m_edtMsg.GetText();
+ m_param->pwszUrl = m_edtUrl.GetText();
+ m_param->pwszMsg = m_edtMsg.GetText();
m_param->bFriendsOnly = m_cbOnlyForFriends.GetState() != 0;
EndDialog(m_hwnd, 1);
@@ -160,8 +160,8 @@ void CVkInviteChatForm::OnInitDialog() {
for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) {
if (!m_proto->isChatRoom(hContact)) {
- wchar_t *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
- m_cbxCombo.AddString(ptszNick, hContact);
+ wchar_t *pwszNick = pcli->pfnGetContactDisplayName(hContact, 0);
+ m_cbxCombo.AddString(pwszNick, hContact);
}
}
}
diff --git a/protocols/VKontakte/src/vk_dialogs.h b/protocols/VKontakte/src/vk_dialogs.h index 32ee12608f..13160e4e41 100644 --- a/protocols/VKontakte/src/vk_dialogs.h +++ b/protocols/VKontakte/src/vk_dialogs.h @@ -52,23 +52,23 @@ public: struct WALLPOST_FORM_PARAMS
{
- wchar_t *ptszMsg;
- wchar_t *ptszUrl;
- wchar_t *ptszNick;
+ wchar_t *pwszMsg;
+ wchar_t *pwszUrl;
+ wchar_t *pwszNick;
bool bFriendsOnly;
WALLPOST_FORM_PARAMS(wchar_t *nick) :
- ptszNick(nick),
+ pwszNick(nick),
bFriendsOnly(false)
{
- ptszMsg = ptszUrl = NULL;
+ pwszMsg = pwszUrl = NULL;
}
~WALLPOST_FORM_PARAMS()
{
- mir_free(ptszMsg);
- mir_free(ptszUrl);
- mir_free(ptszNick);
+ mir_free(pwszMsg);
+ mir_free(pwszUrl);
+ mir_free(pwszNick);
}
};
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 0ab7fdd00d..2d52d12b9c 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -31,13 +31,13 @@ void CVkProto::AddFeedSpecialUser() if (!hContact) {
hContact = FindUser(VK_FEED_USER, true);
- setTString(hContact, "Nick", TranslateT("VKontakte"));
- CMString tszUrl = L"https://vk.com/press/Simple.png";
- SetAvatarUrl(hContact, tszUrl);
+ setWString(hContact, "Nick", TranslateT("VKontakte"));
+ CMString wszUrl = L"https://vk.com/press/Simple.png";
+ SetAvatarUrl(hContact, wszUrl);
ReloadAvatarInfo(hContact);
- setTString(hContact, "domain", L"feed");
- setTString(hContact, "Homepage", L"https://vk.com/feed");
+ setWString(hContact, "domain", L"feed");
+ setWString(hContact, "Homepage", L"https://vk.com/feed");
}
if (getWord(hContact, "Status") != ID_STATUS_ONLINE)
@@ -48,11 +48,11 @@ void CVkProto::AddFeedSpecialUser() void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem)
{
- if (vkNewsItem.tszText.IsEmpty())
+ if (vkNewsItem.wszText.IsEmpty())
return;
MCONTACT hContact = FindUser(VK_FEED_USER, true);
- T2Utf pszBody(vkNewsItem.tszText);
+ T2Utf pszBody(vkNewsItem.wszText);
PROTORECVEVENT recv = { 0 };
recv.timestamp = vkNewsItem.tDate;
@@ -63,7 +63,7 @@ void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem) if (m_vkOptions.bUseNonStandardNotifications) {
recv.flags = PREF_CREATEREAD;
- MsgPopup(hContact, vkNewsItem.tszPopupText, vkNewsItem.tszPopupTitle);
+ MsgPopup(hContact, vkNewsItem.wszPopupText, vkNewsItem.wszPopupTitle);
}
ProtoChainRecvMsg(hContact, &recv);
@@ -102,13 +102,13 @@ CVkUserInfo* CVkProto::GetVkUserInfo(LONG iUserId, OBJLIST<CVkUserInfo> &vkUsers CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&iUserId);
if (vkUser == NULL) {
- CMString tszNick = TranslateT("Unknown");
- CMString tszLink(L"https://vk.com/");
+ CMString wszNick = TranslateT("Unknown");
+ CMString wszLink(L"https://vk.com/");
if (iUserId) {
- tszLink += bIsGroup ? "club" : "id";
- tszLink.AppendFormat(L"%d", bIsGroup ? -iUserId : iUserId);
+ wszLink += bIsGroup ? "club" : "id";
+ wszLink.AppendFormat(L"%d", bIsGroup ? -iUserId : iUserId);
}
- vkUser = new CVkUserInfo(iUserId, bIsGroup, tszNick, tszLink, bIsGroup ? NULL : FindUser(iUserId));
+ vkUser = new CVkUserInfo(iUserId, bIsGroup, wszNick, wszLink, bIsGroup ? NULL : FindUser(iUserId));
vkUsers.insert(vkUser);
}
@@ -130,15 +130,15 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod continue;
LONG UserId = jnProfile["id"].as_int();
- CMString tszNick(jnProfile["first_name"].as_mstring());
- tszNick.AppendChar(' ');
- tszNick += jnProfile["last_name"].as_mstring();
- CMString tszLink = L"https://vk.com/";
- CMString tszScreenName(jnProfile["screen_name"].as_mstring());
- if (tszScreenName.IsEmpty())
- tszScreenName.AppendFormat(L"id%d", UserId);
- tszLink += tszScreenName;
- CVkUserInfo *vkUser = new CVkUserInfo(UserId, false, tszNick, tszLink, FindUser(UserId));
+ CMString 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());
+ if (wszScreenName.IsEmpty())
+ wszScreenName.AppendFormat(L"id%d", UserId);
+ wszLink += wszScreenName;
+ CVkUserInfo *vkUser = new CVkUserInfo(UserId, false, wszNick, wszLink, FindUser(UserId));
vkUsers.insert(vkUser);
}
@@ -150,10 +150,10 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod continue;
LONG UserId = - jnProfile["id"].as_int();
- CMString tszNick(jnProfile["name"].as_mstring());
- CMString tszLink = L"https://vk.com/";
- tszLink += jnProfile["screen_name"].as_mstring();
- CVkUserInfo *vkUser = new CVkUserInfo(UserId, true, tszNick, tszLink);
+ CMString wszNick(jnProfile["name"].as_mstring());
+ CMString wszLink = L"https://vk.com/";
+ wszLink += jnProfile["screen_name"].as_mstring();
+ CVkUserInfo *vkUser = new CVkUserInfo(UserId, true, wszNick, wszLink);
vkUsers.insert(vkUser);
}
}
@@ -169,44 +169,44 @@ 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 tszText(jnItem["text"].as_mstring());
- CMString tszPopupText(tszText);
+ CMString wszText(jnItem["text"].as_mstring());
+ CMString wszPopupText(wszText);
- vkNewsItem->tszType = jnItem["type"].as_mstring();
+ vkNewsItem->wszType = jnItem["type"].as_mstring();
vkNewsItem->vkUser = GetVkUserInfo(iSourceId, vkUsers);
vkNewsItem->bIsGroup = vkNewsItem->vkUser->m_bIsGroup;
vkNewsItem->tDate = jnItem["date"].as_int();
- if (!tszText.IsEmpty())
- tszText += L"\n";
+ if (!wszText.IsEmpty())
+ wszText += L"\n";
- debugLog(L"CVkProto::GetVkNewsItem %d %d %s", iSourceId, iPostId, vkNewsItem->tszType);
+ debugLog(L"CVkProto::GetVkNewsItem %d %d %s", iSourceId, iPostId, vkNewsItem->wszType);
- if (vkNewsItem->tszType == L"photo_tag") {
+ if (vkNewsItem->wszType == L"photo_tag") {
bPostLink = false;
const JSONNode &jnPhotos = jnItem["photo_tags"];
if (jnPhotos) {
const JSONNode &jnPhotoItems = jnPhotos["items"];
if (jnPhotoItems) {
- tszText = TranslateT("User was tagged in these photos:");
- tszPopupText = tszText + TranslateT("(photos)");
+ wszText = TranslateT("User was tagged in these photos:");
+ wszPopupText = wszText + TranslateT("(photos)");
for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it)
- tszText += L"\n" + GetVkPhotoItem((*it), m_vkOptions.BBCForNews());
+ wszText += L"\n" + GetVkPhotoItem((*it), m_vkOptions.BBCForNews());
}
}
}
- else if (vkNewsItem->tszType == L"photo" || vkNewsItem->tszType == L"wall_photo") {
+ else if (vkNewsItem->wszType == L"photo" || vkNewsItem->wszType == L"wall_photo") {
bPostLink = false;
const JSONNode &jnPhotos = jnItem["photos"];
int i = 0;
if (jnPhotos) {
const JSONNode &jnPhotoItems = jnPhotos["items"];
if (jnPhotoItems) {
- tszPopupText += TranslateT("(photos)");
+ wszPopupText += TranslateT("(photos)");
for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it) {
const JSONNode &jnPhotoItem = (*it);
- tszText += GetVkPhotoItem(jnPhotoItem, m_vkOptions.BBCForNews()) + L"\n";
- if (i == 0 && vkNewsItem->tszType == L"wall_photo") {
+ wszText += GetVkPhotoItem(jnPhotoItem, m_vkOptions.BBCForNews()) + L"\n";
+ if (i == 0 && vkNewsItem->wszType == L"wall_photo") {
if (jnPhotoItem["post_id"]) {
bPostLink = true;
iPostId = jnPhotoItem["post_id"].as_int();
@@ -218,60 +218,60 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo }
}
}
- else if (vkNewsItem->tszType == L"post" || vkNewsItem->tszType.IsEmpty()) {
+ else if (vkNewsItem->wszType == L"post" || vkNewsItem->wszType.IsEmpty()) {
bPostLink = true;
const JSONNode &jnRepost = jnItem["copy_history"];
if (jnRepost) {
CVKNewsItem *vkRepost = GetVkNewsItem((*jnRepost.begin()), vkUsers, true);
- vkRepost->tszText.Replace(L"\n", L"\n\t");
- tszText += vkRepost->tszText;
- tszText += L"\n";
-
- tszPopupText += L"\t";
- tszPopupText += vkRepost->tszPopupTitle;
- tszPopupText += L"\n\t";
- tszPopupText += vkRepost->tszPopupText;
+ vkRepost->wszText.Replace(L"\n", L"\n\t");
+ wszText += vkRepost->wszText;
+ wszText += L"\n";
+
+ wszPopupText += L"\t";
+ wszPopupText += vkRepost->wszPopupTitle;
+ wszPopupText += L"\n\t";
+ wszPopupText += vkRepost->wszPopupText;
vkNewsItem->bIsRepost = true;
delete vkRepost;
}
const JSONNode &jnAttachments = jnItem["attachments"];
if (jnAttachments) {
- if (!tszText.IsEmpty())
- tszText.AppendChar('\n');
- if (!tszPopupText.IsEmpty())
- tszPopupText.AppendChar('\n');
- tszPopupText += TranslateT("(attachments)");
- tszText += GetAttachmentDescr(jnAttachments, m_vkOptions.bUseBBCOnAttacmentsAsNews ? m_vkOptions.BBCForNews() : m_vkOptions.BBCForAttachments());
+ if (!wszText.IsEmpty())
+ wszText.AppendChar('\n');
+ if (!wszPopupText.IsEmpty())
+ wszPopupText.AppendChar('\n');
+ wszPopupText += TranslateT("(attachments)");
+ wszText += GetAttachmentDescr(jnAttachments, m_vkOptions.bUseBBCOnAttacmentsAsNews ? m_vkOptions.BBCForNews() : m_vkOptions.BBCForAttachments());
}
}
- CMString tszResFormat, tszTitleFormat;
+ CMString wszResFormat, wszTitleFormat;
if (!isRepost) {
- tszResFormat = Translate("News from %s\n%s");
- tszTitleFormat = Translate("News from %s");
+ wszResFormat = Translate("News from %s\n%s");
+ wszTitleFormat = Translate("News from %s");
}
else {
- tszResFormat = Translate("\tRepost from %s\n%s");
- tszTitleFormat = Translate("Repost from %s");
+ wszResFormat = Translate("\tRepost from %s\n%s");
+ wszTitleFormat = Translate("Repost from %s");
bPostLink = false;
}
- vkNewsItem->tszText.AppendFormat(tszResFormat,
- SetBBCString(vkNewsItem->vkUser->m_tszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl,
- vkNewsItem->vkUser->m_tszLink), tszText);
- vkNewsItem->tszPopupTitle.AppendFormat(tszTitleFormat, vkNewsItem->vkUser->m_tszUserNick);
- vkNewsItem->tszPopupText = tszPopupText;
+ vkNewsItem->wszText.AppendFormat(wszResFormat,
+ SetBBCString(vkNewsItem->vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl,
+ vkNewsItem->vkUser->m_wszLink), wszText);
+ vkNewsItem->wszPopupTitle.AppendFormat(wszTitleFormat, vkNewsItem->vkUser->m_wszUserNick);
+ vkNewsItem->wszPopupText = wszPopupText;
- vkNewsItem->tszId.AppendFormat(L"%d_%d", vkNewsItem->vkUser->m_UserId, iPostId);
+ vkNewsItem->wszId.AppendFormat(L"%d_%d", vkNewsItem->vkUser->m_UserId, iPostId);
if (bPostLink) {
- vkNewsItem->tszLink = CMString(L"https://vk.com/wall") + vkNewsItem->tszId;
- vkNewsItem->tszText.AppendChar('\n');
- vkNewsItem->tszText += SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNewsItem->tszLink);
+ vkNewsItem->wszLink = CMString(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->tszText);
+ debugLog(L"CVkProto::GetVkNewsItem %d %d <\n%s\n>", iSourceId, iPostId, vkNewsItem->wszText);
return vkNewsItem;
}
@@ -281,172 +281,172 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser)
{
debugLogA("CVkProto::GetVkFeedback");
- CMString tszRes;
+ CMString wszRes;
if (!jnFeedback || !vkFeedbackType)
- return tszRes;
+ return wszRes;
- CMString tszFormat;
+ CMString wszFormat;
LONG iUserId = 0;
if (vkFeedbackType == vkComment) {
iUserId = jnFeedback["from_id"].as_int();
- tszFormat = L"%s %%s %%s\n%s";
+ wszFormat = L"%s %%s %%s\n%s";
}
else if (vkFeedbackType == vkPost) {
iUserId = jnFeedback["owner_id"].as_int();
- tszFormat = L"%s %%s %%s\n%s";
+ wszFormat = L"%s %%s %%s\n%s";
}
else if (vkFeedbackType == VKObjType::vkUsers || vkFeedbackType == vkCopy) {
const JSONNode &jnUsers = jnFeedback["items"];
- CMString tszUsers;
+ CMString wszUsers;
for (auto it = jnUsers.begin(); it != jnUsers.end(); ++it) {
const JSONNode &jnUserItem = (*it);
if (!jnUserItem["from_id"])
continue;
iUserId = jnUserItem["from_id"].as_int();
vkUser = GetVkUserInfo(iUserId, vkUsers);
- if (!tszUsers.IsEmpty())
- tszUsers += L", ";
- tszUsers += SetBBCString(vkUser->m_tszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_tszLink);
+ if (!wszUsers.IsEmpty())
+ wszUsers += L", ";
+ wszUsers += SetBBCString(vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_wszLink);
}
- tszRes.AppendFormat(L"%s %%s %%s", tszUsers);
+ wszRes.AppendFormat(L"%s %%s %%s", wszUsers);
vkUser = NULL;
iUserId = 0;
}
if (iUserId) {
vkUser = GetVkUserInfo(iUserId, vkUsers);
- CMString tszText(jnFeedback["text"].as_mstring());
- tszText.Replace(L"%", L"%%");
- tszRes.AppendFormat(tszFormat, SetBBCString(vkUser->m_tszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_tszLink), ClearFormatNick(tszText));
+ CMString 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));
}
- return tszRes;
+ return wszRes;
}
-CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCTSTR ptszReplyText, LPCTSTR ptszReplyLink)
+CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCWSTR pwszReplyText, LPCWSTR pwszReplyLink)
{
debugLogA("CVkProto::GetVkParent");
- CMString tszRes;
+ CMString wszRes;
if (!jnParent || !vkParentType)
return NULL;
CVKNewsItem *vkNotificationItem = new CVKNewsItem();
if (vkParentType == vkPhoto) {
- CMString tszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews());
+ CMString wszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews());
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
- vkNotificationItem->tszId.AppendFormat(L"%d_%d", iOwnerId, iId);
- vkNotificationItem->tszLink.AppendFormat(L"https://vk.com/photo%s", vkNotificationItem->tszId);
- vkNotificationItem->tszText.AppendFormat(L"\n%s", tszPhoto);
+ vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId);
+ vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/photo%s", vkNotificationItem->wszId);
+ vkNotificationItem->wszText.AppendFormat(L"\n%s", wszPhoto);
- if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(L"\n>> %s", SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
- vkNotificationItem->tszPopupText.AppendFormat(L">> %s", ptszReplyText);
+ if (pwszReplyText) {
+ vkNotificationItem->wszText.AppendFormat(L"\n>> %s", SetBBCString(pwszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
+ vkNotificationItem->wszPopupText.AppendFormat(L">> %s", pwszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(L"\n%s", SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->wszText.AppendFormat(L"\n%s", SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->wszLink));
}
else if (vkParentType == vkVideo) {
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
- CMString tszTitle(jnParent["title"].as_mstring());
- vkNotificationItem->tszId.AppendFormat(L"%d_%d", iOwnerId, iId);
- vkNotificationItem->tszLink.AppendFormat(L"https://vk.com/video%s", vkNotificationItem->tszId);
+ CMString 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 tszText(jnParent["text"].as_mstring());
- ClearFormatNick(tszText);
+ CMString wszText(jnParent["text"].as_mstring());
+ ClearFormatNick(wszText);
- if (!tszText.IsEmpty())
- vkNotificationItem->tszText.AppendFormat(L"\n%s: %s", SetBBCString(TranslateT("Video description:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(tszText, m_vkOptions.BBCForNews(), vkbbcI));
+ if (!wszText.IsEmpty())
+ vkNotificationItem->wszText.AppendFormat(L"\n%s: %s", SetBBCString(TranslateT("Video description:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(wszText, m_vkOptions.BBCForNews(), vkbbcI));
- if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(L"\n>> %s", SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
- vkNotificationItem->tszPopupText.AppendFormat(L">> %s", ptszReplyText);
+ if (pwszReplyText) {
+ vkNotificationItem->wszText.AppendFormat(L"\n>> %s", SetBBCString(pwszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
+ vkNotificationItem->wszPopupText.AppendFormat(L">> %s", pwszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(L"\n%s", SetBBCString(tszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->wszText.AppendFormat(L"\n%s", SetBBCString(wszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->wszLink));
}
else if (vkParentType == vkPost) {
LONG iToId = jnParent["to_id"].as_int();
LONG iId = jnParent["id"].as_int();
- vkNotificationItem->tszId.AppendFormat(L"%d_%d", iToId, iId);
- vkNotificationItem->tszLink.AppendFormat(L"https://vk.com/wall%s%s", vkNotificationItem->tszId, ptszReplyLink ? ptszReplyLink : L"");
+ vkNotificationItem->wszId.AppendFormat(L"%d_%d", iToId, iId);
+ vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/wall%s%s", vkNotificationItem->wszId, pwszReplyLink ? pwszReplyLink : L"");
- CMString tszText(jnParent["text"].as_mstring());
- ClearFormatNick(tszText);
+ CMString wszText(jnParent["text"].as_mstring());
+ ClearFormatNick(wszText);
- if (!tszText.IsEmpty()) {
- vkNotificationItem->tszText.AppendFormat(L"\n%s: %s", SetBBCString(TranslateT("Post text:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(tszText, m_vkOptions.BBCForNews(), vkbbcI));
- vkNotificationItem->tszPopupText.AppendFormat(L"%s: %s", TranslateT("Post text:"), tszText);
+ if (!wszText.IsEmpty()) {
+ vkNotificationItem->wszText.AppendFormat(L"\n%s: %s", SetBBCString(TranslateT("Post text:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(wszText, m_vkOptions.BBCForNews(), vkbbcI));
+ vkNotificationItem->wszPopupText.AppendFormat(L"%s: %s", TranslateT("Post text:"), wszText);
}
- if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(L"\n>> %s", SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
- if (!vkNotificationItem->tszPopupText.IsEmpty())
- vkNotificationItem->tszPopupText += L"\n";
- vkNotificationItem->tszPopupText.AppendFormat(L">> %s", ptszReplyText);
+ if (pwszReplyText) {
+ vkNotificationItem->wszText.AppendFormat(L"\n>> %s", SetBBCString(pwszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
+ if (!vkNotificationItem->wszPopupText.IsEmpty())
+ vkNotificationItem->wszPopupText += L"\n";
+ vkNotificationItem->wszPopupText.AppendFormat(L">> %s", pwszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(L"\n%s", SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->wszText.AppendFormat(L"\n%s", SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->wszLink));
}
else if (vkParentType == vkTopic) {
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
- CMString tszTitle(jnParent["title"].as_mstring());
- vkNotificationItem->tszId.AppendFormat(L"%d_%d", iOwnerId, iId);
- vkNotificationItem->tszLink.AppendFormat(L"https://vk.com/topic%s%s",
- vkNotificationItem->tszId, ptszReplyLink ? ptszReplyLink : L"");
+ CMString 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 tszText(jnParent["text"].as_mstring());
- ClearFormatNick(tszText);
+ CMString wszText(jnParent["text"].as_mstring());
+ ClearFormatNick(wszText);
- if (!tszText.IsEmpty()) {
- vkNotificationItem->tszText.AppendFormat(L"\n%s %s", SetBBCString(TranslateT("Topic text:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(tszText, m_vkOptions.BBCForNews(), vkbbcI));
- vkNotificationItem->tszPopupText.AppendFormat(L"%s %s", TranslateT("Topic text:"), tszText);
+ if (!wszText.IsEmpty()) {
+ vkNotificationItem->wszText.AppendFormat(L"\n%s %s", SetBBCString(TranslateT("Topic text:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(wszText, m_vkOptions.BBCForNews(), vkbbcI));
+ vkNotificationItem->wszPopupText.AppendFormat(L"%s %s", TranslateT("Topic text:"), wszText);
}
- if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(L"\n>> %s", SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
- if (!vkNotificationItem->tszPopupText.IsEmpty())
- vkNotificationItem->tszPopupText += L"\n";
- vkNotificationItem->tszPopupText.AppendFormat(L">> %s", ptszReplyText);
+ if (pwszReplyText) {
+ vkNotificationItem->wszText.AppendFormat(L"\n>> %s", SetBBCString(pwszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
+ if (!vkNotificationItem->wszPopupText.IsEmpty())
+ vkNotificationItem->wszPopupText += L"\n";
+ vkNotificationItem->wszPopupText.AppendFormat(L">> %s", pwszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(L"\n%s", SetBBCString(tszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->wszText.AppendFormat(L"\n%s", SetBBCString(wszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->wszLink));
}
else if (vkParentType == vkComment) {
- CMString tszText(jnParent["text"].as_mstring());
- ClearFormatNick(tszText);
+ CMString wszText(jnParent["text"].as_mstring());
+ ClearFormatNick(wszText);
const JSONNode &jnPhoto = jnParent["photo"];
if (jnPhoto) {
delete vkNotificationItem;
- return GetVkParent(jnPhoto, vkPhoto, tszText);
+ return GetVkParent(jnPhoto, vkPhoto, wszText);
}
const JSONNode &jnVideo = jnParent["video"];
if (jnVideo) {
delete vkNotificationItem;
- return GetVkParent(jnVideo, vkVideo, tszText);
+ return GetVkParent(jnVideo, vkVideo, wszText);
}
LONG iId = jnParent["id"].as_int();
const JSONNode &jnPost = jnParent["post"];
if (jnPost) {
- CMString tszRepl(FORMAT, L"?reply=%d", iId);
+ CMString wszRepl(FORMAT, L"?reply=%d", iId);
delete vkNotificationItem;
- return GetVkParent(jnPost, vkPost, tszText, tszRepl);
+ return GetVkParent(jnPost, vkPost, wszText, wszRepl);
}
const JSONNode &jnTopic = jnParent["topic"];
if (jnTopic) {
- CMString tszRepl(FORMAT, L"?reply=%d", iId);
+ CMString wszRepl(FORMAT, L"?reply=%d", iId);
delete vkNotificationItem;
- return GetVkParent(jnTopic, vkTopic, tszText, tszRepl);
+ return GetVkParent(jnTopic, vkTopic, wszText, wszRepl);
}
}
@@ -459,14 +459,14 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV if (!jnItem)
return NULL;
- CMString tszType(jnItem["type"].as_mstring());
+ CMString wszType(jnItem["type"].as_mstring());
VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
- CMString tszNotificationTranslate = SpanVKNotificationType(tszType, vkFeedbackType, vkParentType);
+ CMString wszNotificationTranslate = SpanVKNotificationType(wszType, vkFeedbackType, vkParentType);
const JSONNode &jnFeedback = jnItem["feedback"];
const JSONNode &jnParent = jnItem["parent"];
- if (m_vkOptions.bNotificationFilterAcceptedFriends && tszType == L"friend_accepted" && jnFeedback && vkFeedbackType == VKObjType::vkUsers) {
+ if (m_vkOptions.bNotificationFilterAcceptedFriends && wszType == L"friend_accepted" && jnFeedback && vkFeedbackType == VKObjType::vkUsers) {
OnFriendAccepted(jnFeedback);
return NULL;
}
@@ -475,28 +475,28 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV return NULL;
CVkUserInfo *vkUser = NULL;
- CMString tszFeedback = GetVkFeedback(jnFeedback, vkFeedbackType, vkUsers, vkUser);
+ CMString wszFeedback = GetVkFeedback(jnFeedback, vkFeedbackType, vkUsers, vkUser);
CVKNewsItem *vkNotification = GetVkParent(jnParent, vkParentType);
if (!vkNotification)
return NULL;
- if (vkNotification && !tszFeedback.IsEmpty()) {
- CMString tszNotificaton;
- tszNotificaton.AppendFormat(tszFeedback, tszNotificationTranslate, vkNotification->tszText);
- vkNotification->tszText = tszNotificaton;
+ if (vkNotification && !wszFeedback.IsEmpty()) {
+ CMString wszNotificaton;
+ wszNotificaton.AppendFormat(wszFeedback, wszNotificationTranslate, vkNotification->wszText);
+ vkNotification->wszText = wszNotificaton;
- tszFeedback = RemoveBBC(tszFeedback);
- int idx = tszFeedback.Find(L" %s %s");
+ wszFeedback = RemoveBBC(wszFeedback);
+ int idx = wszFeedback.Find(L" %s %s");
- vkNotification->tszPopupTitle.AppendFormat(L"%s %s", tszFeedback.Mid(0, idx), tszNotificationTranslate);
- if (tszFeedback.GetLength() > idx + 7) {
- if (!vkNotification->tszPopupText.IsEmpty())
- vkNotification->tszPopupText += L"\n>> ";
- vkNotification->tszPopupText += tszFeedback.Mid(idx + 7, tszFeedback.GetLength() - idx - 7);
+ vkNotification->wszPopupTitle.AppendFormat(L"%s %s", wszFeedback.Mid(0, idx), wszNotificationTranslate);
+ if (wszFeedback.GetLength() > idx + 7) {
+ if (!vkNotification->wszPopupText.IsEmpty())
+ vkNotification->wszPopupText += L"\n>> ";
+ vkNotification->wszPopupText += wszFeedback.Mid(idx + 7, wszFeedback.GetLength() - idx - 7);
}
- vkNotification->tszType = tszType;
+ vkNotification->wszType = wszType;
vkNotification->tDate = jnItem["date"].as_int();
vkNotification->vkFeedbackType = vkFeedbackType;
vkNotification->vkParentType = vkParentType;
@@ -532,41 +532,41 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser if (!jnItem)
return NULL;
- CMString tszType(jnItem["type"].as_mstring());
+ CMString wszType(jnItem["type"].as_mstring());
VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
- CMString tszNotificationTranslate = SpanVKNotificationType(tszType, vkFeedbackType, vkParentType);
+ CMString wszNotificationTranslate = SpanVKNotificationType(wszType, vkFeedbackType, vkParentType);
if (!jnItem["id"])
return NULL;
LONG iGroupId = jnItem["id"].as_int();
- CMString tszId(FORMAT, L"%d,", iGroupId);
- CMString tszIds(ptrW(db_get_tsa(NULL, m_szModuleName, "InviteGroupIds")));
+ CMString wszId(FORMAT, L"%d,", iGroupId);
+ CMString wszIds(ptrW(db_get_wsa(NULL, m_szModuleName, "InviteGroupIds")));
- if (tszIds.Find(tszId, 0) != -1)
+ if (wszIds.Find(wszId, 0) != -1)
return NULL;
LONG iUserId = !jnItem["invited_by"] ? 0 : jnItem["invited_by"].as_int();
CVKNewsItem *vkNotification = new CVKNewsItem();
vkNotification->tDate = time(NULL);
vkNotification->vkUser = GetVkUserInfo(iUserId, vkUsers);
- vkNotification->tszType = tszType;
- vkNotification->tszId = tszId;
+ vkNotification->wszType = wszType;
+ vkNotification->wszId = wszId;
vkNotification->vkFeedbackType = vkFeedbackType;
vkNotification->vkParentType = vkParentType;
- CMString tszGroupName;
- CMString tszGName = jnItem["name"].as_mstring();
- CMString tszGLink(FORMAT, L"https://vk.com/%s", jnItem["screen_name"].as_mstring());
- tszGroupName = SetBBCString(tszGName, m_vkOptions.BBCForNews(), vkbbcUrl, tszGLink);
+ CMString wszGroupName;
+ CMString wszGName = jnItem["name"].as_mstring();
+ CMString wszGLink(FORMAT, L"https://vk.com/%s", jnItem["screen_name"].as_mstring());
+ wszGroupName = SetBBCString(wszGName, m_vkOptions.BBCForNews(), vkbbcUrl, wszGLink);
- CMString tszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_tszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_tszLink : L"https://vk.com/");
+ CMString wszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_wszLink : L"https://vk.com/");
- vkNotification->tszText.AppendFormat(L"%s %s %s", tszUsers, tszNotificationTranslate, tszGroupName);
- vkNotification->tszPopupTitle.AppendFormat(L"%s %s %s", iUserId ? vkNotification->vkUser->m_tszUserNick : TranslateT("Unknown"), tszNotificationTranslate, tszGName);
+ 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);
- tszIds += tszId;
- setTString("InviteGroupIds", tszIds);
+ wszIds += wszId;
+ setWString("InviteGroupIds", wszIds);
return vkNotification;
}
@@ -630,7 +630,7 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) static int sttCompareVKNewsItems(const CVKNewsItem *p1, const CVKNewsItem *p2)
{
- int compareId = p1->tszId.Compare(p2->tszId);
+ int compareId = p1->wszId.Compare(p2->wszId);
LONG compareUserId = p1->vkUser->m_UserId - p2->vkUser->m_UserId;
LONG compareDate = (LONG)p1->tDate - (LONG)p2->tDate;
@@ -639,8 +639,8 @@ static int sttCompareVKNewsItems(const CVKNewsItem *p1, const CVKNewsItem *p2) static int sttCompareVKNotificationItems(const CVKNewsItem *p1, const CVKNewsItem *p2)
{
- int compareType = p1->tszType.Compare(p2->tszType);
- int compareId = p1->tszId.Compare(p2->tszId);
+ int compareType = p1->wszType.Compare(p2->wszType);
+ int compareId = p1->wszId.Compare(p2->wszId);
LONG compareDate = (LONG)p1->tDate - (LONG)p2->tDate;
return compareType ? compareDate : (compareId ? compareDate : 0);
@@ -672,7 +672,7 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p CVKNewsItem *vkNewsFoundItem = vkNews.find(vkNewsItem);
if (vkNewsFoundItem == NULL)
vkNews.insert(vkNewsItem);
- else if (vkNewsFoundItem->tszType == L"wall_photo" && vkNewsItem->tszType == L"post") {
+ else if (vkNewsFoundItem->wszType == L"wall_photo" && vkNewsItem->wszType == L"post") {
vkNews.remove(vkNewsFoundItem);
vkNews.insert(vkNewsItem);
}
@@ -713,7 +713,7 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) m_vkOptions.bNotificationFilterInvites ? L",\"groupinvates\":API.groups.getInvites({\"extended\":1})};" : L"};");
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveUnreadNotifications)
- << TCHAR_PARAM("code", code) );
+ << WCHAR_PARAM("code", code) );
setDword("LastNotificationsReqTime", (DWORD)time(NULL));
}
@@ -724,9 +724,9 @@ bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isComme if (vkNotificationItem->vkParentType == vkNull)
return false;
- if (vkNotificationItem->tszType == L"mention_comments"
- || vkNotificationItem->tszType == L"mention_comment_photo"
- || vkNotificationItem->tszType == L"mention_comment_video") {
+ if (vkNotificationItem->wszType == L"mention_comments"
+ || vkNotificationItem->wszType == L"mention_comment_photo"
+ || vkNotificationItem->wszType == L"mention_comment_video") {
isCommented = true;
return (m_vkOptions.bNotificationFilterMentions != 0);
}
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index bcb06a7a29..af491c5729 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -32,65 +32,65 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode)
{
- CMString tszError;
+ CMString wszError;
switch (ErrorCode) {
case VKERR_OFFLINE:
- tszError = TranslateT("Protocol is offline");
+ wszError = TranslateT("Protocol is offline");
break;
case VKERR_FILE_NOT_EXIST:
- tszError = TranslateT("File does not exist");
+ wszError = TranslateT("File does not exist");
break;
case VKERR_FTYPE_NOT_SUPPORTED:
- tszError = TranslateT("File type not supported");
+ wszError = TranslateT("File type not supported");
break;
case VKERR_ERR_OPEN_FILE:
- tszError = TranslateT("Error open file");
+ wszError = TranslateT("Error open file");
break;
case VKERR_ERR_READ_FILE:
- tszError = TranslateT("Error read file");
+ wszError = TranslateT("Error read file");
break;
case VKERR_FILE_NOT_UPLOADED:
- tszError = TranslateT("File upload error");
+ wszError = TranslateT("File upload error");
break;
case VKERR_INVALID_URL:
- tszError = TranslateT("Upload server returned empty URL");
+ wszError = TranslateT("Upload server returned empty URL");
break;
case VKERR_INVALID_USER:
- tszError = TranslateT("Invalid or unknown recipient user ID");
+ wszError = TranslateT("Invalid or unknown recipient user ID");
break;
case VKERR_INVALID_PARAMETERS:
- tszError = TranslateT("One of the parameters specified was missing or invalid");
+ wszError = TranslateT("One of the parameters specified was missing or invalid");
break;
case VKERR_COULD_NOT_SAVE_FILE:
- tszError = TranslateT("Couldn't save file");
+ wszError = TranslateT("Couldn't save file");
break;
case VKERR_INVALID_ALBUM_ID:
- tszError = TranslateT("Invalid album id");
+ wszError = TranslateT("Invalid album id");
break;
case VKERR_INVALID_SERVER:
- tszError = TranslateT("Invalid server");
+ wszError = TranslateT("Invalid server");
break;
case VKERR_INVALID_HASH:
- tszError = TranslateT("Invalid hash");
+ wszError = TranslateT("Invalid hash");
break;
case VKERR_INVALID_AUDIO:
- tszError = TranslateT("Invalid audio");
+ wszError = TranslateT("Invalid audio");
break;
case VKERR_AUDIO_DEL_COPYRIGHT:
- tszError = TranslateT("The audio file was removed by the copyright holder and cannot be reuploaded");
+ wszError = TranslateT("The audio file was removed by the copyright holder and cannot be reuploaded");
break;
case VKERR_INVALID_FILENAME:
- tszError = TranslateT("Invalid filename");
+ wszError = TranslateT("Invalid filename");
break;
case VKERR_INVALID_FILESIZE:
- tszError = TranslateT("Invalid filesize");
+ wszError = TranslateT("Invalid filesize");
break;
default:
- tszError = TranslateT("Unknown error occurred");
+ 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, tszError);
- MsgPopup(NULL, tszError, TranslateT("File upload error"), true);
+ debugLog(L"CVkProto::SendFileFiled error code = %d (%s)", ErrorCode, wszError);
+ MsgPopup(NULL, wszError, TranslateT("File upload error"), true);
delete fup;
}
@@ -268,9 +268,9 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) return;
}
pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/photos.saveMessagesPhoto.json", true, &CVkProto::OnReciveUploadFile)
- << TCHAR_PARAM("server", server)
- << TCHAR_PARAM("photo", upload)
- << TCHAR_PARAM("hash", hash);
+ << WCHAR_PARAM("server", server)
+ << WCHAR_PARAM("photo", upload)
+ << WCHAR_PARAM("hash", hash);
break;
case CVkFileUploadParam::typeAudio:
upload = jnRoot["audio"].as_mstring();
@@ -279,9 +279,9 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) return;
}
pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/audio.save.json", true, &CVkProto::OnReciveUploadFile)
- << TCHAR_PARAM("server", server)
- << TCHAR_PARAM("audio", upload)
- << TCHAR_PARAM("hash", hash);
+ << WCHAR_PARAM("server", server)
+ << WCHAR_PARAM("audio", upload)
+ << WCHAR_PARAM("hash", hash);
break;
case CVkFileUploadParam::typeDoc:
upload = jnRoot["file"].as_mstring();
@@ -291,7 +291,7 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) }
pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/docs.save.json", true, &CVkProto::OnReciveUploadFile)
<< CHAR_PARAM("title", fup->fileName())
- << TCHAR_PARAM("file", upload) ;
+ << WCHAR_PARAM("file", upload) ;
break;
default:
SendFileFiled(fup, VKERR_FTYPE_NOT_SUPPORTED);
@@ -351,13 +351,13 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (isChatRoom(fup->hContact)) {
- ptrW tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
- if (!tszChatID) {
+ ptrW wszChatID(getWStringA(fup->hContact, "ChatRoomID"));
+ if (!wszChatID) {
SendFileFiled(fup, VKERR_INVALID_USER);
return;
}
- CVkChatInfo *cc = GetChatById(tszChatID);
+ CVkChatInfo *cc = GetChatById(wszChatID);
if (cc == NULL) {
SendFileFiled(fup, VKERR_INVALID_USER);
return;
@@ -381,7 +381,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR }
- pMsgReq << TCHAR_PARAM("message", fup->Desc) << TCHAR_PARAM("attachment", Attachment);
+ pMsgReq << WCHAR_PARAM("message", fup->Desc) << WCHAR_PARAM("attachment", Attachment);
pMsgReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
Push(pMsgReq);
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 2d07963dad..ed5671492e 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -24,7 +24,7 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistoryForContact(WPARAM hContact, LPAR debugLogA("CVkProto::SvcGetAllServerHistoryForContact");
if (!IsOnline())
return 0;
- LPCTSTR str = TranslateT("Are you sure to reload all messages from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a long time.\nDo you want to continue?");
+ LPCWSTR str = TranslateT("Are you sure to reload all messages from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a long time.\nDo you want to continue?");
if (IDNO == MessageBox(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 0;
@@ -51,7 +51,7 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistory(WPARAM, LPARAM) debugLogA("CVkProto::SvcGetAllServerHistory start");
if (!IsOnline())
return 0;
- LPCTSTR str = TranslateT("Are you sure you want to reload all messages for all contacts from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a very long time and/or corrupt Miranda database.\nWe recommend check your database before reloading messages and after it (Miranda32.exe /svc:dbchecker or Miranda64.exe /svc:dbchecker).\nDo you want to continue?");
+ LPCWSTR str = TranslateT("Are you sure you want to reload all messages for all contacts from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a very long time and/or corrupt Miranda database.\nWe recommend check your database before reloading messages and after it (Miranda32.exe /svc:dbchecker or Miranda64.exe /svc:dbchecker).\nDo you want to continue?");
if (IDNO == MessageBox(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 0;
@@ -188,11 +188,11 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- ptrW ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
- CMString str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), ptszNick);
+ 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);
MsgPopup(param->hContact, str, TranslateT("Error"), true);
- debugLog(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", ptszNick, m_iLoadHistoryTask);
+ debugLog(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 tszBody(jnMsg["body"].as_mstring());
+ CMString 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,21 +231,21 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
- if (!tszBody.IsEmpty())
- tszFwdMessages = L"\n" + tszFwdMessages;
- tszBody += tszFwdMessages;
+ CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszFwdMessages = L"\n" + wszFwdMessages;
+ wszBody += wszFwdMessages;
}
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
- if (!tszBody.IsEmpty())
- tszAttachmentDescr = L"\n" + tszAttachmentDescr;
- tszBody += tszAttachmentDescr;
+ CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszAttachmentDescr = L"\n" + wszAttachmentDescr;
+ wszBody += wszAttachmentDescr;
}
- T2Utf pszBody(tszBody);
+ T2Utf pszBody(wszBody);
MCONTACT hContact = FindUser(uid, true);
PROTORECVEVENT recv = { 0 };
if (isRead)
@@ -280,9 +280,9 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- ptrW ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
- CMString str(FORMAT, TranslateT("Loading messages for %s is completed"), ptszNick);
- debugLog(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", ptszNick, 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);
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 8e0907cb20..bf5cb8bc7f 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 tszBody(jnMsg["body"].as_mstring());
+ CMString 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,19 +250,19 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
- if (!tszBody.IsEmpty())
- tszFwdMessages = L"\n" + tszFwdMessages;
- tszBody += tszFwdMessages;
+ CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszFwdMessages = L"\n" + wszFwdMessages;
+ wszBody += wszFwdMessages;
}
- CMString tszAttachmentDescr;
+ CMString wszAttachmentDescr;
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
- if (!tszBody.IsEmpty())
- tszBody += L"\n";
- tszBody += tszAttachmentDescr;
+ wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszBody += L"\n";
+ wszBody += wszAttachmentDescr;
}
MCONTACT hContact = NULL;
@@ -302,7 +302,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe else if (m_vkOptions.bUserForceInvisibleOnActivity && time(NULL) - datetime < 60 * m_vkOptions.iInvisibleInterval)
SetInvisible(hContact);
- T2Utf pszBody(tszBody);
+ T2Utf pszBody(wszBody);
recv.timestamp = m_vkOptions.bUseLocalTime ? time(NULL) : datetime;
recv.szMessage = pszBody;
recv.lParam = isOut;
@@ -320,8 +320,8 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (!isOut)
m_incIds.insert((HANDLE)mid);
}
- else if (m_vkOptions.bLoadSentAttachments && !tszAttachmentDescr.IsEmpty() && isOut) {
- T2Utf pszAttach(tszAttachmentDescr);
+ else if (m_vkOptions.bLoadSentAttachments && !wszAttachmentDescr.IsEmpty() && isOut) {
+ T2Utf pszAttach(wszAttachmentDescr);
recv.timestamp = time(NULL); // only local time
recv.szMessage = pszAttach;
ProtoChainRecvMsg(hContact, &recv);
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index b83e711ab1..9007aaeef3 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -43,29 +43,29 @@ void CVkAccMgrForm::OnInitDialog() {
CSuper::OnInitDialog();
- m_ptszOldLogin = m_edtLogin.GetText();
+ m_pwszOldLogin = m_edtLogin.GetText();
m_edtLogin.SendMsg(EM_LIMITTEXT, 1024, 0);
- m_ptszOldPass = m_proto->GetUserStoredPassword();
- m_edtPassword.SetText(m_ptszOldPass);
+ m_pwszOldPass = m_proto->GetUserStoredPassword();
+ m_edtPassword.SetText(m_pwszOldPass);
m_edtPassword.SendMsg(EM_LIMITTEXT, 1024, 0);
}
void CVkAccMgrForm::OnApply()
{
- pass_ptrT ptszNewPass(m_edtPassword.GetText());
- bool bPassChanged = mir_wstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ pass_ptrW pwszNewPass(m_edtPassword.GetText());
+ bool bPassChanged = mir_wstrcmp(m_pwszOldPass, pwszNewPass) != 0;
if (bPassChanged) {
- T2Utf szRawPasswd(ptszNewPass);
+ T2Utf szRawPasswd(pwszNewPass);
m_proto->setString("Password", szRawPasswd);
pass_ptrA pszPass(szRawPasswd.detach());
- m_ptszOldPass = ptszNewPass;
+ m_pwszOldPass = pwszNewPass;
}
- ptrW ptszNewLogin(m_edtLogin.GetText());
- if (bPassChanged || mir_wstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ ptrW pwszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_wstrcmpi(m_pwszOldLogin, pwszNewLogin))
m_proto->ClearAccessToken();
- m_ptszOldLogin = ptszNewLogin;
+ m_pwszOldLogin = pwszNewLogin;
}
////////////////////// Options ///////////////////////////////////////////////
@@ -76,7 +76,7 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.hInstance = hInst;
odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.pwszGroup = LPGENW("Network");
odp.pwszTab = LPGENW("Account");
@@ -151,7 +151,7 @@ CVkOptionAccountForm::CVkOptionAccountForm(CVkProto *proto): m_cbxSyncHistory(this, IDC_COMBO_SYNCHISTORY)
{
CreateLink(m_edtLogin, "Login", L"");
- CreateLink(m_edtGroupName, m_proto->m_vkOptions.ptszDefaultGroup);
+ CreateLink(m_edtGroupName, m_proto->m_vkOptions.pwszDefaultGroup);
CreateLink(m_cbDelivery, m_proto->m_vkOptions.bServerDelivery);
CreateLink(m_cbUseLocalTime, m_proto->m_vkOptions.bUseLocalTime);
CreateLink(m_cbAutoClean, m_proto->m_vkOptions.bAutoClean);
@@ -159,14 +159,14 @@ CVkOptionAccountForm::CVkOptionAccountForm(CVkProto *proto): void CVkOptionAccountForm::OnInitDialog()
{
- m_ptszOldLogin = m_edtLogin.GetText();
+ m_pwszOldLogin = m_edtLogin.GetText();
m_edtLogin.SendMsg(EM_LIMITTEXT, 1024, 0);
- m_ptszOldPass = m_proto->GetUserStoredPassword();
- m_edtPassword.SetText(m_ptszOldPass);
+ m_pwszOldPass = m_proto->GetUserStoredPassword();
+ m_edtPassword.SetText(m_pwszOldPass);
m_edtPassword.SendMsg(EM_LIMITTEXT, 1024, 0);
- m_ptszOldGroup = m_edtGroupName.GetText();
+ m_pwszOldGroup = m_edtGroupName.GetText();
for (size_t i = 0; i < _countof(vkMarkMsgAsReadMethods); i++) {
int cur = m_cbxMarkAsRead.AddString(vkMarkMsgAsReadMethods[i].type, vkMarkMsgAsReadMethods[i].data);
@@ -182,7 +182,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);
- if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
+ if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.pwszVKLang))
m_cbxVKLang.SetCurSel(cur);
}
@@ -192,27 +192,27 @@ void CVkOptionAccountForm::OnApply() {
m_proto->m_vkOptions.iSyncHistoryMetod = m_cbxSyncHistory.GetItemData(m_cbxSyncHistory.GetCurSel());
m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetItemData(m_cbxMarkAsRead.GetCurSel());
- m_proto->m_vkOptions.ptszVKLang = (wchar_t *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
+ m_proto->m_vkOptions.pwszVKLang = (wchar_t *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
- ptrW ptszGroupName(m_edtGroupName.GetText());
- if (mir_wstrcmp(m_ptszOldGroup, ptszGroupName)) {
- Clist_GroupCreate(NULL, ptszGroupName);
- m_ptszOldGroup = ptszGroupName;
+ ptrW pwszGroupName(m_edtGroupName.GetText());
+ if (mir_wstrcmp(m_pwszOldGroup, pwszGroupName)) {
+ Clist_GroupCreate(NULL, pwszGroupName);
+ m_pwszOldGroup = pwszGroupName;
}
- pass_ptrT ptszNewPass(m_edtPassword.GetText());
- bool bPassChanged = mir_wstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ pass_ptrW pwszNewPass(m_edtPassword.GetText());
+ bool bPassChanged = mir_wstrcmp(m_pwszOldPass, pwszNewPass) != 0;
if (bPassChanged) {
- T2Utf szRawPasswd(ptszNewPass);
+ T2Utf szRawPasswd(pwszNewPass);
m_proto->setString("Password", szRawPasswd);
pass_ptrA pszPass(szRawPasswd.detach());
- m_ptszOldPass = ptszNewPass;
+ m_pwszOldPass = pwszNewPass;
}
- ptrW ptszNewLogin(m_edtLogin.GetText());
- if (bPassChanged || mir_wstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ ptrW pwszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_wstrcmpi(m_pwszOldLogin, pwszNewLogin))
m_proto->ClearAccessToken();
- m_ptszOldLogin = ptszNewLogin;
+ m_pwszOldLogin = pwszNewLogin;
}
@@ -251,7 +251,7 @@ CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto): CreateLink(m_cbClearServerHistory, m_proto->m_vkOptions.bClearServerHistory);
CreateLink(m_cbRemoveFromFrendlist, m_proto->m_vkOptions.bRemoveFromFrendlist);
CreateLink(m_cbRemoveFromCList, m_proto->m_vkOptions.bRemoveFromCList);
- CreateLink(m_edtReturnChatMessage, m_proto->m_vkOptions.ptszReturnChatMessage);
+ CreateLink(m_edtReturnChatMessage, m_proto->m_vkOptions.pwszReturnChatMessage);
m_cbForceInvisibleStatus.OnChange = Callback(this, &CVkOptionAdvancedForm::On_cbForceInvisibleStatusChange);
m_cbSendVKLinksAsAttachments.OnChange = Callback(this, &CVkOptionAdvancedForm::On_cbSendVKLinksAsAttachmentsChange);
diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h index ddc9b42d09..e4d05ac1a4 100644 --- a/protocols/VKontakte/src/vk_options.h +++ b/protocols/VKontakte/src/vk_options.h @@ -30,8 +30,8 @@ class CVkAccMgrForm : public CVkDlgBase CCtrlEdit m_edtPassword;
CCtrlHyperlink m_hlLink;
- pass_ptrT m_ptszOldPass;
- ptrW m_ptszOldLogin;
+ pass_ptrW m_pwszOldPass;
+ ptrW m_pwszOldLogin;
public:
CVkAccMgrForm(CVkProto *proto, HWND hwndParent);
@@ -54,9 +54,9 @@ class CVkOptionAccountForm : public CVkDlgBase CCtrlCombo m_cbxSyncHistory;
CCtrlCombo m_cbxMarkAsRead;
- pass_ptrT m_ptszOldPass;
- ptrW m_ptszOldLogin;
- ptrW m_ptszOldGroup;
+ pass_ptrW m_pwszOldPass;
+ ptrW m_pwszOldLogin;
+ ptrW m_pwszOldGroup;
public:
CVkOptionAccountForm(CVkProto *proto);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 8144f79aa2..984799dad1 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -33,8 +33,8 @@ LIST<CVkProto> vk_Instances(1, sttCompareProtocols); mir_cs csInstances;
static COLORREF sttColors[] = { 0, 1, 2, 3, 4, 5, 6 };
-CVkProto::CVkProto(const char *szModuleName, const wchar_t *ptszUserName) :
- PROTO<CVkProto>(szModuleName, ptszUserName),
+CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
+ PROTO<CVkProto>(szModuleName, pwszUserName),
m_arRequestsQueue(10, sttCompareAsyncHttpRequest),
m_sendIds(3, PtrKeySortT),
m_incIds(3, PtrKeySortT),
@@ -70,7 +70,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *ptszUserName) : nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- Clist_GroupCreate(NULL, m_vkOptions.ptszDefaultGroup);
+ Clist_GroupCreate(NULL, m_vkOptions.pwszDefaultGroup);
CMStringA szListeningTo(FORMAT, "%sEnabled", m_szModuleName);
db_set_b(NULL, "ListeningTo", szListeningTo, m_vkOptions.iMusicSendMetod == 0 ? 0 : 1);
@@ -357,7 +357,7 @@ int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) {
LONG userID = getDword(hContact, "ID", -1);
bool bisFriend = (getBool(hContact, "Auth", true) == 0);
- bool bisBroadcast = !(IsEmpty(ptrW(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
+ bool bisBroadcast = !(IsEmpty(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl"))));
Menu_ShowItem(m_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER);
Menu_ShowItem(m_hContactMenuItems[CMI_MARKMESSAGESASREAD], !isChatRoom(hContact) && userID != VK_FEED_USER);
Menu_ShowItem(m_hContactMenuItems[CMI_WALLPOST], !isChatRoom(hContact));
@@ -427,7 +427,7 @@ void CVkProto::InitPopups(void) mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
- ppc.ptszDescription = desc;
+ ppc.pwszDescription = desc;
ppc.pszName = name;
ppc.hIcon = Skin_LoadIcon(SKINICON_ERROR);
ppc.colorBack = RGB(191, 0, 0); //Red
@@ -437,7 +437,7 @@ void CVkProto::InitPopups(void) mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notification"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
- ppc.ptszDescription = desc;
+ ppc.pwszDescription = desc;
ppc.pszName = name;
ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
ppc.colorBack = RGB(190, 225, 255); //Blue
@@ -446,14 +446,14 @@ void CVkProto::InitPopups(void) m_hPopupClassNotification = Popup_RegisterClass(&ppc);
}
-void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle, bool err)
+void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *wszMsg, const wchar_t *wszTitle, bool err)
{
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
char name[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = szTitle;
- ppd.pwszText = szMsg;
+ ppd.pwszTitle = wszTitle;
+ ppd.pwszText = wszMsg;
ppd.pszClassName = name;
ppd.hContact = hContact;
ppd.PluginData = new CVkSendMsgParam(hContact);
@@ -463,7 +463,7 @@ void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t * }
else {
DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
- MessageBox(NULL, szMsg, szTitle, mtype);
+ MessageBox(NULL, wszMsg, wszTitle, mtype);
}
}
@@ -555,11 +555,11 @@ int CVkProto::AuthRequest(MCONTACT hContact, const wchar_t *message) wchar_t msg[501] = {0};
if (message)
- wcsncpy_s(msg, 500, message, _TRUNCATE);
+ wcsncpy_s(msg, _countof(msg), message, _TRUNCATE);
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/friends.add.json", true, &CVkProto::OnReceiveAuthRequest)
<< INT_PARAM("user_id", userID)
- << TCHAR_PARAM("text", msg))->pUserInfo = new CVkSendMsgParam(hContact);
+ << WCHAR_PARAM("text", msg))->pUserInfo = new CVkSendMsgParam(hContact);
return 0;
}
@@ -576,11 +576,11 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * setByte(param->hContact, "Auth", 0);
if (iRet == 2) {
CMString msg,
- tszNick(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
- if (tszNick.IsEmpty())
- tszNick = TranslateT("(Unknown contact)");
- msg.AppendFormat(TranslateT("User %s added as friend"), tszNick);
- MsgPopup(param->hContact, msg, tszNick);
+ wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick")));
+ if (wszNick.IsEmpty())
+ wszNick = TranslateT("(Unknown contact)");
+ msg.AppendFormat(TranslateT("User %s added as friend"), wszNick);
+ MsgPopup(param->hContact, msg, wszNick);
}
}
else {
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 0b8e5b5962..65f127836b 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -114,7 +114,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcGetAllServerHistory(WPARAM, LPARAM);
//=====================================================================================
- void CreateNewChat(LPCSTR uids, LPCTSTR ptrszTitle);
+ void CreateNewChat(LPCSTR uids, LPCWSTR pwszTitle);
__forceinline bool IsOnline() const { return m_bOnline; }
void OnTimerTic();
void ClearAccessToken();
@@ -232,7 +232,7 @@ private: //==== PopUps ========================================================================
void InitPopups(void);
- void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle, bool err = false);
+ void MsgPopup(MCONTACT hContact, const wchar_t *wszMsg, const wchar_t *wszTitle, bool err = false);
//==== Hooks =========================================================================
@@ -269,7 +269,7 @@ private: 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);
- CVKNewsItem* GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCTSTR ptszReplyText = NULL, LPCTSTR ptszReplyLink = NULL);
+ CVKNewsItem* GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCWSTR pwszReplyText = NULL, LPCWSTR pwszReplyLink = NULL);
void RetrieveUnreadNews(time_t tLastNewsTime);
void OnReceiveUnreadNews(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveUnreadNotifications(time_t tLastNotificationsTime);
@@ -302,7 +302,7 @@ private: void OnReceiveMessages(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveDlgs(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnSendMessage(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- void WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, bool bFriendsOnly);
+ void WallPost(MCONTACT hContact, wchar_t *pwszMsg, wchar_t *pwszUrl, bool bFriendsOnly);
void GetServerHistoryLastNDay(MCONTACT hContact, int NDay);
void GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int iTime, int iLastMsgId, bool once = false);
void OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq);
@@ -326,7 +326,7 @@ private: void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
bool AutoFillForm(char*, CMStringA&, CMStringA&);
CMString RunConfirmationCode();
- CMString RunRenameNick(LPCTSTR ptszOldName);
+ CMString 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& tszType, VKObjType& vkFeedback, VKObjType& vkParent);
+ CMString SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedback, VKObjType& vkParent);
CMString GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC);
- CMString SetBBCString(LPCTSTR tszString, BBCSupport iBBC, VKBBCType bbcType, LPCTSTR tszAddString = NULL);
- CMString& ClearFormatNick(CMString& tszText);
+ 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);
void SetInvisible(MCONTACT hContact);
- CMString RemoveBBC(CMString& tszSrc);
+ CMString RemoveBBC(CMString& wszSrc);
void InitQueue();
void UninitQueue();
void ExecuteRequest(AsyncHttpRequest*);
@@ -357,17 +357,17 @@ private: void OnLoggedIn();
void OnLoggedOut();
void ShutdownSession();
- void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl);
- void GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen);
+ void SetAvatarUrl(MCONTACT hContact, CMString &wszUrl);
+ void GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen);
void ReloadAvatarInfo(MCONTACT hContact);
void __cdecl SendMsgAck(void *param);
void __cdecl ChatContactTypingThread(void *p);
void StopChatContactTyping(int iChatId, int iUserId);
void OnCreateNewChat(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
CVkChatInfo* AppendChat(int id, const JSONNode &jnNode);
- void SetChatTitle(CVkChatInfo *cc, LPCTSTR tszTopic);
+ void SetChatTitle(CVkChatInfo *cc, LPCWSTR wszTopic);
void AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode &jnFUsers, bool bIsHistory);
- void AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR ptszBody, bool bIsHistory, bool bIsAction = false);
+ void AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR pwszBody, bool bIsHistory, bool bIsAction = false);
void RetrieveChatInfo(CVkChatInfo*);
void OnReceiveChatInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnSendChatMsg(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
@@ -383,6 +383,6 @@ private: void NickMenuHook(CVkChatInfo*, GCHOOK*);
LPTSTR ChangeChatTopic(CVkChatInfo*);
void SetChatStatus(MCONTACT hContact, int iStatus);
- CVkChatInfo* GetChatById(LPCTSTR ptszId);
+ CVkChatInfo* GetChatById(LPCWSTR pwszId);
INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM);
};
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 515f7ad80b..fed6cd6ab4 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -96,8 +96,8 @@ AsyncHttpRequest* CVkProto::Push(AsyncHttpRequest *pReq, int iTimeout) pReq->timeout = iTimeout;
if (pReq->m_bApiReq) {
pReq << VER_API;
- if (!IsEmpty(m_vkOptions.ptszVKLang))
- pReq << TCHAR_PARAM("lang", m_vkOptions.ptszVKLang);
+ if (!IsEmpty(m_vkOptions.pwszVKLang))
+ pReq << WCHAR_PARAM("lang", m_vkOptions.pwszVKLang);
}
{
@@ -203,9 +203,9 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const CHAR_PARAM ¶m) return pReq;
}
-AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const TCHAR_PARAM ¶m)
+AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const WCHAR_PARAM ¶m)
{
- T2Utf szValue(param.tszValue);
+ T2Utf szValue(param.wszValue);
CMStringA &s = pReq->m_szParam;
if (!s.IsEmpty())
s.AppendChar('&');
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index f3004e3855..b56376b265 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -47,7 +47,7 @@ void CVkProto::SearchBasicThread(void *id) if (!IsOnline())
return;
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/users.get.json", true, &CVkProto::OnSearch)
- << TCHAR_PARAM("user_ids", (wchar_t *)id)
+ << WCHAR_PARAM("user_ids", (wchar_t *)id)
<< CHAR_PARAM("fields", "nickname, domain");
pReq->pUserInfo = NULL;
Push(pReq);
@@ -59,7 +59,7 @@ void CVkProto::SearchByMailThread(void *email) if (!IsOnline())
return;
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/account.lookupContacts.json", true, &CVkProto::OnSearchByMail)
- << TCHAR_PARAM("contacts", (wchar_t *)email)
+ << WCHAR_PARAM("contacts", (wchar_t *)email)
<< CHAR_PARAM("service", "email");
Push(pReq);
}
@@ -75,7 +75,7 @@ void __cdecl CVkProto::SearchThread(void *p) return;
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/users.search.json", true, &CVkProto::OnSearch)
- << TCHAR_PARAM("q", (wchar_t *)arg)
+ << WCHAR_PARAM("q", (wchar_t *)arg)
<< CHAR_PARAM("fields", "nickname, domain")
<< INT_PARAM("count", 200);
pReq->pUserInfo = p;
@@ -134,11 +134,11 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) bool filter = true;
if (pParam) {
if (psr.firstName.w && pParam->pszFirstName)
- filter = tlstrstr(psr.firstName.w, pParam->pszFirstName) && filter;
+ filter = wlstrstr(psr.firstName.w, pParam->pszFirstName) && filter;
if (psr.lastName.w && pParam->pszLastName)
- filter = tlstrstr(psr.lastName.w, pParam->pszLastName) && filter;
+ filter = wlstrstr(psr.lastName.w, pParam->pszLastName) && filter;
if (psr.nick.w && pParam->pszNick)
- filter = tlstrstr(psr.nick.w, pParam->pszNick) && filter;
+ filter = wlstrstr(psr.nick.w, pParam->pszNick) && filter;
}
if (filter)
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 9fc8aef944..5f58c9dcf3 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -69,12 +69,12 @@ void CVkProto::SetServerStatus(int iNewStatus) return;
int iOldStatus = m_iStatus;
- CMString oldStatusMsg(ptrW(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")));
- ptrW ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
+ CMString oldStatusMsg(ptrW(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg")));
+ ptrW pwszListeningToMsg(db_get_wsa(NULL, m_szModuleName, "ListeningTo"));
if (iNewStatus == ID_STATUS_OFFLINE) {
m_bNeedSendOnline = false;
- if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast) {
+ if (!IsEmpty(pwszListeningToMsg) && m_bSetBroadcast) {
RetrieveStatusMsg(oldStatusMsg);
m_bSetBroadcast = false;
}
@@ -91,7 +91,7 @@ void CVkProto::SetServerStatus(int iNewStatus) }
else {
m_bNeedSendOnline = false;
- if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast) {
+ if (!IsEmpty(pwszListeningToMsg) && m_bSetBroadcast) {
RetrieveStatusMsg(oldStatusMsg);
m_bSetBroadcast = false;
}
@@ -126,25 +126,25 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR OnReceiveStatus(reply, pReq);
- ptrW ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"));
- CMString tszOldStatusMsg(ptszOldStatusMsg);
+ ptrW pwszOldStatusMsg(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg"));
+ CMString wszOldStatusMsg(pwszOldStatusMsg);
ENTER_STRING pForm = { sizeof(pForm) };
pForm.type = ESF_MULTILINE;
pForm.caption = TranslateT("Enter new status message");
- pForm.ptszInitVal = ptszOldStatusMsg;
+ pForm.ptszInitVal = pwszOldStatusMsg;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "statusmsgform_";
if (!EnterString(&pForm))
return;
- CMString tszNewStatusMsg(ptrW(pForm.ptszResult));
- if (tszOldStatusMsg == tszNewStatusMsg)
+ CMString wszNewStatusMsg(ptrW(pForm.ptszResult));
+ if (wszOldStatusMsg == wszNewStatusMsg)
return;
- RetrieveStatusMsg(tszNewStatusMsg);
- setTString("OldStatusMsg", ptszOldStatusMsg);
+ RetrieveStatusMsg(wszNewStatusMsg);
+ setWString("OldStatusMsg", pwszOldStatusMsg);
}
void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
@@ -159,9 +159,9 @@ void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnAudio = jnResponse["audio"];
if (!jnAudio) {
- CMString tszStatusText(jnResponse["text"].as_mstring());
- if (tszStatusText[0] != wchar_t(9835))
- setTString("OldStatusMsg", tszStatusText);
+ CMString wszStatusText(jnResponse["text"].as_mstring());
+ if (wszStatusText[0] != wchar_t(9835))
+ setWString("OldStatusMsg", wszStatusText);
}
}
@@ -172,7 +172,7 @@ void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg) return;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/status.set.json", true, &CVkProto::OnReceiveSmth)
- << TCHAR_PARAM("text", StatusMsg));
+ << WCHAR_PARAM("text", StatusMsg));
}
void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg)
@@ -182,13 +182,13 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) return;
CMString code;
- CMString tszOldStatusMsg(db_get_tsa(0, m_szModuleName, "OldStatusMsg"));
+ CMString 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;");
- code.AppendFormat(codeformat, tszOldStatusMsg);
+ code.AppendFormat(codeformat, wszOldStatusMsg);
}
m_bSetBroadcast = false;
}
@@ -225,7 +225,7 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) m_bSetBroadcast = true;
}
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveStatus)
- << TCHAR_PARAM("code", code));
+ << WCHAR_PARAM("code", code));
}
INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam)
@@ -235,18 +235,18 @@ INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam) return 1;
LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
- CMString tszListeningTo;
+ CMString wszListeningTo;
if (pliInfo == NULL || pliInfo->cbSize != sizeof(LISTENINGTOINFO))
db_unset(NULL, m_szModuleName, "ListeningTo");
else if (pliInfo->dwFlags & LTI_UNICODE) {
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
- tszListeningTo = ptrW((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo));
+ wszListeningTo = ptrW((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo));
else
- tszListeningTo.Format(L"%s - %s",
+ wszListeningTo.Format(L"%s - %s",
pliInfo->ptszArtist ? pliInfo->ptszArtist : L"",
pliInfo->ptszTitle ? pliInfo->ptszTitle : L"");
- setTString("ListeningTo", tszListeningTo);
+ setWString("ListeningTo", wszListeningTo);
}
- RetrieveStatusMusic(tszListeningTo);
+ RetrieveStatusMusic(wszListeningTo);
return 0;
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index 12bc8804d0..8373f8be89 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -135,11 +135,11 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() CMStringA fn(FORMAT, "%s%s", pszFNAME, pszEXT);
fname = mir_strdup(fn);
- if (tlstrstr(img, EXT)) {
+ if (wlstrstr(img, EXT)) {
filetype = CVkFileUploadParam::typeImg;
atr = mir_strdup("photo");
}
- else if (tlstrstr(audio, EXT)) {
+ else if (wlstrstr(audio, EXT)) {
filetype = CVkFileUploadParam::typeAudio;
atr = mir_strdup("file");
}
@@ -153,9 +153,9 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() /////////////////////////////////////////////////////////////////////////////////////////
-CVkChatUser* CVkChatInfo::GetUserById(LPCTSTR ptszId)
+CVkChatUser* CVkChatInfo::GetUserById(LPCWSTR pwszId)
{
- int user_id = _wtoi(ptszId);
+ int user_id = _wtoi(pwszId);
return m_users.find((CVkChatUser*)&user_id);
}
@@ -233,9 +233,9 @@ CVKOptions::CVKOptions(PROTO_INTERFACE *proto) : iInvisibleInterval(proto, "InvisibleInterval", 10),
iMaxFriendsCount(proto, "MaxFriendsCount", 1000),
- ptszDefaultGroup(proto, "ProtoGroup", L"VKontakte"),
- ptszReturnChatMessage(proto, "ReturnChatMessage", TranslateT("I\'m back")),
- ptszVKLang(proto, "VKLang", NULL)
+ pwszDefaultGroup(proto, "ProtoGroup", L"VKontakte"),
+ pwszReturnChatMessage(proto, "ReturnChatMessage", TranslateT("I\'m back")),
+ pwszVKLang(proto, "VKLang", NULL)
{
}
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 19e320eb67..54813f388f 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -70,14 +70,14 @@ struct CHAR_PARAM : public PARAM };
AsyncHttpRequest* operator<<(AsyncHttpRequest*, const CHAR_PARAM&);
-struct TCHAR_PARAM : public PARAM
+struct WCHAR_PARAM : public PARAM
{
- LPCTSTR tszValue;
- __forceinline TCHAR_PARAM(LPCSTR _name, LPCTSTR _value) :
- PARAM(_name), tszValue(_value)
+ LPCWSTR wszValue;
+ __forceinline WCHAR_PARAM(LPCSTR _name, LPCWSTR _value) :
+ PARAM(_name), wszValue(_value)
{}
};
-AsyncHttpRequest* operator<<(AsyncHttpRequest*, const TCHAR_PARAM&);
+AsyncHttpRequest* operator<<(AsyncHttpRequest*, const WCHAR_PARAM&);
struct CVkFileUploadParam : public MZeroedObject {
enum VKFileType { typeInvalid, typeImg, typeAudio, typeDoc, typeNotSupported };
@@ -141,7 +141,7 @@ struct CVkChatMessage : public MZeroedObject int m_mid, m_uid, m_date;
bool m_bHistory, m_bIsAction;
- ptrW m_tszBody;
+ ptrW m_wszBody;
};
struct CVkChatUser : public MZeroedObject
@@ -154,7 +154,7 @@ struct CVkChatUser : public MZeroedObject int m_uid;
bool m_bDel, m_bUnknown;
- ptrW m_tszNick;
+ ptrW m_wszNick;
};
struct CVkChatInfo : public MZeroedObject
@@ -170,12 +170,12 @@ struct CVkChatInfo : public MZeroedObject int m_chatid, m_admin_id;
bool m_bHistoryRead;
- ptrW m_tszTopic, m_tszId;
+ ptrW m_wszTopic, m_wszId;
MCONTACT m_hContact;
OBJLIST<CVkChatUser> m_users;
OBJLIST<CVkChatMessage> m_msgs;
- CVkChatUser* GetUserById(LPCTSTR);
+ CVkChatUser* GetUserById(LPCWSTR);
CVkChatUser* GetUserById(int user_id);
};
@@ -185,27 +185,27 @@ struct CVkUserInfo : public MZeroedObject { m_bIsGroup(false)
{}
- CVkUserInfo(LONG _UserId, bool _bIsGroup, CMString& _tszUserNick, CMString& _tszLink, MCONTACT _hContact = NULL) :
+ CVkUserInfo(LONG _UserId, bool _bIsGroup, CMString& _wszUserNick, CMString& _wszLink, MCONTACT _hContact = NULL) :
m_UserId(_UserId),
m_bIsGroup(_bIsGroup),
- m_tszUserNick(_tszUserNick),
- m_tszLink(_tszLink),
+ m_wszUserNick(_wszUserNick),
+ m_wszLink(_wszLink),
m_hContact(_hContact)
{}
LONG m_UserId;
MCONTACT m_hContact;
- CMString m_tszUserNick;
- CMString m_tszLink;
+ CMString m_wszUserNick;
+ CMString m_wszLink;
bool m_bIsGroup;
};
enum VKObjType { vkNull, vkPost, vkPhoto, vkVideo, vkComment, vkTopic, vkUsers, vkCopy, vkInvite };
struct CVKNotification {
- wchar_t *ptszType;
+ wchar_t *pwszType;
VKObjType vkParent, vkFeedback;
- wchar_t *ptszTranslate;
+ wchar_t *pwszTranslate;
};
struct CVKNewsItem : public MZeroedObject {
@@ -218,14 +218,14 @@ struct CVKNewsItem : public MZeroedObject { vkParentType(vkNull)
{}
- CMString tszId;
+ CMString wszId;
time_t tDate;
CVkUserInfo *vkUser;
- CMString tszText;
- CMString tszLink;
- CMString tszType;
- CMString tszPopupTitle;
- CMString tszPopupText;
+ CMString wszText;
+ CMString wszLink;
+ CMString wszType;
+ CMString wszPopupTitle;
+ CMString wszPopupText;
VKObjType vkFeedbackType, vkParentType;
bool bIsGroup;
bool bIsRepost;
@@ -237,7 +237,7 @@ enum BBCSupport : BYTE { bbcNo, bbcBasic, bbcAdvanced }; struct CVKBBCItem {
VKBBCType vkBBCType;
BBCSupport vkBBCSettings;
- wchar_t *ptszTempate;
+ wchar_t *pwszTempate;
};
struct CVKChatContactTypingParam {
@@ -252,7 +252,7 @@ struct CVKChatContactTypingParam { struct CVKInteres {
const char *szField;
- wchar_t *ptszTranslate;
+ wchar_t *pwszTranslate;
};
struct CVKLang {
@@ -351,9 +351,9 @@ struct CVKOptions { CMOption<DWORD> iInvisibleInterval;
CMOption<DWORD> iMaxFriendsCount;
- CMOption<wchar_t*> ptszDefaultGroup;
- CMOption<wchar_t*> ptszReturnChatMessage;
- CMOption<wchar_t*> ptszVKLang;
+ CMOption<wchar_t*> pwszDefaultGroup;
+ CMOption<wchar_t*> pwszReturnChatMessage;
+ CMOption<wchar_t*> pwszVKLang;
CVKOptions(PROTO_INTERFACE *proto);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index ea600d8eb4..24d68d33c9 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -271,33 +271,33 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) else if (hContact == NULL)
return NULL;
- CMString tszNick, tszValue;
+ CMString wszNick, wszValue;
int iValue;
- tszValue = jnItem["first_name"].as_mstring();
- if (!tszValue.IsEmpty()) {
- setTString(hContact, "FirstName", tszValue);
- tszNick.Append(tszValue);
- tszNick.AppendChar(' ');
+ wszValue = jnItem["first_name"].as_mstring();
+ if (!wszValue.IsEmpty()) {
+ setWString(hContact, "FirstName", wszValue);
+ wszNick.Append(wszValue);
+ wszNick.AppendChar(' ');
}
- tszValue = jnItem["last_name"].as_mstring();
- if (!tszValue.IsEmpty()) {
- setTString(hContact, "LastName", tszValue);
- tszNick.Append(tszValue);
+ wszValue = jnItem["last_name"].as_mstring();
+ if (!wszValue.IsEmpty()) {
+ setWString(hContact, "LastName", wszValue);
+ wszNick.Append(wszValue);
}
- if (!tszNick.IsEmpty())
- setTString(hContact, "Nick", tszNick);
+ if (!wszNick.IsEmpty())
+ setWString(hContact, "Nick", wszNick);
int sex = jnItem["sex"].as_int();
if (sex)
setByte(hContact, "Gender", sex == 2 ? 'M' : 'F');
- tszValue = jnItem["bdate"].as_mstring();
- if (!tszValue.IsEmpty()) {
+ wszValue = jnItem["bdate"].as_mstring();
+ if (!wszValue.IsEmpty()) {
int d, m, y, iReadCount;
- iReadCount = swscanf(tszValue, L"%d.%d.%d", &d, &m, &y);
+ iReadCount = swscanf(wszValue, L"%d.%d.%d", &d, &m, &y);
if (iReadCount > 1) {
if (iReadCount == 3)
setWord(hContact, "BirthYear", y);
@@ -306,9 +306,9 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) }
}
- tszValue = jnItem["photo_100"].as_mstring();
- if (!tszValue.IsEmpty()) {
- SetAvatarUrl(hContact, tszValue);
+ wszValue = jnItem["photo_100"].as_mstring();
+ if (!wszValue.IsEmpty()) {
+ SetAvatarUrl(hContact, wszValue);
ReloadAvatarInfo(hContact);
}
@@ -346,30 +346,30 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) if ((iValue = jnItem["timezone"].as_int()) != 0)
setByte(hContact, "Timezone", iValue * -2);
- tszValue = jnItem["mobile_phone"].as_mstring();
- if (!tszValue.IsEmpty())
- setTString(hContact, "Cellular", tszValue);
+ wszValue = jnItem["mobile_phone"].as_mstring();
+ if (!wszValue.IsEmpty())
+ setWString(hContact, "Cellular", wszValue);
- tszValue = jnItem["home_phone"].as_mstring();
- if (!tszValue.IsEmpty())
- setTString(hContact, "Phone", tszValue);
+ wszValue = jnItem["home_phone"].as_mstring();
+ if (!wszValue.IsEmpty())
+ setWString(hContact, "Phone", wszValue);
- tszValue = jnItem["status"].as_mstring();
- CMString tszOldStatus(ptrW(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
- if (tszValue != tszOldStatus)
- db_set_ts(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", tszValue);
+ wszValue = jnItem["status"].as_mstring();
+ CMString 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 tszOldListeningTo(ptrW(db_get_tsa(hContact, m_szModuleName, "ListeningTo")));
+ CMString wszOldListeningTo(ptrW(db_get_wsa(hContact, m_szModuleName, "ListeningTo")));
const JSONNode &jnAudio = jnItem["status_audio"];
if (jnAudio) {
- CMString tszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring());
- if (tszListeningTo != tszOldListeningTo) {
- setTString(hContact, "ListeningTo", tszListeningTo);
- setTString(hContact, "AudioUrl", jnAudio["url"].as_mstring());
+ CMString 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());
}
}
- else if (tszValue[0] == wchar_t(9835) && tszValue.GetLength() > 2) {
- setTString(hContact, "ListeningTo", &(tszValue.GetBuffer())[2]);
+ else if (wszValue[0] == wchar_t(9835) && wszValue.GetLength() > 2) {
+ setWString(hContact, "ListeningTo", &(wszValue.GetBuffer())[2]);
db_unset(hContact, m_szModuleName, "AudioUrl");
}
else {
@@ -379,16 +379,16 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) const JSONNode &jnCountry = jnItem["country"];
if (jnCountry) {
- tszValue = jnCountry["title"].as_mstring();
- if (!tszValue.IsEmpty())
- setTString(hContact, "Country", tszValue);
+ wszValue = jnCountry["title"].as_mstring();
+ if (!wszValue.IsEmpty())
+ setWString(hContact, "Country", wszValue);
}
const JSONNode &jnCity = jnItem["city"];
if (jnCity) {
- tszValue = jnCity["title"].as_mstring();
- if (!tszValue.IsEmpty())
- setTString(hContact, "City", tszValue);
+ wszValue = jnCity["title"].as_mstring();
+ if (!wszValue.IsEmpty())
+ setWString(hContact, "City", wszValue);
}
// MaritalStatus
@@ -412,15 +412,15 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) int iInteres = 0;
for (int i = 0; i < _countof(vkInteres); i++) {
- tszValue = jnItem[vkInteres[i].szField].as_mstring();
- if (tszValue.IsEmpty())
+ wszValue = jnItem[vkInteres[i].szField].as_mstring();
+ if (wszValue.IsEmpty())
continue;
CMStringA InteresCat(FORMAT, "Interest%dCat", iInteres);
CMStringA InteresText(FORMAT, "Interest%dText", iInteres);
- setTString(hContact, InteresCat, vkInteres[i].ptszTranslate);
- setTString(hContact, InteresText, tszValue);
+ setWString(hContact, InteresCat, vkInteres[i].pwszTranslate);
+ setWString(hContact, InteresText, wszValue);
iInteres++;
@@ -428,28 +428,28 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) for (int i = iInteres; iInteres > 0; i++) {
CMStringA InteresCat(FORMAT, "Interest%dCat", iInteres);
- ptrW ptszCat(db_get_tsa(hContact, m_szModuleName, InteresCat));
- if (!ptszCat)
+ ptrW pwszCat(db_get_wsa(hContact, m_szModuleName, InteresCat));
+ if (!pwszCat)
break;
db_unset(hContact, m_szModuleName, InteresCat);
CMStringA InteresText(FORMAT, "Interest%dText", iInteres);
- ptrW ptszText(db_get_tsa(hContact, m_szModuleName, InteresText));
- if (!ptszText)
+ ptrW pwszText(db_get_wsa(hContact, m_szModuleName, InteresText));
+ if (!pwszText)
break;
db_unset(hContact, m_szModuleName, InteresText);
}
- tszValue = jnItem["about"].as_mstring();
- if (!tszValue.IsEmpty())
- setTString(hContact, "About", tszValue);
+ wszValue = jnItem["about"].as_mstring();
+ if (!wszValue.IsEmpty())
+ setWString(hContact, "About", wszValue);
- tszValue = jnItem["domain"].as_mstring();
- if (!tszValue.IsEmpty()) {
- setTString(hContact, "domain", tszValue);
- CMString tszUrl("https://vk.com/");
- tszUrl.Append(tszValue);
- setTString(hContact, "Homepage", tszUrl);
+ wszValue = jnItem["domain"].as_mstring();
+ if (!wszValue.IsEmpty()) {
+ setWString(hContact, "domain", wszValue);
+ CMString wszUrl("https://vk.com/");
+ wszUrl.Append(wszValue);
+ setWString(hContact, "Homepage", wszUrl);
}
return hContact;
@@ -464,7 +464,7 @@ void CVkProto::RetrieveUserInfo(LONG userID) 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));
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
- << TCHAR_PARAM("code", code));
+ << WCHAR_PARAM("code", code));
}
void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat)
@@ -506,7 +506,7 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) code.AppendFormat(codeformat, userIDs, CMString(bFreeOffline ? "online,status" : fieldsName), (int)bRepeat);
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
- << TCHAR_PARAM("code", code));
+ << WCHAR_PARAM("code", code));
}
void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
@@ -678,11 +678,11 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- ptrW ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
- CMString ptszMsg;
+ ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
+ CMString pwszMsg;
if (flag == 0) {
- ptszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(ptszNick) ? TranslateT("(Unknown contact)") : ptszNick);
- if (IDNO == MessageBox(NULL, ptszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ 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))
return 1;
}
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/friends.delete.json", true, &CVkProto::OnReceiveDeleteFriend)
@@ -699,9 +699,9 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (jnResponse) {
- CMString tszNick(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
- if (tszNick.IsEmpty())
- tszNick = TranslateT("(Unknown contact)");
+ CMString wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick")));
+ if (wszNick.IsEmpty())
+ wszNick = TranslateT("(Unknown contact)");
CMString msgformat, msg;
if (jnResponse["success"].as_bool()) {
@@ -714,13 +714,13 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest else if (jnResponse["suggestion_deleted"].as_bool())
msgformat = TranslateT("Friend request suggestion for the user %s deleted");
- msg.AppendFormat(msgformat, tszNick);
- MsgPopup(param->hContact, msg, tszNick);
+ msg.AppendFormat(msgformat, wszNick);
+ MsgPopup(param->hContact, msg, wszNick);
setByte(param->hContact, "Auth", 1);
}
else {
msg = TranslateT("User or request was not deleted");
- MsgPopup(param->hContact, msg, tszNick);
+ MsgPopup(param->hContact, msg, wszNick);
}
}
}
@@ -739,45 +739,45 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) return 1;
CMStringA code(FORMAT, "var userID=\"%d\";API.account.banUser({\"user_id\":userID});", userID);
- CMString tszVarWarning;
+ CMString wszVarWarning;
if (m_vkOptions.bReportAbuse) {
debugLogA("CVkProto::SvcBanUser m_vkOptions.bReportAbuse = true");
code += "API.users.report({\"user_id\":userID,type:\"spam\"});";
- tszVarWarning = TranslateT(" report abuse on him/her");
+ wszVarWarning = TranslateT(" report abuse on him/her");
}
if (m_vkOptions.bClearServerHistory) {
debugLogA("CVkProto::SvcBanUser m_vkOptions.bClearServerHistory = true");
code += "API.messages.deleteDialog({\"user_id\":userID,count:10000});";
- if (!tszVarWarning.IsEmpty())
- tszVarWarning.AppendChar(L',');
- tszVarWarning += TranslateT(" clear server history with him/her");
+ if (!wszVarWarning.IsEmpty())
+ wszVarWarning.AppendChar(L',');
+ wszVarWarning += TranslateT(" clear server history with him/her");
}
if (m_vkOptions.bRemoveFromFrendlist) {
debugLogA("CVkProto::SvcBanUser m_vkOptions.bRemoveFromFrendlist = true");
code += "API.friends.delete({\"user_id\":userID});";
- if (!tszVarWarning.IsEmpty())
- tszVarWarning.AppendChar(L',');
- tszVarWarning += TranslateT(" remove him/her from your friend list");
+ if (!wszVarWarning.IsEmpty())
+ wszVarWarning.AppendChar(L',');
+ wszVarWarning += TranslateT(" remove him/her from your friend list");
}
if (m_vkOptions.bRemoveFromCList) {
debugLogA("CVkProto::SvcBanUser m_vkOptions.bRemoveFromClist = true");
- if (!tszVarWarning.IsEmpty())
- tszVarWarning.AppendChar(L',');
- tszVarWarning += TranslateT(" remove him/her from your contact list");
+ if (!wszVarWarning.IsEmpty())
+ wszVarWarning.AppendChar(L',');
+ wszVarWarning += TranslateT(" remove him/her from your contact list");
}
- if (!tszVarWarning.IsEmpty())
- tszVarWarning += ".\n";
+ if (!wszVarWarning.IsEmpty())
+ wszVarWarning += ".\n";
code += "return 1;";
- ptrW ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
- CMString ptszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"),
- IsEmpty(ptszNick) ? TranslateT("(Unknown contact)") : ptszNick,
- tszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"),
- tszVarWarning.IsEmpty() ? L"\n" : tszVarWarning);
+ ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
+ CMString 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);
- if (IDNO == MessageBox(NULL, ptszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
@@ -796,9 +796,9 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- CMString tszNick(ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"))),
- ptszMsg(FORMAT, TranslateT("Are you sure to report abuse on %s?"), tszNick.IsEmpty() ? TranslateT("(Unknown contact)") : tszNick);
- if (IDNO == MessageBox(NULL, ptszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ CMString 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;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/users.report.json", true, &CVkProto::OnReceiveSmth)
@@ -812,9 +812,9 @@ INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcOpenBroadcast");
- CMString tszAudio(ptrW(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
- if (!tszAudio.IsEmpty())
- Utils_OpenUrlT(tszAudio);
+ CMString wszAudio(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl")));
+ if (!wszAudio.IsEmpty())
+ Utils_OpenUrlT(wszAudio);
return 0;
}
@@ -823,21 +823,21 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcVisitProfile");
if (isChatRoom(hContact)) {
- ptrW tszHomepage(db_get_tsa(hContact, m_szModuleName, "Homepage"));
- if(!IsEmpty(tszHomepage))
- Utils_OpenUrlT(tszHomepage);
+ ptrW wszHomepage(db_get_wsa(hContact, m_szModuleName, "Homepage"));
+ if(!IsEmpty(wszHomepage))
+ Utils_OpenUrlT(wszHomepage);
return 0;
}
LONG userID = getDword(hContact, "ID", -1);
- ptrW tszDomain(db_get_tsa(hContact, m_szModuleName, "domain"));
+ ptrW wszDomain(db_get_wsa(hContact, m_szModuleName, "domain"));
- CMString tszUrl("https://vk.com/");
- if (tszDomain)
- tszUrl.Append(tszDomain);
+ CMString wszUrl("https://vk.com/");
+ if (wszDomain)
+ wszUrl.Append(wszDomain);
else
- tszUrl.AppendFormat(L"id%i", userID);
+ wszUrl.AppendFormat(L"id%i", userID);
- Utils_OpenUrlT(tszUrl);
+ Utils_OpenUrlT(wszUrl);
return 0;
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp index 5871dbcff3..3f91ebab3a 100644 --- a/protocols/VKontakte/src/vk_wallpost.cpp +++ b/protocols/VKontakte/src/vk_wallpost.cpp @@ -21,19 +21,19 @@ INT_PTR __cdecl CVkProto::SvcWallPost(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcWallPost");
- WALLPOST_FORM_PARAMS param(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ WALLPOST_FORM_PARAMS param(db_get_wsa(hContact, m_szModuleName, "Nick"));
CVkWallPostForm dlg(this, ¶m);
if (!dlg.DoModal())
return 1;
- WallPost((MCONTACT)hContact, param.ptszMsg, param.ptszUrl, param.bFriendsOnly);
+ WallPost((MCONTACT)hContact, param.pwszMsg, param.pwszUrl, param.bFriendsOnly);
return 0;
}
-void CVkProto::WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, bool bFriendsOnly)
+void CVkProto::WallPost(MCONTACT hContact, wchar_t *pwszMsg, wchar_t *pwszUrl, bool bFriendsOnly)
{
debugLogA("CVkProto::WallPost");
- if (!IsOnline() || (IsEmpty(ptszMsg) && IsEmpty(ptszUrl)))
+ if (!IsOnline() || (IsEmpty(pwszMsg) && IsEmpty(pwszUrl)))
return;
LONG userID = hContact ? m_myUserId : getDword(hContact, "ID", -1);
@@ -44,11 +44,11 @@ void CVkProto::WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, b << INT_PARAM("owner_id", userID)
<< INT_PARAM("friends_only", bFriendsOnly ? 1 : 0);
- if (!IsEmpty(ptszMsg))
- pReq << TCHAR_PARAM("message", ptszMsg);
+ if (!IsEmpty(pwszMsg))
+ pReq << WCHAR_PARAM("message", pwszMsg);
- if (!IsEmpty(ptszUrl))
- pReq << TCHAR_PARAM("attachments", ptszUrl);
+ if (!IsEmpty(pwszUrl))
+ pReq << WCHAR_PARAM("attachments", pwszUrl);
Push(pReq);
}
\ No newline at end of file |