From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/main.cpp | 2 +- protocols/VKontakte/src/misc.cpp | 30 ++++++++--------- protocols/VKontakte/src/stdafx.h | 1 - protocols/VKontakte/src/vk.h | 2 +- protocols/VKontakte/src/vk_avatars.cpp | 18 +++++----- protocols/VKontakte/src/vk_chats.cpp | 48 +++++++++++++-------------- protocols/VKontakte/src/vk_dialogs.cpp | 2 +- protocols/VKontakte/src/vk_dialogs.h | 8 ++--- protocols/VKontakte/src/vk_feed.cpp | 8 ++--- protocols/VKontakte/src/vk_files.cpp | 4 +-- protocols/VKontakte/src/vk_messages.cpp | 4 +-- protocols/VKontakte/src/vk_options.cpp | 34 +++++++++---------- protocols/VKontakte/src/vk_proto.cpp | 58 ++++++++++++++++----------------- protocols/VKontakte/src/vk_proto.h | 22 ++++++------- protocols/VKontakte/src/vk_search.cpp | 44 ++++++++++++------------- protocols/VKontakte/src/vk_status.cpp | 2 +- protocols/VKontakte/src/vk_struct.cpp | 12 +++---- protocols/VKontakte/src/vk_struct.h | 30 ++++++++--------- protocols/VKontakte/src/vk_thread.cpp | 6 ++-- protocols/VKontakte/src/vk_wallpost.cpp | 2 +- 20 files changed, 168 insertions(+), 169 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 5b1f032980..ef8c14bb0c 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -56,7 +56,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO ///////////////////////////////////////////////////////////////////////////////////////// // OnLoad - initialize the plugin instance -static CVkProto* vkProtoInit(const char *pszProtoName, const TCHAR *tszUserName) +static CVkProto* vkProtoInit(const char *pszProtoName, const wchar_t *tszUserName) { CVkProto *ppro = new CVkProto(pszProtoName, tszUserName); return ppro; diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 0e835a8e35..8ac554321c 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -46,16 +46,16 @@ LPCSTR findHeader(NETLIBHTTPREQUEST *pReq, LPCSTR szField) return NULL; } -bool tlstrstr(TCHAR *_s1, TCHAR *_s2) +bool tlstrstr(wchar_t *_s1, wchar_t *_s2) { - TCHAR s1[1024], s2[1024]; + wchar_t s1[1024], s2[1024]; - _tcsncpy_s(s1, _s1, _TRUNCATE); + wcsncpy_s(s1, _s1, _TRUNCATE); CharLowerBuff(s1, _countof(s1)); - _tcsncpy_s(s2, _s2, _TRUNCATE); + wcsncpy_s(s2, _s2, _TRUNCATE); CharLowerBuff(s2, _countof(s2)); - return _tcsstr(s1, s2) != NULL; + return wcsstr(s1, s2) != NULL; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -148,7 +148,7 @@ void CVkProto::ClearAccessToken() ShutdownSession(); } -TCHAR* CVkProto::GetUserStoredPassword() +wchar_t* CVkProto::GetUserStoredPassword() { debugLogA("CVkProto::GetUserStoredPassword"); ptrA szRawPass(getStringA("Password")); @@ -677,7 +677,7 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) if (!time) return; - TCHAR ttime[64]; + wchar_t ttime[64]; _locale_t locale = _create_locale(LC_ALL, ""); _tcsftime_l(ttime, _countof(ttime), L"%X - %x", localtime(&time), locale); _free_locale(locale); @@ -955,7 +955,7 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b if (IsEmpty(ptszString)) return CMString(); - TCHAR *ptszFormat = NULL; + wchar_t *ptszFormat = NULL; for (int i = 0; i < _countof(bbcItem); i++) if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) { ptszFormat = bbcItem[i].ptszTempate; @@ -1252,7 +1252,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn } time_t datetime = (time_t)jnMsg["date"].as_int(); - TCHAR ttime[64]; + wchar_t ttime[64]; _locale_t locale = _create_locale(LC_ALL, ""); _tcsftime_l(ttime, _countof(ttime), L"%x %X", localtime(&datetime), locale); _free_locale(locale); @@ -1276,7 +1276,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn } tszBody.Replace(L"\n", L"\n\t"); - TCHAR tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' '; + wchar_t tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' '; CMString tszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n", SetBBCString(TranslateT("Message from"), iBBC, vkbbcB), SetBBCString(tszNick, iBBC, vkbbcUrl, tszUrl), @@ -1286,7 +1286,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn SetBBCString(tszBody, iBBC, vkbbcCode)); if (!res.IsEmpty()) - res.AppendChar(_T('\n')); + res.AppendChar('\n'); res += tszMes; } @@ -1312,14 +1312,14 @@ void CVkProto::SetInvisible(MCONTACT hContact) CMString CVkProto::RemoveBBC(CMString& tszSrc) { - static const TCHAR *tszSimpleBBCodes[][2] = { + static const wchar_t *tszSimpleBBCodes[][2] = { { L"[b]", L"[/b]" }, { L"[u]", L"[/u]" }, { L"[i]", L"[/i]" }, { L"[s]", L"[/s]" }, }; - static const TCHAR *tszParamBBCodes[][2] = { + static const wchar_t *tszParamBBCodes[][2] = { { L"[url=", L"[/url]" }, { L"[img=", L"[/img]" }, { L"[size=", L"[/size]" }, @@ -1392,13 +1392,13 @@ CMString CVkProto::RemoveBBC(CMString& tszSrc) void CVkProto::ShowCaptchaInBrowser(HBITMAP hBitmap) { - TCHAR tszTempDir[MAX_PATH]; + wchar_t tszTempDir[MAX_PATH]; if (!GetEnvironmentVariable(L"TEMP", tszTempDir, MAX_PATH)) return; CMString tszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", tszTempDir); - FILE *pFile = _tfopen(tszHTMLPath, L"w"); + FILE *pFile = _wfopen(tszHTMLPath, L"w"); if (pFile == NULL) return; diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index a5e441027e..c78a27b0cc 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -21,7 +21,6 @@ along with this program. If not, see . #include #include -#include #include #include diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index feddbdcc82..008541791c 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -97,7 +97,7 @@ extern mir_cs csInstances; extern HINSTANCE hInst; LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField); -bool tlstrstr(TCHAR *_s1, TCHAR *_s2); +bool tlstrstr(wchar_t *_s1, wchar_t *_s2); void InitIcons(void); HANDLE GetIconHandle(int iCommand); diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 38cb5d7057..a2ada3e6d0 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -27,7 +27,7 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) GetAvatarFileName(param->hContact, ai.filename, _countof(ai.filename)); ai.format = ProtoGetBufferFormat(reply->pData); - FILE *out = _tfopen(ai.filename, L"wb"); + FILE *out = _wfopen(ai.filename, L"wb"); if (out == NULL) { ProtoBroadcastAck(param->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai); delete param; @@ -85,13 +85,13 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) if (szUrl == NULL) return GAIR_NOAVATAR; - TCHAR tszFileName[MAX_PATH]; + wchar_t tszFileName[MAX_PATH]; GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName)); - _tcsncpy(pai->filename, tszFileName, _countof(pai->filename)); + wcsncpy(pai->filename, tszFileName, _countof(pai->filename)); pai->format = ProtoGetAvatarFormat(pai->filename); - if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar")) + if (::_waccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar")) return GAIR_SUCCESS; if (IsOnline()) { @@ -119,16 +119,16 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) if (SvcGetAvatarInfo(0, (LPARAM)&ai) != GAIR_SUCCESS) return 1; - TCHAR *buf = (TCHAR*)wParam; + wchar_t *buf = (wchar_t*)wParam; int size = (int)lParam; - _tcsncpy(buf, ai.filename, size); + wcsncpy(buf, ai.filename, size); buf[size - 1] = 0; return 0; } -void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen) +void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); @@ -138,10 +138,10 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen pszDest[tPathLen++] = '\\'; - const TCHAR *szFileType = L".jpg"; + const wchar_t *szFileType = L".jpg"; ptrT szUrl(getTStringA(hContact, "AvatarUrl")); if (szUrl) { - TCHAR *p = _tcsrchr(szUrl, '.'); + wchar_t *p = wcsrchr(szUrl, '.'); if (p != NULL) szFileType = p; } diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index d931c85be0..10726e6842 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[] = { LPGENT("Participants"), LPGENT("Owners") }; +static LPCTSTR sttStatuses[] = { LPGENW("Participants"), LPGENW("Owners") }; extern JSONNode nullNode; @@ -170,8 +170,8 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe break; int uid = jnUser["id"].as_int(); - TCHAR tszId[20]; - _itot(uid, tszId, 10); + wchar_t tszId[20]; + _itow(uid, tszId, 10); bool bNew; CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid); @@ -209,8 +209,8 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (!cu.m_bDel) continue; - TCHAR tszId[20]; - _itot(cu.m_uid, tszId, 10); + wchar_t tszId[20]; + _itow(cu.m_uid, tszId, 10); GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_PART }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; @@ -341,7 +341,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & } else { int a_uid = 0; - int iReadCount = _stscanf(tszActionMid, L"%d", &a_uid); + int iReadCount = swscanf(tszActionMid, L"%d", &a_uid); if (iReadCount == 1) { CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid); if (cu == NULL) @@ -364,7 +364,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & tszBody.AppendFormat(L" (https://vk.com/id%s) %s", tszUid, TranslateT("returned to chat")); else { int a_uid = 0; - int iReadCount = _stscanf(tszActionMid, L"%d", &a_uid); + int iReadCount = swscanf(tszActionMid, L"%d", &a_uid); if (iReadCount == 1) { CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid); if (cu == NULL) @@ -424,8 +424,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR cu->m_bUnknown = true; } - TCHAR tszId[20]; - _itot(uid, tszId, 10); + wchar_t tszId[20]; + _itow(uid, tszId, 10); GCDEST gcd = { m_szModuleName, cc->m_tszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; @@ -434,7 +434,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR gce.time = msgTime; gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG; gce.ptszNick = cu->m_tszNick ? mir_tstrdup(cu->m_tszNick) : mir_tstrdup(hContact ? ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")); - gce.ptszText = IsEmpty((TCHAR *)ptszBody) ? mir_tstrdup(L"...") : mir_tstrdup(ptszBody); + gce.ptszText = IsEmpty((wchar_t *)ptszBody) ? mir_tstrdup(L"...") : mir_tstrdup(ptszBody); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); StopChatContactTyping(cc->m_chatid, uid); } @@ -469,9 +469,9 @@ void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus) ///////////////////////////////////////////////////////////////////////////////////////// -TCHAR* UnEscapeChatTags(TCHAR *str_in) +wchar_t* UnEscapeChatTags(wchar_t *str_in) { - TCHAR *s = str_in, *d = str_in; + wchar_t *s = str_in, *d = str_in; while (*s) { if (*s == '%' && s[1] == '%') s++; @@ -506,13 +506,13 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS: { - MCONTACT hContact = FindUser(_ttoi(gch->ptszUID)); + MCONTACT hContact = FindUser(_wtoi(gch->ptszUID)); if (hContact == NULL) { - hContact = FindUser(_ttoi(gch->ptszUID), true); + hContact = FindUser(_wtoi(gch->ptszUID), true); db_set_b(hContact, "CList", "Hidden", 1); db_set_b(hContact, "CList", "NotOnList", 1); db_set_dw(hContact, "Ignore", "Mask1", 0); - RetrieveUserInfo(_ttoi(gch->ptszUID)); + RetrieveUserInfo(_wtoi(gch->ptszUID)); } CallService(MS_MSG_SENDMESSAGET, hContact); } @@ -796,8 +796,8 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_NICK }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; - TCHAR tszId[20]; - _itot(cu->m_uid, tszId, 10); + wchar_t tszId[20]; + _itow(cu->m_uid, tszId, 10); gce.ptszNick = mir_tstrdup(cu->m_tszNick); gce.bIsMe = (cu->m_uid == m_myUserId); @@ -829,18 +829,18 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) static gc_item sttLogListItems[] = { - { LPGENT("&Invite a user"), IDM_INVITE, MENU_ITEM }, - { LPGENT("View/change &title"), IDM_TOPIC, MENU_ITEM }, + { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM }, + { LPGENW("View/change &title"), IDM_TOPIC, MENU_ITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("&Destroy room"), IDM_DESTROY, MENU_ITEM } + { LPGENW("&Destroy room"), IDM_DESTROY, MENU_ITEM } }; static gc_item sttListItems[] = { - { LPGENT("&User details"), IDM_INFO, MENU_ITEM }, - { LPGENT("Visit profile"), IDM_VISIT_PROFILE, MENU_ITEM }, - { LPGENT("Change nick"), IDM_CHANGENICK, MENU_ITEM }, - { LPGENT("&Kick"), IDM_KICK, MENU_ITEM } + { LPGENW("&User details"), IDM_INFO, MENU_ITEM }, + { LPGENW("Visit profile"), IDM_VISIT_PROFILE, MENU_ITEM }, + { LPGENW("Change nick"), IDM_CHANGENICK, MENU_ITEM }, + { LPGENW("&Kick"), IDM_KICK, MENU_ITEM } }; int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam) diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 9e6ba15815..5c119b5d5b 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -160,7 +160,7 @@ 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)) { - TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); + wchar_t *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); m_cbxCombo.AddString(ptszNick, hContact); } } diff --git a/protocols/VKontakte/src/vk_dialogs.h b/protocols/VKontakte/src/vk_dialogs.h index 45272b285c..32ee12608f 100644 --- a/protocols/VKontakte/src/vk_dialogs.h +++ b/protocols/VKontakte/src/vk_dialogs.h @@ -52,12 +52,12 @@ public: struct WALLPOST_FORM_PARAMS { - TCHAR *ptszMsg; - TCHAR *ptszUrl; - TCHAR *ptszNick; + wchar_t *ptszMsg; + wchar_t *ptszUrl; + wchar_t *ptszNick; bool bFriendsOnly; - WALLPOST_FORM_PARAMS(TCHAR *nick) : + WALLPOST_FORM_PARAMS(wchar_t *nick) : ptszNick(nick), bFriendsOnly(false) { diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 2bc441d403..be5b0eed16 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -84,7 +84,7 @@ void CVkProto::AddCListEvent(bool bNews) cle.flags = CLEF_URGENT | CLEF_TCHAR; cle.hContact = hContact; cle.hDbEvent = NULL; - TCHAR toolTip[255]; + wchar_t toolTip[255]; mir_sntprintf(toolTip, bNews ? TranslateT("New news") : TranslateT("New notifications")); cle.ptszTooltip = toolTip; pcli->pfnAddEvent(&cle); @@ -238,9 +238,9 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLISTtszId.AppendFormat(L"%d_%d", vkNewsItem->vkUser->m_UserId, iPostId); if (bPostLink) { vkNewsItem->tszLink = CMString(L"https://vk.com/wall") + vkNewsItem->tszId; - vkNewsItem->tszText.AppendChar(_T('\n')); + vkNewsItem->tszText.AppendChar('\n'); vkNewsItem->tszText += SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNewsItem->tszLink); } diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index cb1e0bc607..59738aab54 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . #include "stdafx.h" -HANDLE CVkProto::SendFile(MCONTACT hContact, const TCHAR *desc, TCHAR **files) +HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **files) { debugLogA("CVkProto::SendFile"); @@ -155,7 +155,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * return; } - FILE *pFile = _tfopen(fup->FileName, L"rb"); + FILE *pFile = _wfopen(fup->FileName, L"rb"); if (pFile == NULL) { SendFileFiled(fup, VKERR_ERR_OPEN_FILE); return; diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index bdb6bdc3b0..8e0907cb20 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -104,7 +104,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) UINT mid; if (jnResponse.type() != JSON_STRING) mid = jnResponse.as_int(); - else if (_stscanf(jnResponse.as_mstring(), L"%d", &mid) != 1) + else if (swscanf(jnResponse.as_mstring(), L"%d", &mid) != 1) mid = 0; if (param->iMsgID != -1) @@ -281,7 +281,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (chat_id != 0) { debugLogA("CVkProto::OnReceiveMessages chat_id != 0"); CMString action_chat = jnMsg["action"].as_mstring(); - int action_mid = _ttoi(jnMsg["action_mid"].as_mstring()); + int action_mid = _wtoi(jnMsg["action_mid"].as_mstring()); if ((action_chat == "chat_kick_user") && (action_mid == m_myUserId)) KickFromChat(chat_id, uid, jnMsg, jnFUsers); else { diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index b2b6d7233a..aedf678894 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -74,32 +74,32 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - odp.ptszGroup = LPGENT("Network"); + odp.pwszGroup = LPGENW("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszTab = LPGENW("Account"); odp.position = 1; odp.pDialog = new CVkOptionAccountForm(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Advanced"); + odp.pwszTab = LPGENW("Advanced"); odp.position = 2; odp.pDialog = new CVkOptionAdvancedForm(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("News and notifications"); + odp.pwszTab = LPGENW("News and notifications"); odp.position = 3; odp.pDialog = new CVkOptionFeedsForm(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("View"); + odp.pwszTab = LPGENW("View"); odp.position = 4; odp.pDialog = new CVkOptionViewForm(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Menu"); + odp.pwszTab = LPGENW("Menu"); odp.position = 5; odp.pDialog = new CVkOptionMenuForm(this); Options_AddPage(wParam, &odp); @@ -110,15 +110,15 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) ////////////////////// Account page ////////////////////////////////////////// static CVKLang vkLangCodes[] = { - { NULL, LPGENT("Account language") }, - { L"en", LPGENT("English") }, - { L"ru", LPGENT("Russian") }, - { L"be", LPGENT("Belarusian") }, - { L"ua", LPGENT("Ukrainian") }, - { L"es", LPGENT("Spanish") }, - { L"fi", LPGENT("Finnish") }, - { L"de", LPGENT("German") }, - { L"it", LPGENT("Italian") }, + { NULL, LPGENW("Account language") }, + { L"en", LPGENW("English") }, + { L"ru", LPGENW("Russian") }, + { L"be", LPGENW("Belarusian") }, + { L"ua", LPGENW("Ukrainian") }, + { L"es", LPGENW("Spanish") }, + { L"fi", LPGENW("Finnish") }, + { L"de", LPGENW("German") }, + { L"it", LPGENW("Italian") }, }; static CVKSync vkHistorySyncMethods[] = @@ -192,7 +192,7 @@ 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 = (TCHAR *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel()); + m_proto->m_vkOptions.ptszVKLang = (wchar_t *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel()); ptrT ptszGroupName(m_edtGroupName.GetText()); if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) { diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index f7c5c77900..a31f4658a2 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -33,7 +33,7 @@ LIST vk_Instances(1, sttCompareProtocols); mir_cs csInstances; static COLORREF sttColors[] = { 0, 1, 2, 3, 4, 5, 6 }; -CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : +CVkProto::CVkProto(const char *szModuleName, const wchar_t *ptszUserName) : PROTO(szModuleName, ptszUserName), m_arRequestsQueue(10, sttCompareAsyncHttpRequest), m_sendIds(3, PtrKeySortT), @@ -61,7 +61,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit); - TCHAR descr[512]; + wchar_t descr[512]; mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName); NETLIBUSER nlu = {sizeof(nlu)}; @@ -120,7 +120,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CVkProto::OnDbEventRead); HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged); //Sounds - SkinAddNewSoundExT("VKNewsFeed", m_tszUserName, LPGENT("VKontakte newsfeed & notification event")); + SkinAddNewSoundExT("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event")); InitPopups(); InitMenus(); @@ -233,70 +233,70 @@ void CVkProto::InitMenus() mi.pszService = PS_VISITPROFILE; mi.position = -200001000 + CMI_VISITPROFILE; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_VISITPROFILE)); - mi.name.t = LPGENT("Visit profile"); + mi.name.w = LPGENW("Visit profile"); SET_UID(mi, 0x828cc50e, 0x398d, 0x43a2, 0xbf, 0xd3, 0xa9, 0x96, 0x47, 0x9d, 0x52, 0xff); m_hContactMenuItems[CMI_VISITPROFILE] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_MARKMESSAGESASREAD; mi.position = -200001000 + CMI_MARKMESSAGESASREAD; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_MARKMESSAGESASREAD)); - mi.name.t = LPGENT("Mark messages as read"); + mi.name.w = LPGENW("Mark messages as read"); SET_UID(mi, 0x2587a649, 0xe5d5, 0x4e90, 0x8b, 0x35, 0x81, 0x4c, 0xb1, 0x5, 0x94, 0x7); m_hContactMenuItems[CMI_MARKMESSAGESASREAD] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_WALLPOST; mi.position = -200001000 + CMI_WALLPOST; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL)); - mi.name.t = LPGENT("Send message to user\'s wall"); + mi.name.w = LPGENW("Send message to user\'s wall"); SET_UID(mi, 0xd8841aaf, 0x15f6, 0x4be9, 0x9f, 0x4f, 0x16, 0xa9, 0x47, 0x6a, 0x19, 0x81); m_hContactMenuItems[CMI_WALLPOST] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_ADDASFRIEND; mi.position = -200001000 + CMI_ADDASFRIEND; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDADD)); - mi.name.t = LPGENT("Add as friend"); + mi.name.w = LPGENW("Add as friend"); SET_UID(mi, 0xf11b9a7f, 0x569, 0x4023, 0xb0, 0xd6, 0xa3, 0x16, 0xf6, 0xd4, 0xfb, 0xb5); m_hContactMenuItems[CMI_ADDASFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_DELETEFRIEND; mi.position = -200001000 + CMI_DELETEFRIEND; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL)); - mi.name.t = LPGENT("Delete from friend list"); + mi.name.w = LPGENW("Delete from friend list"); SET_UID(mi, 0x1e26514, 0x854f, 0x4e60, 0x8c, 0xf8, 0xab, 0xaa, 0xe0, 0xc3, 0xa5, 0xa7); m_hContactMenuItems[CMI_DELETEFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_BANUSER; mi.position = -200001000 + CMI_BANUSER; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_BAN)); - mi.name.t = LPGENT("Ban user"); + mi.name.w = LPGENW("Ban user"); SET_UID(mi, 0x7ba06bab, 0xf770, 0x4938, 0x9c, 0x76, 0xef, 0x40, 0xbc, 0x55, 0x0, 0x9b); m_hContactMenuItems[CMI_BANUSER] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_REPORTABUSE; mi.position = -200001000 + CMI_REPORTABUSE; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_ABUSE)); - mi.name.t = LPGENT("Report abuse"); + mi.name.w = LPGENW("Report abuse"); SET_UID(mi, 0x56454cb9, 0xd80, 0x4050, 0xbe, 0xfc, 0x2c, 0xf6, 0x10, 0x2a, 0x7d, 0x19); m_hContactMenuItems[CMI_REPORTABUSE] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_DESTROYKICKCHAT; mi.position = -200001000 + CMI_DESTROYKICKCHAT; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL)); - mi.name.t = LPGENT("Destroy room"); + mi.name.w = LPGENW("Destroy room"); SET_UID(mi, 0x4fa6e75a, 0x30cd, 0x4482, 0xae, 0x8f, 0x0, 0x38, 0xd0, 0x17, 0x33, 0xcd); m_hContactMenuItems[CMI_DESTROYKICKCHAT] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_OPENBROADCAST; mi.position = -200001000 + CMI_OPENBROADCAST; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_BROADCAST)); - mi.name.t = LPGENT("Open broadcast"); + mi.name.w = LPGENW("Open broadcast"); SET_UID(mi, 0x85251a06, 0xf734, 0x4985, 0x8c, 0x36, 0x6f, 0x66, 0x46, 0xf9, 0xa0, 0x10); m_hContactMenuItems[CMI_OPENBROADCAST] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_LOADVKNEWS; mi.position = -200001000 + CMI_LOADVKNEWS; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION)); - mi.name.t = LPGENT("Load news from VK"); + mi.name.w = LPGENW("Load news from VK"); SET_UID(mi, 0xe1f6888b, 0x21ae, 0x409f, 0x82, 0xa2, 0x7b, 0x72, 0xef, 0x47, 0x9, 0xc0); m_hContactMenuItems[CMI_LOADVKNEWS] = Menu_AddContactMenuItem(&mi, m_szModuleName); @@ -304,7 +304,7 @@ void CVkProto::InitMenus() mi.pszService = PS_GETSERVERHISTORY; mi.position = -200001000 + CMI_GETSERVERHISTORY; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("Reload messages from vk.com..."); + mi.name.w = LPGENW("Reload messages from vk.com..."); SET_UID(mi, 0xc6b59e9f, 0x5250, 0x4146, 0xb6, 0xf3, 0x2d, 0xe1, 0x4, 0x3b, 0x95, 0xf5); m_hContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi, m_szModuleName); @@ -313,42 +313,42 @@ void CVkProto::InitMenus() mi.pszService = PS_GETSERVERHISTORYLAST1DAY; mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST1DAY; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("for last 1 day"); + mi.name.w = LPGENW("for last 1 day"); SET_UID(mi, 0x508dce88, 0x1a9a, 0x4dd7, 0x90, 0xf4, 0x41, 0x35, 0x7b, 0xc3, 0x17, 0xed); m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST1DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_GETSERVERHISTORYLAST3DAY; mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST3DAY; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("for last 3 days"); + mi.name.w = LPGENW("for last 3 days"); SET_UID(mi, 0x9a878764, 0x5bbf, 0x433a, 0xbd, 0x50, 0xa9, 0xb9, 0x16, 0x1f, 0x99, 0x29); m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST3DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_GETSERVERHISTORYLAST7DAY; mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST7DAY; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("for last week"); + mi.name.w = LPGENW("for last week"); SET_UID(mi, 0xc6482460, 0xd280, 0x4596, 0x97, 0x4b, 0xf7, 0xfa, 0x6d, 0xe, 0xd5, 0xda); m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST7DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_GETSERVERHISTORYLAST30DAY; mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST30DAY; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("for last 30 days"); + mi.name.w = LPGENW("for last 30 days"); SET_UID(mi, 0xc48e8a9f, 0x2860, 0x4d5b, 0xa8, 0xdf, 0xb8, 0x3f, 0xdf, 0x7b, 0xa2, 0xba); m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST30DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_GETSERVERHISTORYLAST90DAY; mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST90DAY; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("for last 90 days"); + mi.name.w = LPGENW("for last 90 days"); SET_UID(mi, 0xd8e30530, 0xa585, 0x4672, 0xa6, 0x39, 0x18, 0xc9, 0xc9, 0xcb, 0xc7, 0x7d); m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST90DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName); mi.pszService = PS_GETALLSERVERHISTORYFORCONTACT; mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETALLSERVERHISTORYFORCONTACT; mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY)); - mi.name.t = LPGENT("for all time"); + mi.name.w = LPGENW("for all time"); SET_UID(mi, 0xaee3d02b, 0x3667, 0x47c8, 0x9f, 0x43, 0x14, 0xb7, 0xab, 0x52, 0x14, 0x94); m_hContactHistoryMenuItems[CHMI_GETALLSERVERHISTORYFORCONTACT] = Menu_AddContactMenuItem(&mi, m_szModuleName); } @@ -418,7 +418,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa void CVkProto::InitPopups(void) { - TCHAR desc[256]; + wchar_t desc[256]; char name[256]; POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; @@ -446,14 +446,14 @@ void CVkProto::InitPopups(void) m_hPopupClassNotification = Popup_RegisterClass(&ppc); } -void CVkProto::MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle, bool err) +void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle, bool err) { if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { char name[256]; POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.ptszTitle = szTitle; - ppd.ptszText = szMsg; + ppd.pwszTitle = szTitle; + ppd.pwszText = szMsg; ppd.pszClassName = name; ppd.hContact = hContact; ppd.PluginData = new CVkSendMsgParam(hContact); @@ -534,7 +534,7 @@ MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT *psr) { debugLogA("CVkProto::AddToList"); - int uid = _ttoi(psr->id.t); + int uid = _wtoi(psr->id.w); if (!uid) return NULL; @@ -543,7 +543,7 @@ MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT *psr) return hContact; } -int CVkProto::AuthRequest(MCONTACT hContact, const TCHAR *message) +int CVkProto::AuthRequest(MCONTACT hContact, const wchar_t *message) { debugLogA("CVkProto::AuthRequest"); if (!IsOnline()) @@ -553,9 +553,9 @@ int CVkProto::AuthRequest(MCONTACT hContact, const TCHAR *message) if (userID == -1 || !hContact || userID == VK_FEED_USER) return 1; - TCHAR msg[501] = {0}; + wchar_t msg[501] = {0}; if (message) - _tcsncpy_s(msg, 500, message, _TRUNCATE); + wcsncpy_s(msg, 500, message, _TRUNCATE); Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/friends.add.json", true, &CVkProto::OnReceiveAuthRequest) << INT_PARAM("user_id", userID) @@ -616,7 +616,7 @@ int CVkProto::Authorize(MEVENT hDbEvent) return AuthRequest(hContact, NULL); } -int CVkProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) +int CVkProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) { debugLogA("CVkProto::AuthDeny"); if (!IsOnline()) diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index ce1f7f02ed..0b8e5b5962 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -45,7 +45,7 @@ along with this program. If not, see . struct CVkProto : public PROTO { - CVkProto(const char*, const TCHAR*); + CVkProto(const char*, const wchar_t*); ~CVkProto(); //==================================================================================== @@ -54,16 +54,16 @@ struct CVkProto : public PROTO virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr); virtual int __cdecl Authorize(MEVENT hDbEvent); - virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); - virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason); + virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage); virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); virtual int __cdecl GetInfo(MCONTACT hContact, int infoType); - virtual HANDLE __cdecl SearchBasic(const TCHAR *id); - virtual HANDLE __cdecl SearchByEmail(const TCHAR *email); - virtual HANDLE __cdecl SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName); + virtual HANDLE __cdecl SearchBasic(const wchar_t *id); + virtual HANDLE __cdecl SearchByEmail(const wchar_t *email); + virtual HANDLE __cdecl SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName); virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg); - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles); virtual int __cdecl SetStatus(int iNewStatus); virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); @@ -118,7 +118,7 @@ struct CVkProto : public PROTO __forceinline bool IsOnline() const { return m_bOnline; } void OnTimerTic(); void ClearAccessToken(); - TCHAR* GetUserStoredPassword(void); + wchar_t* GetUserStoredPassword(void); void ShowCaptchaInBrowser(HBITMAP hBitmap); static mir_cs m_csTimer; @@ -232,7 +232,7 @@ private: //==== PopUps ======================================================================== void InitPopups(void); - void MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle, bool err = false); + void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle, bool err = false); //==== Hooks ========================================================================= @@ -302,7 +302,7 @@ private: void OnReceiveMessages(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnReceiveDlgs(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnSendMessage(NETLIBHTTPREQUEST*, AsyncHttpRequest*); - void WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly); + void WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, 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); @@ -358,7 +358,7 @@ private: void OnLoggedOut(); void ShutdownSession(); void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl); - void GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen); + void GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen); void ReloadAvatarInfo(MCONTACT hContact); void __cdecl SendMsgAck(void *param); void __cdecl ChatContactTypingThread(void *p); diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index bc5ebb88d2..c19c3610bf 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -17,19 +17,19 @@ along with this program. If not, see . #include "stdafx.h" -HANDLE CVkProto::SearchBasic(const TCHAR *id) +HANDLE CVkProto::SearchBasic(const wchar_t *id) { ForkThread(&CVkProto::SearchBasicThread, (void *)id); return (HANDLE)1; } -HANDLE CVkProto::SearchByEmail(const TCHAR *email) +HANDLE CVkProto::SearchByEmail(const wchar_t *email) { ForkThread(&CVkProto::SearchByMailThread, (void *)email); return (HANDLE)1; } -HANDLE CVkProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName) +HANDLE CVkProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) { PROTOSEARCHBYNAME *psr = new (PROTOSEARCHBYNAME); @@ -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", (TCHAR *)id) + << TCHAR_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", (TCHAR *)email) + << TCHAR_PARAM("contacts", (wchar_t *)email) << CHAR_PARAM("service", "email"); Push(pReq); } @@ -68,14 +68,14 @@ void __cdecl CVkProto::SearchThread(void *p) { PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p; - TCHAR arg[200]; + wchar_t arg[200]; mir_sntprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName); debugLog(L"CVkProto::SearchThread %s", arg); if (!IsOnline()) return; AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/users.search.json", true, &CVkProto::OnSearch) - << TCHAR_PARAM("q", (TCHAR *)arg) + << TCHAR_PARAM("q", (wchar_t *)arg) << CHAR_PARAM("fields", "nickname, domain") << INT_PARAM("count", 200); pReq->pUserInfo = p; @@ -126,19 +126,19 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring()); CMString Domain(jnRecord["domain"].as_mstring()); - psr.id.t = mir_tstrdup(Id); - psr.firstName.t = mir_tstrdup(FirstName); - psr.lastName.t = mir_tstrdup(LastName); - psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick); + psr.id.w = mir_tstrdup(Id); + psr.firstName.w = mir_tstrdup(FirstName); + psr.lastName.w = mir_tstrdup(LastName); + psr.nick.w = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick); bool filter = true; if (pParam) { - if (psr.firstName.t && pParam->pszFirstName) - filter = tlstrstr(psr.firstName.t, pParam->pszFirstName) && filter; - if (psr.lastName.t && pParam->pszLastName) - filter = tlstrstr(psr.lastName.t, pParam->pszLastName) && filter; - if (psr.nick.t && pParam->pszNick) - filter = tlstrstr(psr.nick.t, pParam->pszNick) && filter; + if (psr.firstName.w && pParam->pszFirstName) + filter = tlstrstr(psr.firstName.w, pParam->pszFirstName) && filter; + if (psr.lastName.w && pParam->pszLastName) + filter = tlstrstr(psr.lastName.w, pParam->pszLastName) && filter; + if (psr.nick.w && pParam->pszNick) + filter = tlstrstr(psr.nick.w, pParam->pszNick) && filter; } if (filter) @@ -184,11 +184,11 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring()); CMString Email(jnRecord["contact"].as_mstring()); - psr.id.t = mir_tstrdup(Id); - psr.firstName.t = mir_tstrdup(FirstName); - psr.lastName.t = mir_tstrdup(LastName); - psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick); - psr.email.t = mir_tstrdup(Email); + psr.id.w = mir_tstrdup(Id); + psr.firstName.w = mir_tstrdup(FirstName); + psr.lastName.w = mir_tstrdup(LastName); + psr.nick.w = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick); + psr.email.w = mir_tstrdup(Email); ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); } diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 8a3566270c..add498f486 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -160,7 +160,7 @@ void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnAudio = jnResponse["audio"]; if (!jnAudio) { CMString tszStatusText(jnResponse["text"].as_mstring()); - if (tszStatusText[0] != TCHAR(9835)) + if (tszStatusText[0] != wchar_t(9835)) setTString("OldStatusMsg", tszStatusText); } } diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index ad7ff94525..a1d074a9ad 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -98,7 +98,7 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr) ///////////////////////////////////////////////////////////////////////////////////////// -CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const TCHAR *_desc, TCHAR **_files) : +CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const wchar_t *_desc, wchar_t **_files) : hContact(_hContact), Desc(mir_tstrdup(_desc)), FileName(mir_tstrdup(_files[0])), @@ -125,11 +125,11 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() if (fname) mir_free(fname); - TCHAR img[] = L".jpg .jpeg .png .bmp"; - TCHAR audio[] = L".mp3"; + wchar_t img[] = L".jpg .jpeg .png .bmp"; + wchar_t audio[] = L".mp3"; - TCHAR DRIVE[3], DIR[256], FNAME[256], EXT[256]; - _tsplitpath(FileName, DRIVE, DIR, FNAME, EXT); + wchar_t DRIVE[3], DIR[256], FNAME[256], EXT[256]; + _wsplitpath(FileName, DRIVE, DIR, FNAME, EXT); T2Utf pszFNAME(FNAME), pszEXT(EXT); CMStringA fn(FORMAT, "%s%s", pszFNAME, pszEXT); @@ -155,7 +155,7 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() CVkChatUser* CVkChatInfo::GetUserById(LPCTSTR ptszId) { - int user_id = _ttoi(ptszId); + int user_id = _wtoi(ptszId); return m_users.find((CVkChatUser*)&user_id); } diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 5d084189e6..86cee657fe 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -81,17 +81,17 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest*, const TCHAR_PARAM&); struct CVkFileUploadParam : public MZeroedObject { enum VKFileType { typeInvalid, typeImg, typeAudio, typeDoc, typeNotSupported }; - TCHAR *FileName; - TCHAR *Desc; + wchar_t *FileName; + wchar_t *Desc; char *atr; char *fname; MCONTACT hContact; VKFileType filetype; - CVkFileUploadParam(MCONTACT _hContact, const TCHAR *_desc, TCHAR **_files); + CVkFileUploadParam(MCONTACT _hContact, const wchar_t *_desc, wchar_t **_files); ~CVkFileUploadParam(); VKFileType GetType(); - __forceinline bool IsAccess() { return ::_taccess(FileName, 0) == 0; } + __forceinline bool IsAccess() { return ::_waccess(FileName, 0) == 0; } __forceinline char* atrName() { GetType(); return atr; } __forceinline char* fileName() { GetType(); return fname; } }; @@ -203,9 +203,9 @@ struct CVkUserInfo : public MZeroedObject { enum VKObjType { vkNull, vkPost, vkPhoto, vkVideo, vkComment, vkTopic, vkUsers, vkCopy, vkInvite }; struct CVKNotification { - TCHAR *ptszType; + wchar_t *ptszType; VKObjType vkParent, vkFeedback; - TCHAR *ptszTranslate; + wchar_t *ptszTranslate; }; struct CVKNewsItem : public MZeroedObject { @@ -237,7 +237,7 @@ enum BBCSupport : BYTE { bbcNo, bbcBasic, bbcAdvanced }; struct CVKBBCItem { VKBBCType vkBBCType; BBCSupport vkBBCSettings; - TCHAR *ptszTempate; + wchar_t *ptszTempate; }; struct CVKChatContactTypingParam { @@ -252,12 +252,12 @@ struct CVKChatContactTypingParam { struct CVKInteres { const char *szField; - TCHAR *ptszTranslate; + wchar_t *ptszTranslate; }; struct CVKLang { - TCHAR *szCode; - TCHAR *szDescription; + wchar_t *szCode; + wchar_t *szDescription; }; enum MarkMsgReadOn : BYTE { markOnRead, markOnReceive, markOnReply, markOnTyping }; @@ -266,12 +266,12 @@ enum MusicSendMetod : BYTE { sendNone, sendStatusOnly, sendBroadcastOnly, sendBr enum IMGBBCSypport : BYTE { imgNo, imgFullSize, imgPreview130, imgPreview604 }; struct CVKSync { - const TCHAR *type; + const wchar_t *type; SyncHistoryMetod data; }; struct CVKMarkMsgRead { - const TCHAR *type; + const wchar_t *type; MarkMsgReadOn data; }; @@ -351,9 +351,9 @@ struct CVKOptions { CMOption iInvisibleInterval; CMOption iMaxFriendsCount; - CMOption ptszDefaultGroup; - CMOption ptszReturnChatMessage; - CMOption ptszVKLang; + CMOption ptszDefaultGroup; + CMOption ptszReturnChatMessage; + CMOption ptszVKLang; CVKOptions(PROTO_INTERFACE *proto); diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 2f2dcdae8b..185f52e583 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -297,7 +297,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) tszValue = jnItem["bdate"].as_mstring(); if (!tszValue.IsEmpty()) { int d, m, y, iReadCount; - iReadCount = _stscanf(tszValue, L"%d.%d.%d", &d, &m, &y); + iReadCount = swscanf(tszValue, L"%d.%d.%d", &d, &m, &y); if (iReadCount > 1) { if (iReadCount == 3) setWord(hContact, "BirthYear", y); @@ -330,7 +330,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)time(NULL)); db_set_dw(hContact, "BuddyExpectator", "LastStatus", ID_STATUS_ONLINE); - int online_app = _ttoi(jnItem["online_app"].as_mstring()); + int online_app = _wtoi(jnItem["online_app"].as_mstring()); int online_mobile = jnItem["online_mobile"].as_int(); if (online_app == 0 && online_mobile == 0) @@ -368,7 +368,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) setTString(hContact, "AudioUrl", jnAudio["url"].as_mstring()); } } - else if (tszValue[0] == TCHAR(9835) && tszValue.GetLength() > 2) { + else if (tszValue[0] == wchar_t(9835) && tszValue.GetLength() > 2) { setTString(hContact, "ListeningTo", &(tszValue.GetBuffer())[2]); db_unset(hContact, m_szModuleName, "AudioUrl"); } diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp index 3dc00b686f..5871dbcff3 100644 --- a/protocols/VKontakte/src/vk_wallpost.cpp +++ b/protocols/VKontakte/src/vk_wallpost.cpp @@ -30,7 +30,7 @@ INT_PTR __cdecl CVkProto::SvcWallPost(WPARAM hContact, LPARAM) return 0; } -void CVkProto::WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly) +void CVkProto::WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, bool bFriendsOnly) { debugLogA("CVkProto::WallPost"); if (!IsOnline() || (IsEmpty(ptszMsg) && IsEmpty(ptszUrl))) -- cgit v1.2.3