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/SkypeWeb/src/skype_avatars.cpp | 22 ++++++++-------- protocols/SkypeWeb/src/skype_chatrooms.cpp | 40 +++++++++++++++--------------- protocols/SkypeWeb/src/skype_db.h | 4 +-- protocols/SkypeWeb/src/skype_dialogs.cpp | 2 +- protocols/SkypeWeb/src/skype_events.cpp | 4 +-- protocols/SkypeWeb/src/skype_files.cpp | 6 ++--- protocols/SkypeWeb/src/skype_icons.cpp | 20 +++++++-------- protocols/SkypeWeb/src/skype_login.cpp | 2 +- protocols/SkypeWeb/src/skype_menus.cpp | 10 ++++---- protocols/SkypeWeb/src/skype_messages.cpp | 10 ++++---- protocols/SkypeWeb/src/skype_options.cpp | 6 ++--- protocols/SkypeWeb/src/skype_popups.cpp | 10 ++++---- protocols/SkypeWeb/src/skype_profile.cpp | 8 +++--- protocols/SkypeWeb/src/skype_proto.cpp | 18 +++++++------- protocols/SkypeWeb/src/skype_proto.h | 40 +++++++++++++++--------------- protocols/SkypeWeb/src/skype_search.cpp | 4 +-- protocols/SkypeWeb/src/skype_utils.cpp | 26 +++++++++---------- protocols/SkypeWeb/src/skype_utils.h | 4 +-- protocols/SkypeWeb/src/stdafx.h | 1 + 19 files changed, 119 insertions(+), 118 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 26ef2bcb81..d2c766c4e1 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -68,7 +68,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) setByte(hContact, "AvatarType", ai.format); GetAvatarFileName(hContact, ai.filename, _countof(ai.filename)); - FILE *out = _tfopen(ai.filename, L"wb"); + FILE *out = _wfopen(ai.filename, L"wb"); if (out == NULL) { ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0); return; @@ -100,11 +100,11 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) pai->format = getByte(pai->hContact, "AvatarType", PA_FORMAT_JPEG); - 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)); - if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0)) + if (::_waccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0)) return GAIR_SUCCESS; if (IsOnline()) { @@ -119,13 +119,13 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) { - TCHAR path[MAX_PATH]; + wchar_t path[MAX_PATH]; GetAvatarFileName(NULL, path, _countof(path)); - _tcsncpy((TCHAR*)wParam, path, (int)lParam); + wcsncpy((wchar_t*)wParam, path, (int)lParam); return 0; } -void CSkypeProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen) +void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName); @@ -135,7 +135,7 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cb pszDest[tPathLen++] = '\\'; - const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG)); + const wchar_t* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG)); CMStringA username(Contacts[hContact]); username.Replace("live:", "__live_"); username.Replace("facebook:", "__facebook_"); @@ -166,14 +166,14 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam) { - TCHAR *path = (TCHAR*)lParam; - TCHAR avatarPath[MAX_PATH]; + wchar_t *path = (wchar_t*)lParam; + wchar_t avatarPath[MAX_PATH]; GetAvatarFileName(NULL, avatarPath, _countof(avatarPath)); if (path != NULL) { if (CopyFile(path, avatarPath, FALSE)) { - FILE *hFile = _tfopen(path, L"rb"); + FILE *hFile = _wfopen(path, L"rb"); if (hFile) { fseek(hFile, 0, SEEK_END); diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 8fa95966d9..282793848c 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -58,7 +58,7 @@ MCONTACT CSkypeProto::FindChatRoom(const char *chatname) return si ? si->hContact : 0; } -void CSkypeProto::StartChatRoom(const TCHAR *tid, const TCHAR *tname) +void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname) { // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; @@ -408,9 +408,9 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) } } -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++; @@ -420,12 +420,12 @@ TCHAR* UnEscapeChatTags(TCHAR* str_in) return str_in; } -void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessage) +void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszMessage) { if (!IsOnline()) return; - TCHAR *buf = NEWTSTR_ALLOCA(tszMessage); + wchar_t *buf = NEWWSTR_ALLOCA(tszMessage); rtrimt(buf); UnEscapeChatTags(buf); @@ -438,7 +438,7 @@ void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessa SendRequest(new SendChatMessageRequest(szChatId, time(NULL), szMessage, li)); } -void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading) +void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading) { GCDEST gcd = { m_szModuleName, chat_id, isAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; @@ -468,7 +468,7 @@ void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, cons void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) { - ptrT topic((TCHAR*)p); // memory must be freed in any case + ptrT topic((wchar_t*)p); // memory must be freed in any case if (response == NULL || response->pData == NULL) return; @@ -520,13 +520,13 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const CallService(MS_GC_EVENT, 0, reinterpret_cast(&gce)); } -bool CSkypeProto::IsChatContact(const TCHAR *chat_id, const char *id) +bool CSkypeProto::IsChatContact(const wchar_t *chat_id, const char *id) { ptrA users(GetChatUsers(chat_id)); return (users != NULL && strstr(users, id) != NULL); } -char *CSkypeProto::GetChatUsers(const TCHAR *chat_id) +char *CSkypeProto::GetChatUsers(const wchar_t *chat_id) { GC_INFO gci = { 0 }; gci.Flags = GCF_USERS; @@ -536,13 +536,13 @@ char *CSkypeProto::GetChatUsers(const TCHAR *chat_id) return gci.pszUsers; } -void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const char *name, const TCHAR *role, bool isChange) +void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const char *name, const wchar_t *role, bool isChange) { if (IsChatContact(tchat_id, id)) return; ptrT tnick(mir_a2t_cp(name, CP_UTF8)); - if (TCHAR *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id)) + if (wchar_t *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id)) tnick = tmp; ptrT tid(mir_a2t(id)); @@ -560,7 +560,7 @@ void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const ch CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); } -void CSkypeProto::RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick, const char *initiator) +void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, const char *name, bool isKick, const char *initiator) { if (IsMe(id)) return; @@ -619,9 +619,9 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) { static const struct gc_item Items[] = { - { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE }, - { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }, - { LPGENT("&Change topic"), 30, MENU_ITEM, FALSE } + { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE }, + { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE }, + { LPGENW("&Change topic"), 30, MENU_ITEM, FALSE } }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; @@ -637,12 +637,12 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) {*/ static const struct gc_item Items[] = { - { LPGENT("Kick &user"), 10, MENU_ITEM }, + { LPGENW("Kick &user"), 10, MENU_ITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("Set &role"), 20, MENU_NEWPOPUP }, - { LPGENT("&Admin"), 30, MENU_POPUPITEM }, - { LPGENT("&User"), 40, MENU_POPUPITEM }, - { LPGENT("Change nick"), 50, MENU_ITEM }, + { LPGENW("Set &role"), 20, MENU_NEWPOPUP }, + { LPGENW("&Admin"), 30, MENU_POPUPITEM }, + { LPGENW("&User"), 40, MENU_POPUPITEM }, + { LPGENW("Change nick"), 50, MENU_ITEM }, }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h index 63a38ecadc..60a00b0ac5 100644 --- a/protocols/SkypeWeb/src/skype_db.h +++ b/protocols/SkypeWeb/src/skype_db.h @@ -41,11 +41,11 @@ struct CSkypeOptions CMOption bMarkAllAsUnread; CMOption bUseHostnameAsPlace; - CMOption wstrPlace; + CMOption wstrPlace; CMOption bUseBBCodes; - CMOption wstrCListGroup; + CMOption wstrCListGroup; CSkypeOptions(PROTO_INTERFACE *proto) : diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 4624bb5c45..ecf870469d 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -45,7 +45,7 @@ void CSkypeInviteDlg::OnInitDialog() { if (!m_proto->isChatRoom(hContact)) { - TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); + wchar_t *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); m_combo.AddString(ptszNick, hContact); } } diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index f38ee7a8dd..cd72da2f78 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -73,7 +73,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) if (xmlDuration != NULL) { - callDuration = _ttol(xmlGetText(xmlDuration)); + callDuration = _wtol(xmlGetText(xmlDuration)); break; } } @@ -115,7 +115,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) HXML xmlNode = xmlGetNthChild(xml, L"file", i); if (xmlNode != NULL) { - fileSize = _ttol(xmlGetAttrValue(xmlNode, L"size")); + fileSize = _wtol(xmlGetAttrValue(xmlNode, L"size")); char *fileName = _T2A(xmlGetText(xmlNode)); if (fileName != NULL) { diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index bc562a8746..2a2941bdfd 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -2,7 +2,7 @@ #define FILETRANSFER_FAILED(fup) { ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)fup); delete fup; fup = nullptr;} -HANDLE CSkypeProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles) +HANDLE CSkypeProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) { if (IsOnline()) { @@ -38,7 +38,7 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar JSONNode node = JSONNode::parse((char*)response->pData); std::string strObjectId = node["id"].as_string(); fup->uid = mir_strdup(strObjectId.c_str()); - FILE *pFile = _tfopen(fup->tszFileName, L"rb"); + FILE *pFile = _wfopen(fup->tszFileName, L"rb"); if (pFile == NULL) return; fseek(pFile, 0, SEEK_END); @@ -75,7 +75,7 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a return; } - TCHAR *tszFile = _tcsrchr(fup->tszFileName, L'\\') + 1; + wchar_t *tszFile = wcsrchr(fup->tszFileName, L'\\') + 1; HXML xml = xmlCreateNode(L"URIObject", nullptr, 0); xmlAddChild(xml, L"Title", tszFile); diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index c4c40d1219..18ab4ad130 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -19,20 +19,20 @@ along with this program. If not, see . IconItemT CSkypeProto::Icons[] = { - { LPGENT("Protocol icon"), "main", IDI_SKYPE }, - { LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE }, - { LPGENT("Sync history icon"), "synchistory", IDI_SYNCHISTORY }, - { LPGENT("Block user icon"), "user_block", IDI_BLOCKUSER }, - { LPGENT("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER }, - { LPGENT("Incoming call icon"), "inc_call", IDI_CALL }, - { LPGENT("Notification icon"), "notify", IDI_NOTIFY }, - { LPGENT("Error icon"), "error", IDI_ERRORICON }, - { LPGENT("Action icon"), "me_action", IDI_ACTION_ME } + { LPGENW("Protocol icon"), "main", IDI_SKYPE }, + { LPGENW("Create new chat icon"), "conference", IDI_CONFERENCE }, + { LPGENW("Sync history icon"), "synchistory", IDI_SYNCHISTORY }, + { LPGENW("Block user icon"), "user_block", IDI_BLOCKUSER }, + { LPGENW("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER }, + { LPGENW("Incoming call icon"), "inc_call", IDI_CALL }, + { LPGENW("Notification icon"), "notify", IDI_NOTIFY }, + { LPGENW("Error icon"), "error", IDI_ERRORICON }, + { LPGENW("Action icon"), "me_action", IDI_ACTION_ME } }; void CSkypeProto::InitIcons() { - Icon_RegisterT(g_hInstance, LPGENT("Protocols") L"/" LPGENT(MODULE), Icons, _countof(Icons), MODULE); + Icon_RegisterT(g_hInstance, LPGENW("Protocols") L"/" MODULEW, Icons, _countof(Icons), MODULE); } HICON CSkypeProto::GetIcon(int iconId) diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 7909698b37..e2d820eb75 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -236,7 +236,7 @@ void CSkypeProto::SendPresence(bool isLogin) epname = mir_utf8encodeT(m_opts.wstrPlace); else { - TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; + wchar_t compName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD size = _countof(compName); GetComputerName(compName, &size); epname = mir_utf8encodeT(compName); diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 6e612c60ce..8ad180448e 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -65,7 +65,7 @@ void CSkypeProto::InitMenus() // Request authorization mi.pszService = MODULE"/RequestAuth"; - mi.name.t = LPGENT("Request authorization"); + mi.name.w = LPGENW("Request authorization"); mi.position = CMI_POSITION + CMI_AUTH_REQUEST; mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_REQUEST); SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e); @@ -74,7 +74,7 @@ void CSkypeProto::InitMenus() // Grant authorization mi.pszService = MODULE"/GrantAuth"; - mi.name.t = LPGENT("Grant authorization"); + mi.name.w = LPGENW("Grant authorization"); mi.position = CMI_POSITION + CMI_AUTH_GRANT; mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT); SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30); @@ -82,7 +82,7 @@ void CSkypeProto::InitMenus() CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::OnGrantAuth>); mi.pszService = MODULE"/GetHistory"; - mi.name.t = LPGENT("Get server history"); + mi.name.w = LPGENW("Get server history"); mi.position = CMI_POSITION + CMI_GETSERVERHISTORY; mi.hIcolibItem = GetIconHandle(IDI_SYNCHISTORY); SET_UID(mi, 0xc9a64e98, 0x9257, 0x4b52, 0x98, 0xdd, 0x7f, 0x56, 0xb3, 0x90, 0xe3, 0xde); @@ -90,7 +90,7 @@ void CSkypeProto::InitMenus() CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::GetContactHistory>); mi.pszService = MODULE"/BlockContact"; - mi.name.t = LPGENT("Block contact"); + mi.name.w = LPGENW("Block contact"); mi.position = CMI_POSITION + CMI_BLOCK; mi.hIcolibItem = GetIconHandle(IDI_BLOCKUSER); SET_UID(mi ,0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32); @@ -98,7 +98,7 @@ void CSkypeProto::InitMenus() CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockContact>); mi.pszService = MODULE"/UnblockContact"; - mi.name.t = LPGENT("Unblock contact"); + mi.name.w = LPGENW("Unblock contact"); mi.position = CMI_POSITION + CMI_UNBLOCK; mi.hIcolibItem = GetIconHandle(IDI_UNBLOCKUSER); SET_UID(mi, 0x88542f43, 0x7448, 0x48d0, 0x81, 0xa3, 0x26, 0x0, 0x4f, 0x37, 0xee, 0xe0); diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index cc9ac8e2ca..4d35393d12 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -290,14 +290,14 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const HXML xmlContact = xmlGetNthChild(xmlNode, L"c", i); if (xmlContact != NULL) { - const TCHAR *tszContactId = xmlGetAttrValue(xmlContact, L"s"); - //const TCHAR *tszContactName = xmlGetAttrValue(xmlContact, L"f"); + const wchar_t *tszContactId = xmlGetAttrValue(xmlContact, L"s"); + //const wchar_t *tszContactName = xmlGetAttrValue(xmlContact, L"f"); psr[nCount] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT)); psr[nCount]->cbSize = sizeof(psr); psr[nCount]->flags = PSR_TCHAR; - psr[nCount]->id.t = mir_tstrdup(tszContactId); - //psr[nCount]->nick.t = mir_tstrdup(tszContactName == NULL ? L"" : tszContactName); + psr[nCount]->id.w = mir_tstrdup(tszContactId); + //psr[nCount]->nick.w = mir_tstrdup(tszContactName == NULL ? L"" : tszContactName); nCount++; } } @@ -319,7 +319,7 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre); for (DWORD i = 0; i < *((PDWORD)b); i++) { - mir_free(psr[i]->id.t); + mir_free(psr[i]->id.w); mir_free(psr[i]); } mir_free(b); diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index fc6136012c..2026a509eb 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -72,11 +72,11 @@ int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInstance; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; 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.pDialog = CSkypeOptionsMain::CreateOptionsPage(this); Options_AddPage(wParam, &odp); diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 49a7b40d60..65e5bb3487 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -2,7 +2,7 @@ void CSkypeProto::InitPopups() { - TCHAR desc[256]; + wchar_t desc[256]; char name[256]; POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; @@ -47,7 +47,7 @@ void CSkypeProto::UninitPopups() } } -void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, MCONTACT hContact, int type) +void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact, int type) { if (Miranda_Terminated()) return; @@ -75,8 +75,8 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, M } POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.ptszTitle = caption; - ppd.ptszText = message; + ppd.pwszTitle = caption; + ppd.pwszText = message; ppd.pszClassName = className.GetBuffer(); ppd.hContact = hContact; @@ -88,7 +88,7 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, M } } -void CSkypeProto::ShowNotification(const TCHAR *message, MCONTACT hContact) +void CSkypeProto::ShowNotification(const wchar_t *message, MCONTACT hContact) { ShowNotification(_T(MODULE), message, hContact); } diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index fff14b059f..2c4678a93a 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -17,11 +17,11 @@ along with this program. If not, see . #include "stdafx.h" -std::map CSkypeProto::languages; +std::map CSkypeProto::languages; void CSkypeProto::InitLanguages() { - std::map result; + std::map result; result[L"ab"] = L"Abkhazian"; result[L"aa"] = L"Afar"; result[L"af"] = L"Afrikaans"; @@ -288,7 +288,7 @@ void CSkypeProto::UpdateProfileGender(const JSONNode &root, MCONTACT hContact) { CMString gender = root["gender"].as_mstring(); if (!gender.IsEmpty() && gender != "null") - setByte(hContact, "Gender", (BYTE)(_ttoi(gender) == 1 ? 'M' : 'F')); + setByte(hContact, "Gender", (BYTE)(_wtoi(gender) == 1 ? 'M' : 'F')); else delSetting(hContact, "Gender"); } @@ -299,7 +299,7 @@ void CSkypeProto::UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact) if (!birthday.IsEmpty() && birthday != "null") { int d, m, y; - _stscanf(birthday.GetBuffer(), L"%d-%d-%d", &y, &m, &d); + swscanf(birthday.GetBuffer(), L"%d-%d-%d", &y, &m, &d); setWord(hContact, "BirthYear", y); setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index a4ff764aef..cf003bdb17 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . #include "stdafx.h" -CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : +CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : PROTO(protoName, userName), m_PopupClasses(1), m_InviteDialogs(1), @@ -42,7 +42,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE); CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP); - m_tszAvatarFolder = std::tstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName; + m_tszAvatarFolder = std::wstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName; DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str()); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) CreateDirectoryTreeT(m_tszAvatarFolder.c_str()); @@ -114,7 +114,7 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) return 0; } -int CSkypeProto::SetAwayMsg(int, const TCHAR *msg) +int CSkypeProto::SetAwayMsg(int, const wchar_t *msg) { PushRequest(new SetStatusMsgRequest(msg ? T2Utf(msg) : "", li)); return 0; @@ -148,7 +148,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) MCONTACT hContact; if (psr->flags & PSR_UNICODE) - hContact = AddContact(T2Utf(psr->id.t)); + hContact = AddContact(T2Utf(psr->id.w)); else hContact = AddContact(psr->id.a); @@ -186,7 +186,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent) return 0; } -int CSkypeProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) +int CSkypeProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) { MCONTACT hContact = GetContactFromAuthEvent(hDbEvent); if (hContact == INVALID_CONTACT_ID) @@ -201,7 +201,7 @@ int CSkypeProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) return Proto_AuthRecv(m_szModuleName, pre); } -int CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage) +int CSkypeProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage) { if (hContact == INVALID_CONTACT_ID) return 1; @@ -329,16 +329,16 @@ int CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) //if (GetMessageFromDb(hContact, szMessageId, pre->timestamp)) return 0; for (i = 0; i < nCount; i++) - cbBlob += int(/*mir_tstrlen(isrList[i]->nick.t)*/0 + 2 + mir_tstrlen(isrList[i]->id.t) + mir_strlen(szMessageId)); + cbBlob += int(/*mir_tstrlen(isrList[i]->nick.w)*/0 + 2 + mir_tstrlen(isrList[i]->id.w) + mir_strlen(szMessageId)); pBlob = (PBYTE)mir_calloc(cbBlob); for (i = 0, pCurBlob = pBlob; i < nCount; i++) { - //mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.t)); + //mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.w)); pCurBlob += mir_strlen((PCHAR)pCurBlob) + 1; - mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.t)); + mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.w)); pCurBlob += mir_strlen((char*)pCurBlob) + 1; } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 94f0aa43a6..37320a43d6 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -41,24 +41,24 @@ public: virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage); + virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage); virtual int __cdecl Authorize(MEVENT hDbEvent); - virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); 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 SearchBasic(const wchar_t* id); virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); virtual int __cdecl SetStatus(int iNewStatus); virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam); virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*); - 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 HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg); + virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg); // accounts - static CSkypeProto* InitAccount(const char *protoName, const TCHAR *userName); + static CSkypeProto* InitAccount(const char *protoName, const wchar_t *userName); static int UninitAccount(CSkypeProto *proto); // icons @@ -137,7 +137,7 @@ private: std::map m_mpOutMessages; std::map cookies; - static std::map languages; + static std::map languages; HANDLE m_pollingConnection, m_hPollingThread, @@ -174,14 +174,14 @@ private: INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM); - std::tstring m_tszAvatarFolder; + std::wstring m_tszAvatarFolder; INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM); INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM); INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM); INT_PTR __cdecl SvcSetMyAvatar(WPARAM, LPARAM); - int InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR *ptszFileName); + int InternalSetAvatar(MCONTACT hContact, const char *szJid, const wchar_t *ptszFileName); // requests @@ -282,7 +282,7 @@ private: void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl); void ReloadAvatarInfo(MCONTACT hContact); - void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen); + void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen); void OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg); void OnSentAvatar(const NETLIBHTTPREQUEST *response); @@ -339,17 +339,17 @@ private: INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM); INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM); - void StartChatRoom(const TCHAR *tid, const TCHAR *tname); + void StartChatRoom(const wchar_t *tid, const wchar_t *tname); void OnLoadChats(const NETLIBHTTPREQUEST *response); void OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p); void OnChatEvent(const JSONNode &node); - void OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessage); - char *GetChatUsers(const TCHAR *chat_id); - bool IsChatContact(const TCHAR *chat_id, const char *id); - void AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading = false); - void AddChatContact(const TCHAR *tchat_id, const char *id, const char *name, const TCHAR *role, bool isChange = false); - void RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick = false, const char *initiator = ""); + void OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszMessage); + char *GetChatUsers(const wchar_t *chat_id); + bool IsChatContact(const wchar_t *chat_id, const char *id); + void AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading = false); + void AddChatContact(const wchar_t *tchat_id, const char *id, const char *name, const wchar_t *role, bool isChange = false); + void RemoveChatContact(const wchar_t *tchat_id, const char *id, const char *name, bool isKick = false, const char *initiator = ""); void RenameChat(const char *chat_id, const char *name); void ChangeChatTopic(const char * chat_id, const char *topic, const char *initiator); @@ -389,9 +389,9 @@ private: static int SkypeToMirandaStatus(const char *status); static const char *MirandaToSkypeStatus(int status); - void ShowNotification(const TCHAR *message, MCONTACT hContact = NULL); - void ShowNotification(const TCHAR *caption, const TCHAR *message, MCONTACT hContact = NULL, int type = 0); - static bool IsFileExists(std::tstring path); + void ShowNotification(const wchar_t *message, MCONTACT hContact = NULL); + void ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact = NULL, int type = 0); + static bool IsFileExists(std::wstring path); static LRESULT CALLBACK PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 7c7637abdc..427cab89ad 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . #include "stdafx.h" -HANDLE CSkypeProto::SearchBasic(const TCHAR* id) +HANDLE CSkypeProto::SearchBasic(const wchar_t* id) { ForkThread(&CSkypeProto::SearchBasicThread, (void *)id); return (HANDLE)1; @@ -28,7 +28,7 @@ void CSkypeProto::SearchBasicThread(void* id) debugLogA("CSkypeProto::OnSearchBasicThread"); if (IsOnline()) { - ptrA szString(mir_urlEncode(T2Utf((TCHAR*)id))); + ptrA szString(mir_urlEncode(T2Utf((wchar_t*)id))); SendRequest(new GetSearchRequest(szString, li), &CSkypeProto::OnSearch); } } diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 58d0ad84e4..42fe0bf575 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -32,7 +32,7 @@ time_t CSkypeProto::IsoToUnixTime(const char *stamp) // skip '-' chars int si = 0, sj = 0; while (true) { - if (p[si] == _T('-')) + if (p[si] == '-') si++; else if (!(p[sj++] = p[si++])) break; @@ -426,9 +426,9 @@ int CSkypeProto::SkypeToMirandaStatus(const char *status) return ID_STATUS_OFFLINE; } -bool CSkypeProto::IsFileExists(std::tstring path) +bool CSkypeProto::IsFileExists(std::wstring path) { - return _taccess(path.c_str(), 0) == 0; + return _waccess(path.c_str(), 0) == 0; } // url parsing @@ -480,14 +480,14 @@ CMStringA CSkypeProto::GetServerFromUrl(const char *url) INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) { - TCHAR *arg = (TCHAR *)lParam; + wchar_t *arg = (wchar_t *)lParam; if (arg == NULL) return 1; // skip leading prefix - TCHAR szUri[1024]; - _tcsncpy_s(szUri, arg, _TRUNCATE); - TCHAR *szJid = _tcschr(szUri, _T(':')); + wchar_t szUri[1024]; + wcsncpy_s(szUri, arg, _TRUNCATE); + wchar_t *szJid = wcschr(szUri, ':'); if (szJid == NULL) return 1; @@ -496,13 +496,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) return 1; // command code - TCHAR *szCommand = szJid; - szCommand = _tcschr(szCommand, _T('?')); + wchar_t *szCommand = szJid; + szCommand = wcschr(szCommand, '?'); if (szCommand) *(szCommand++) = 0; // parameters - TCHAR *szSecondParam = szCommand ? _tcschr(szCommand, _T('&')) : NULL; + wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : NULL; if (szSecondParam) *(szSecondParam++) = 0; @@ -511,7 +511,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) { if (szSecondParam) { - TCHAR *szChatId = _tcsstr(szSecondParam, L"id="); + wchar_t *szChatId = wcsstr(szSecondParam, L"id="); if (szChatId) { szChatId += 5; @@ -537,8 +537,8 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.id.t = mir_tstrdup(szJid); - psr.nick.t = mir_tstrdup(szJid); + psr.id.w = mir_tstrdup(szJid); + psr.nick.w = mir_tstrdup(szJid); psr.flags = PSR_UNICODE; ADDCONTACTSTRUCT acs = { 0 }; diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index afb15d7d91..45e57d6311 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -97,8 +97,8 @@ struct CFileUploadParam : public MZeroedObject { size_t size; MCONTACT hContact; - __forceinline CFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {}; - __forceinline bool IsAccess() { return ::_taccess(tszFileName, 0) == 0; } + __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {}; + __forceinline bool IsAccess() { return ::_waccess(tszFileName, 0) == 0; } }; diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 4f33cf6d1a..005f61f945 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -191,6 +191,7 @@ public: #define MODULE "Skype" +#define MODULEW L"Skype" #define SKYPE_MAX_CONNECT_RETRIES 10 -- cgit v1.2.3