From 428bf0cbd77813a43094cb5c984436deff251936 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 29 Jul 2016 12:36:34 +0000 Subject: no more TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17143 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/avatars.cpp | 6 +- protocols/AimOscar/src/file.cpp | 4 +- protocols/AimOscar/src/links.cpp | 2 +- protocols/AimOscar/src/popup.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 6 +- protocols/AimOscar/src/server.cpp | 2 +- protocols/AimOscar/src/ui.cpp | 4 +- protocols/AimOscar/src/utility.cpp | 4 +- protocols/Dummy/src/dummy_proto.cpp | 6 +- protocols/FacebookRM/src/avatars.cpp | 2 +- protocols/FacebookRM/src/chat.cpp | 8 +- protocols/FacebookRM/src/communication.cpp | 10 +- protocols/FacebookRM/src/contacts.cpp | 4 +- protocols/FacebookRM/src/dialogs.cpp | 8 +- protocols/FacebookRM/src/json.cpp | 12 +- protocols/FacebookRM/src/process.cpp | 10 +- protocols/FacebookRM/src/proto.cpp | 56 ++--- protocols/GTalkExt/src/avatar.cpp | 8 +- protocols/GTalkExt/src/db.cpp | 4 +- protocols/GTalkExt/src/inbox.cpp | 2 +- protocols/GTalkExt/src/notifications.cpp | 16 +- protocols/GTalkExt/src/options.cpp | 4 +- protocols/GTalkExt/src/tipper_items.cpp | 18 +- protocols/Gadu-Gadu/src/avatar.cpp | 14 +- protocols/Gadu-Gadu/src/core.cpp | 58 ++--- protocols/Gadu-Gadu/src/dialogs.cpp | 8 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 2 +- protocols/Gadu-Gadu/src/gg.cpp | 8 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 10 +- protocols/Gadu-Gadu/src/groupchat.cpp | 30 +-- protocols/Gadu-Gadu/src/image.cpp | 57 +++-- protocols/Gadu-Gadu/src/import.cpp | 28 +-- protocols/Gadu-Gadu/src/links.cpp | 2 +- protocols/Gadu-Gadu/src/ownerinfo.cpp | 2 +- protocols/Gadu-Gadu/src/popups.cpp | 2 +- protocols/Gadu-Gadu/src/services.cpp | 10 +- protocols/Gadu-Gadu/src/sessions.cpp | 2 +- protocols/Gadu-Gadu/src/userutils.cpp | 8 +- protocols/IRCG/src/clist.cpp | 28 +-- protocols/IRCG/src/commandmonitor.cpp | 258 +++++++++++------------ protocols/IRCG/src/input.cpp | 96 ++++----- protocols/IRCG/src/irclib.cpp | 18 +- protocols/IRCG/src/irclib.h | 32 +-- protocols/IRCG/src/ircproto.cpp | 32 +-- protocols/IRCG/src/options.cpp | 62 +++--- protocols/IRCG/src/output.cpp | 10 +- protocols/IRCG/src/scripting.cpp | 12 +- protocols/IRCG/src/services.cpp | 62 +++--- protocols/IRCG/src/stdafx.h | 68 +++--- protocols/IRCG/src/tools.cpp | 82 +++---- protocols/IRCG/src/userinfo.cpp | 36 ++-- protocols/IRCG/src/windows.cpp | 56 ++--- protocols/IcqOscarJ/src/fam_04message.cpp | 4 +- protocols/IcqOscarJ/src/fam_0alookup.cpp | 2 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 12 +- protocols/IcqOscarJ/src/icq_db.cpp | 2 +- protocols/IcqOscarJ/src/icq_filerequests.cpp | 2 +- protocols/IcqOscarJ/src/icq_opts.cpp | 6 +- protocols/IcqOscarJ/src/icq_proto.cpp | 4 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 6 +- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 8 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 2 +- protocols/IcqOscarJ/src/userinfotab.cpp | 2 +- protocols/IcqOscarJ/src/utilities.cpp | 4 +- protocols/JabberG/src/jabber.cpp | 10 +- protocols/JabberG/src/jabber_adhoc.cpp | 8 +- protocols/JabberG/src/jabber_api.cpp | 4 +- protocols/JabberG/src/jabber_byte.cpp | 4 +- protocols/JabberG/src/jabber_caps.cpp | 8 +- protocols/JabberG/src/jabber_captcha.cpp | 2 +- protocols/JabberG/src/jabber_chat.cpp | 46 ++-- protocols/JabberG/src/jabber_console.cpp | 6 +- protocols/JabberG/src/jabber_disco.cpp | 26 +-- protocols/JabberG/src/jabber_disco.h | 2 +- protocols/JabberG/src/jabber_events.cpp | 26 +-- protocols/JabberG/src/jabber_file.cpp | 10 +- protocols/JabberG/src/jabber_form.cpp | 4 +- protocols/JabberG/src/jabber_frame.cpp | 12 +- protocols/JabberG/src/jabber_ft.cpp | 8 +- protocols/JabberG/src/jabber_groupchat.cpp | 46 ++-- protocols/JabberG/src/jabber_icolib.cpp | 10 +- protocols/JabberG/src/jabber_iq.cpp | 4 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 18 +- protocols/JabberG/src/jabber_iqid.cpp | 132 ++++++------ protocols/JabberG/src/jabber_iqid_muc.cpp | 4 +- protocols/JabberG/src/jabber_list.cpp | 4 +- protocols/JabberG/src/jabber_menu.cpp | 64 +++--- protocols/JabberG/src/jabber_message_manager.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 52 ++--- protocols/JabberG/src/jabber_notes.cpp | 4 +- protocols/JabberG/src/jabber_opt.cpp | 34 +-- protocols/JabberG/src/jabber_privacy.cpp | 26 +-- protocols/JabberG/src/jabber_proto.cpp | 30 +-- protocols/JabberG/src/jabber_proto.h | 6 +- protocols/JabberG/src/jabber_rc.cpp | 12 +- protocols/JabberG/src/jabber_rc.h | 2 +- protocols/JabberG/src/jabber_search.cpp | 22 +- protocols/JabberG/src/jabber_svc.cpp | 22 +- protocols/JabberG/src/jabber_thread.cpp | 56 ++--- protocols/JabberG/src/jabber_userinfo.cpp | 20 +- protocols/JabberG/src/jabber_util.cpp | 16 +- protocols/JabberG/src/jabber_vcard.cpp | 80 +++---- protocols/JabberG/src/jabber_ws.cpp | 2 +- protocols/JabberG/src/jabber_xstatus.cpp | 42 ++-- protocols/MRA/src/MraAdvancedSearch.cpp | 2 +- protocols/MRA/src/MraAvatars.cpp | 8 +- protocols/MRA/src/MraChat.cpp | 2 +- protocols/MRA/src/MraIcons.cpp | 2 +- protocols/MRA/src/MraPopUp.cpp | 6 +- protocols/MRA/src/MraProto.cpp | 2 +- protocols/MRA/src/MraSendCommand.cpp | 2 +- protocols/MRA/src/Mra_functions.cpp | 14 +- protocols/MRA/src/Mra_menus.cpp | 2 +- protocols/MRA/src/Mra_options.cpp | 8 +- protocols/MRA/src/Mra_proto.cpp | 8 +- protocols/MRA/src/Mra_svcs.cpp | 2 +- protocols/MSN/src/msn_chat.cpp | 2 +- protocols/MSN/src/msn_commands.cpp | 10 +- protocols/MSN/src/msn_links.cpp | 2 +- protocols/MSN/src/msn_mail.cpp | 2 +- protocols/MSN/src/msn_menu.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 14 +- protocols/MSN/src/msn_opts.cpp | 12 +- protocols/MSN/src/msn_p2p.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 12 +- protocols/MSN/src/msn_skypeab.cpp | 34 +-- protocols/MSN/src/msn_svcs.cpp | 6 +- protocols/MinecraftDynmap/src/communication.cpp | 4 +- protocols/MinecraftDynmap/src/dialogs.cpp | 4 +- protocols/MinecraftDynmap/src/proto.cpp | 4 +- protocols/Omegle/src/chat.cpp | 4 +- protocols/Omegle/src/communication.cpp | 12 +- protocols/Omegle/src/dialogs.cpp | 4 +- protocols/Omegle/src/proto.cpp | 12 +- protocols/Sametime/src/conference.cpp | 52 ++--- protocols/Sametime/src/files.cpp | 42 ++-- protocols/Sametime/src/messaging.cpp | 30 +-- protocols/Sametime/src/options.cpp | 8 +- protocols/Sametime/src/places.cpp | 4 +- protocols/Sametime/src/sametime.cpp | 20 +- protocols/Sametime/src/sametime_proto.cpp | 48 ++--- protocols/Sametime/src/sametime_session.cpp | 66 +++--- protocols/Sametime/src/session_announce_win.cpp | 6 +- protocols/Sametime/src/userlist.cpp | 30 +-- protocols/Sametime/src/utils.cpp | 16 +- protocols/SkypeWeb/src/skype_avatars.cpp | 10 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 30 +-- protocols/SkypeWeb/src/skype_contacts.cpp | 26 +-- protocols/SkypeWeb/src/skype_events.cpp | 2 +- protocols/SkypeWeb/src/skype_menus.cpp | 2 +- protocols/SkypeWeb/src/skype_messages.cpp | 2 +- protocols/SkypeWeb/src/skype_mslogin.cpp | 6 +- protocols/SkypeWeb/src/skype_network.cpp | 2 +- protocols/SkypeWeb/src/skype_options.cpp | 2 +- protocols/SkypeWeb/src/skype_popups.cpp | 6 +- protocols/SkypeWeb/src/skype_profile.cpp | 66 +++--- protocols/SkypeWeb/src/skype_proto.cpp | 6 +- protocols/SkypeWeb/src/skype_proto.h | 6 +- protocols/SkypeWeb/src/skype_trouter.cpp | 2 +- protocols/Steam/src/steam_avatars.cpp | 4 +- protocols/Steam/src/steam_contacts.cpp | 38 ++-- protocols/Steam/src/steam_dialogs.cpp | 2 +- protocols/Steam/src/steam_events.cpp | 2 +- protocols/Steam/src/steam_login.cpp | 4 +- protocols/Steam/src/steam_menus.cpp | 4 +- protocols/Steam/src/steam_messages.cpp | 2 +- protocols/Steam/src/steam_polling.cpp | 18 +- protocols/Steam/src/steam_proto.cpp | 14 +- protocols/Steam/src/steam_xstatus.cpp | 4 +- protocols/Tlen/src/tlen_advsearch.cpp | 2 +- protocols/Tlen/src/tlen_avatar.cpp | 12 +- protocols/Tlen/src/tlen_file.cpp | 2 +- protocols/Tlen/src/tlen_iqid.cpp | 2 +- protocols/Tlen/src/tlen_opt.cpp | 14 +- protocols/Tlen/src/tlen_p2p_new.cpp | 2 +- protocols/Tlen/src/tlen_svc.cpp | 2 +- protocols/Tlen/src/tlen_userinfo.cpp | 24 +-- protocols/Tlen/src/tlen_ws.cpp | 4 +- protocols/Tox/src/tox_accounts.cpp | 2 +- protocols/Tox/src/tox_avatars.cpp | 8 +- protocols/Tox/src/tox_chatrooms.cpp | 6 +- protocols/Tox/src/tox_contacts.cpp | 24 +-- protocols/Tox/src/tox_core.cpp | 8 +- protocols/Tox/src/tox_dialogs.h | 2 +- protocols/Tox/src/tox_menus.cpp | 4 +- protocols/Tox/src/tox_network.cpp | 4 +- protocols/Tox/src/tox_options.cpp | 24 +-- protocols/Tox/src/tox_profile.cpp | 8 +- protocols/Tox/src/tox_search.cpp | 2 +- protocols/Tox/src/tox_services.cpp | 2 +- protocols/Tox/src/tox_transfer.cpp | 4 +- protocols/Tox/src/tox_transfer.h | 2 +- protocols/Twitter/src/chat.cpp | 2 +- protocols/Twitter/src/connection.cpp | 10 +- protocols/Twitter/src/contacts.cpp | 8 +- protocols/Twitter/src/proto.cpp | 8 +- protocols/Twitter/src/theme.cpp | 2 +- protocols/Twitter/src/ui.cpp | 4 +- protocols/Twitter/src/utility.cpp | 2 +- protocols/VKontakte/src/misc.cpp | 126 +++++------ protocols/VKontakte/src/vk_avatars.cpp | 6 +- protocols/VKontakte/src/vk_chats.cpp | 52 ++--- protocols/VKontakte/src/vk_dialogs.cpp | 2 +- protocols/VKontakte/src/vk_feed.cpp | 84 ++++---- protocols/VKontakte/src/vk_files.cpp | 14 +- protocols/VKontakte/src/vk_history.cpp | 16 +- protocols/VKontakte/src/vk_messages.cpp | 8 +- protocols/VKontakte/src/vk_options.cpp | 2 +- protocols/VKontakte/src/vk_proto.cpp | 8 +- protocols/VKontakte/src/vk_proto.h | 26 +-- protocols/VKontakte/src/vk_search.cpp | 26 +-- protocols/VKontakte/src/vk_status.cpp | 26 +-- protocols/VKontakte/src/vk_struct.h | 18 +- protocols/VKontakte/src/vk_thread.cpp | 40 ++-- protocols/WhatsApp/src/avatars.cpp | 2 +- protocols/WhatsApp/src/chat.cpp | 16 +- protocols/WhatsApp/src/contacts.cpp | 8 +- protocols/WhatsApp/src/dialogs.cpp | 2 +- protocols/WhatsApp/src/messages.cpp | 2 +- protocols/WhatsApp/src/proto.cpp | 14 +- protocols/Yahoo/src/avatar.cpp | 12 +- protocols/Yahoo/src/file_transfer.cpp | 4 +- protocols/Yahoo/src/links.cpp | 2 +- protocols/Yahoo/src/main.cpp | 2 +- protocols/Yahoo/src/options.cpp | 2 +- protocols/Yahoo/src/proto.cpp | 6 +- protocols/Yahoo/src/search.cpp | 2 +- protocols/Yahoo/src/user_info.cpp | 2 +- protocols/Yahoo/src/yahoo.cpp | 4 +- 229 files changed, 1872 insertions(+), 1875 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 9a8a160503..fa966348e1 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -118,15 +118,15 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); if (ext && _waccess(pszDest, 0)) - CreateDirectoryTreeT(pszDest); + CreateDirectoryTreeW(pszDest); size_t tPathLen2 = tPathLen; DBVARIANT dbv; - if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR; + if (getWString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR; tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal); db_free(&dbv); diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index a186b29fa8..007359eb8f 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -335,7 +335,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET if (ft->pfts.tszCurrentFile) { wchar_t* dir = get_dir(ft->pfts.tszCurrentFile); - CreateDirectoryTreeT(dir); + CreateDirectoryTreeW(dir); mir_free(dir); oft->type = _htons(ft->pfts.currentFileProgress ? 0x0205 : 0x0202); @@ -491,7 +491,7 @@ file_transfer::file_transfer(MCONTACT hCont, char* nick, char* cookie) memset(this, 0, sizeof(*this)); pfts.cbSize = sizeof(pfts); - pfts.flags = PFTS_TCHAR; + pfts.flags = PFTS_UNICODE; pfts.hContact = hCont; hContact = hCont; diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index d759679d9f..15aab1fb90 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -127,7 +127,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) MCONTACT hContact = proto->contact_from_sn(sn, true, true); if (hContact) - CallService(MS_MSG_SENDMESSAGET, hContact, (LPARAM)msg); + CallService(MS_MSG_SENDMESSAGEW, hContact, (LPARAM)msg); mir_free(sn); return 0; diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 7e52cd572c..082e6fe606 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -80,7 +80,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) } wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_wstrdup((wchar_t*)msg) : mir_a2u(msg); - wcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE); + wcsncpy_s(ppd.lptzText, TranslateW(msgt), _TRUNCATE); mir_free(msgt); if (!ServiceExists(MS_POPUP_ADDPOPUPT)) diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 0a1f2e9e35..3530efa2ed 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -50,7 +50,7 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; @@ -58,7 +58,7 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : char szP2P[128]; mir_snprintf(szP2P, "%sP2P", m_szModuleName); - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_UNICODE; mir_snwprintf(descr, TranslateT("%s client-to-client connections"), m_tszUserName); nlu.szSettingsModule = szP2P; nlu.minIncomingPorts = 1; @@ -555,7 +555,7 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) MCONTACT hContact = (UINT_PTR)arg; DBVARIANT dbv; - if (!db_get_ts(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) { + if (!db_get_ws(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index db3679447b..a41ea0d5ce 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1250,7 +1250,7 @@ void CAimProto::snac_received_message(SNAC &snac, HANDLE hServerConn, unsigned s wchar_t* filenameT = mir_utf8decodeW(filename); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = mir_utf8decodeW(msg_buf); diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 71ebfb2e10..0613134dd1 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -683,7 +683,7 @@ int CAimProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = -1900000000; - odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR; + odp.flags = ODPF_USERINFOTAB | ODPF_UNICODE; odp.hInstance = hInstance; odp.pwszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); @@ -1061,7 +1061,7 @@ int CAimProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pwszGroup = LPGENW("Network"); 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.pwszTab = LPGENW("Basic"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_AIM); diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 10a18ba5af..c5a7519817 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -533,12 +533,12 @@ int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, { path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t)); - int pos = mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_userdata%"), m_szModuleName); + int pos = mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARSW(L"%miranda_userdata%"), m_szModuleName); if (contact_dir) pos += mir_snwprintf(path + pos, MAX_PATH - pos, L"\\%S", m_szModuleName); if (_waccess(path, 0)) - CreateDirectoryTreeT(path); + CreateDirectoryTreeW(path); mir_snwprintf(path + pos, MAX_PATH - pos, L"\\%s", file); int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD); diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 2a75554c83..801d977a8e 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -38,7 +38,7 @@ void CDummyProto::SearchIdAckThread(void *targ) { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = (wchar_t*)targ; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr); @@ -173,8 +173,8 @@ MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr) db_unset(hContact, "CList", "Hidden"); db_unset(hContact, "CList", "NotOnList"); } - setTString(hContact, uniqueIdSetting, psr->id.w); - setTString(hContact, "Nick", psr->id.w); + setWString(hContact, uniqueIdSetting, psr->id.w); + setWString(hContact, "Nick", psr->id.w); } return hContact; diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 55c7f046e6..14d8d6030b 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -126,7 +126,7 @@ void FacebookProto::UpdateAvatarWorker(void *) std::wstring FacebookProto::GetAvatarFolder() { wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName); + mir_snwprintf(path, L"%s\\%s", VARSW(L"%miranda_avatarcache%"), m_tszUserName); return path; } diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index eeb44b4c59..9720dc06b3 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -101,7 +101,7 @@ int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam) if (!hContact) break; - CallService(MS_MSG_SENDMESSAGET, hContact); + CallService(MS_MSG_SENDMESSAGEW, hContact); break; } @@ -285,8 +285,8 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) if (!m_enableChat || IsSpecialChatRoom(hContact)) return 0; - ptrW idT(getTStringA(hContact, "ChatRoomID")); - ptrW nameT(getTStringA(hContact, "Nick")); + ptrW idT(getWStringA(hContact, "ChatRoomID")); + ptrW nameT(getWStringA(hContact, "Nick")); ptrA threadId(getStringA(hContact, FACEBOOK_KEY_TID)); if (!idT || !nameT || !threadId) @@ -338,7 +338,7 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM) { - ptrW idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL); + ptrW idT(wParam ? getWStringA(wParam, "ChatRoomID") : NULL); GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL }; gcd.ptszID = idT; diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 63bdec6d32..7c16a70ead 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -727,13 +727,13 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const s std::wstring treaders; // Load old readers - ptrW told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + ptrW told(parent->getWStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); if (told) treaders = std::wstring(told) + L", "; // Append new reader name and remember them treaders += utils::text::prepare_name(treaderName, true); - parent->setTString(hContact, FACEBOOK_KEY_MESSAGE_READERS, treaders.c_str()); + parent->setWString(hContact, FACEBOOK_KEY_MESSAGE_READERS, treaders.c_str()); } parent->setDword(hContact, FACEBOOK_KEY_MESSAGE_READ, timestamp); @@ -925,9 +925,9 @@ bool facebook_client::login(const char *username, const char *password) // 2) Approve last unknown login if (resp.data.find("name=\"submit[This was me]\"") != std::string::npos) { - CMString tszTitle; + CMStringW tszTitle; tszTitle.AppendFormat(L"%s - %s", parent->m_tszUserName, TranslateT("Check last login")); - CMString tszMessage(TranslateT("Do you recognize this activity?")); + CMStringW tszMessage(TranslateT("Do you recognize this activity?")); std::string activity = utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "", "")); activity = utils::text::trim(utils::text::html_entities_decode(utils::text::remove_html(activity))); @@ -1685,7 +1685,7 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen // Create folder if necessary std::wstring dir = filename.substr(0, filename.rfind('\\')); if (_waccess(dir.c_str(), 0)) - CreateDirectoryTreeT(dir.c_str()); + CreateDirectoryTreeW(dir.c_str()); // Write to file FILE *f = _wfopen(filename.c_str(), L"wb"); diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index ad82b665be..8893287514 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -463,12 +463,12 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, bool force_add, boo std::string homepage = FACEBOOK_URL_PROFILE + fbu->user_id; setString(hContact, "Homepage", homepage.c_str()); - setTString(hContact, "MirVer", fbu->getMirVer()); + setWString(hContact, "MirVer", fbu->getMirVer()); db_unset(hContact, "CList", "MyHandle"); if (m_tszDefaultGroup) - db_set_ts(hContact, "CList", "Group", m_tszDefaultGroup); + db_set_ws(hContact, "CList", "Group", m_tszDefaultGroup); setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, fbu->type); diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 8574cf9431..b28dfa3f7a 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -159,7 +159,7 @@ void GetSelectedContacts(FacebookProto *proto, MCONTACT hItem, HWND hwndList, st if (userId) fu->user_id = userId; - ptrW realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK)); + ptrW realName(proto->getWStringA(hItem, FACEBOOK_KEY_NICK)); if (realName) fu->real_name = _T2A(realName); @@ -201,7 +201,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0); SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0); - ptrW place(data->proto->getTStringA(FACEBOOK_KEY_PLACE)); + ptrW place(data->proto->getWStringA(FACEBOOK_KEY_PLACE)); SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : L"Miranda NG"); bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0; @@ -284,7 +284,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0); int privacy_id = SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_GETCURSEL, 0, 0); - data->proto->setTString(FACEBOOK_KEY_PLACE, placeT); + data->proto->setWString(FACEBOOK_KEY_PLACE, placeT); data->proto->setByte("PostStatusExpand", bShowContacts); // remember last wall, only when there are more options @@ -406,7 +406,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if (tstr[0] != '\0') { proto->m_tszDefaultGroup = mir_wstrdup(tstr); - proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr); + proto->setWString(FACEBOOK_KEY_DEF_GROUP, tstr); Clist_GroupCreate(0, tstr); } else { diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index cd17067e89..6d4e7471ef 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -775,9 +775,9 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vectorgetTStringA(hContact, "MirVer")); + ptrW oldClient(proto->getWStringA(hContact, "MirVer")); if (!oldClient || mir_wstrcmp(oldClient, client)) - proto->setTString(hContact, "MirVer", client); + proto->setWString(hContact, "MirVer", client); } } } @@ -818,9 +818,9 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vectorhandle, "MirVer")); + /* ptrW client(getWStringA(fbu->handle, "MirVer")); if (!client || mir_wstrcmp(client, fbu->getMirVer())) - setTString(fbu->handle, "MirVer", fbu->getMirVer()); + setWString(fbu->handle, "MirVer", fbu->getMirVer()); */ const JSONNode &a_ = (*itNodes)["a"]; // possible values: 0, 2 (something more?) @@ -894,9 +894,9 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vectorgetTStringA(hContact, "MirVer")); + ptrW oldClient(proto->getWStringA(hContact, "MirVer")); if (!oldClient || mir_wstrcmp(oldClient, client)) - proto->setTString(hContact, "MirVer", client); + proto->setWString(hContact, "MirVer", client); } } } else if (t == "ticker_update:home") { diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 3a3e00905c..cbc7848bc4 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -294,7 +294,7 @@ void FacebookProto::ProcessUnreadMessage(void *pParam) AddChat(room->thread_id.c_str(), room->chat_name.c_str()); hChatContact = ChatIDToHContact(room->thread_id); // Set thread id (TID) for later - setTString(hChatContact, FACEBOOK_KEY_TID, room->thread_id.c_str()); + setWString(hChatContact, FACEBOOK_KEY_TID, room->thread_id.c_str()); for (std::map::iterator jt = room->participants.begin(); jt != room->participants.end(); ) { AddChatContact(room->thread_id.c_str(), jt->first.c_str(), jt->second.c_str()); @@ -414,7 +414,7 @@ void FacebookProto::LoadLastMessages(void *pParam) AddChat(room->thread_id.c_str(), room->chat_name.c_str()); hChatContact = ChatIDToHContact(room->thread_id); // Set thread id (TID) for later - setTString(hChatContact, FACEBOOK_KEY_TID, room->thread_id.c_str()); + setWString(hChatContact, FACEBOOK_KEY_TID, room->thread_id.c_str()); for (std::map::iterator jt = room->participants.begin(); jt != room->participants.end();) { AddChatContact(room->thread_id.c_str(), jt->first.c_str(), jt->second.c_str()); @@ -805,7 +805,7 @@ void FacebookProto::ReceiveMessages(std::vector &messages, boo if (!hChatContact) { // hopefully shouldn't happen, but who knows? - debugLog(L"!!! No hChatContact for %s", fbc->thread_id.c_str()); + debugLogW(L"!!! No hChatContact for %s", fbc->thread_id.c_str()); continue; } @@ -1245,7 +1245,7 @@ void FacebookProto::SearchAckThread(void *targ) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = tid; psr.nick.w = tnick; psr.firstName.w = tname; @@ -1306,7 +1306,7 @@ void FacebookProto::SearchIdAckThread(void *targ) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = tid; psr.firstName.w = tname; psr.lastName.w = tsurname; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 667738556f..4af360a747 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : PROTO(proto_name, username), - m_tszDefaultGroup(getTStringA(FACEBOOK_KEY_DEF_GROUP)) + m_tszDefaultGroup(getWStringA(FACEBOOK_KEY_DEF_GROUP)) { facy.parent = this; @@ -48,7 +48,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : m_locale = locale; // Load custom page prefix, if set - ptrW pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX)); + ptrW pagePrefix(getWStringA(FACEBOOK_KEY_PAGE_PREFIX)); m_pagePrefix = (pagePrefix != NULL) ? _T2A(pagePrefix, CP_UTF8) : TEXT_EMOJI_PAGE; if (m_tszDefaultGroup == NULL) @@ -84,7 +84,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : // Create standard network connection wchar_t descr[512]; NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; @@ -380,7 +380,7 @@ int FacebookProto::GetInfo(MCONTACT hContact, int) INT_PTR FacebookProto::GetMyAwayMsg(WPARAM, LPARAM lParam) { - ptrW statusMsg(getTStringA("StatusMsg")); + ptrW statusMsg(getWStringA("StatusMsg")); if (statusMsg == NULL || statusMsg[0] == '\0') return 0; @@ -501,7 +501,7 @@ int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.hInstance = g_hInstance; 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.position = 271828; odp.pwszGroup = LPGENW("Network"); @@ -564,7 +564,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM) wall->title = wcsdup(TranslateT("Own wall")); } else - wall->title = getTStringA(hContact, FACEBOOK_KEY_NICK); + wall->title = getWStringA(hContact, FACEBOOK_KEY_NICK); post_status_data *data = new post_status_data(this, wall); @@ -782,9 +782,9 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE) != CONTACT_FRIEND)) return 0; - ptrW tname(getTStringA(hContact, FACEBOOK_KEY_NICK)); + ptrW tname(getWStringA(hContact, FACEBOOK_KEY_NICK)); if (tname == NULL) - tname = getTStringA(hContact, FACEBOOK_KEY_ID); + tname = getWStringA(hContact, FACEBOOK_KEY_ID); if (tname == NULL) return 1; @@ -926,7 +926,7 @@ void FacebookProto::OpenUrl(std::string url) ptrW data(mir_utf8decodeW(url.c_str())); // Check if there is user defined browser for opening links - ptrW browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER)); + ptrW browser(getWStringA(FACEBOOK_KEY_OPEN_URL_BROWSER)); if (browser != NULL) // If so, use it to open this link ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data)); @@ -1011,7 +1011,7 @@ void FacebookProto::InitPopups() // Client mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors")); mir_snprintf(name, "%s_%s", m_szModuleName, "Client"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("facebook")); ppc.colorBack = RGB(191, 0, 0); // red @@ -1022,7 +1022,7 @@ void FacebookProto::InitPopups() // Newsfeeds mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts")); mir_snprintf(name, "%s_%s", m_szModuleName, "Newsfeed"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("newsfeed")); ppc.colorBack = RGB(255, 255, 255); // white @@ -1033,7 +1033,7 @@ void FacebookProto::InitPopups() // Notifications mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notification")); ppc.colorBack = RGB(59, 89, 152); // Facebook's blue @@ -1044,7 +1044,7 @@ void FacebookProto::InitPopups() // Others mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events")); mir_snprintf(name, "%s_%s", m_szModuleName, "Other"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("facebook")); ppc.colorBack = RGB(255, 255, 255); // white @@ -1055,7 +1055,7 @@ void FacebookProto::InitPopups() // Friendship changes mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events")); mir_snprintf(name, "%s_%s", m_szModuleName, "Friendship"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("friendship")); ppc.colorBack = RGB(47, 71, 122); // Facebook's darker blue @@ -1066,7 +1066,7 @@ void FacebookProto::InitPopups() // Ticker mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity")); mir_snprintf(name, "%s_%s", m_szModuleName, "Ticker"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("newsfeed")); ppc.colorBack = RGB(255, 255, 255); // white @@ -1077,7 +1077,7 @@ void FacebookProto::InitPopups() // On this day (memories) mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories")); mir_snprintf(name, "%s_%s", m_szModuleName, "Memories"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("memories")); ppc.colorBack = RGB(255, 255, 255); // white @@ -1098,19 +1098,19 @@ void FacebookProto::InitHotkeys() HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = text; hkd.pszService = text; - hkd.ptszSection = m_tszUserName; - hkd.dwFlags = HKD_TCHAR; + hkd.pwszSection = m_tszUserName; + hkd.dwFlags = HKD_UNICODE; mir_strcpy(tDest, "/VisitProfile"); - hkd.ptszDescription = LPGENW("Visit profile"); + hkd.pwszDescription = LPGENW("Visit profile"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/VisitNotifications"); - hkd.ptszDescription = LPGENW("Visit notifications"); + hkd.pwszDescription = LPGENW("Visit notifications"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/Mind"); - hkd.ptszDescription = LPGENW("Show 'Share status' window"); + hkd.pwszDescription = LPGENW("Show 'Share status' window"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_EXT, 'F'); Hotkey_Register(&hkd); } @@ -1120,12 +1120,12 @@ void FacebookProto::InitHotkeys() */ void FacebookProto::InitSounds() { - SkinAddNewSoundExT("Notification", m_tszUserName, LPGENW("Notification")); - SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENW("Newsfeed event")); - SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENW("Other event")); - SkinAddNewSoundExT("Friendship", m_tszUserName, LPGENW("Friendship event")); - SkinAddNewSoundExT("Ticker", m_tszUserName, LPGENW("Ticker event")); - SkinAddNewSoundExT("Memories", m_tszUserName, LPGENW("Memories")); + SkinAddNewSoundExW("Notification", m_tszUserName, LPGENW("Notification")); + SkinAddNewSoundExW("NewsFeed", m_tszUserName, LPGENW("Newsfeed event")); + SkinAddNewSoundExW("OtherEvent", m_tszUserName, LPGENW("Other event")); + SkinAddNewSoundExW("Friendship", m_tszUserName, LPGENW("Friendship event")); + SkinAddNewSoundExW("Ticker", m_tszUserName, LPGENW("Ticker event")); + SkinAddNewSoundExW("Memories", m_tszUserName, LPGENW("Memories")); } /** @@ -1151,7 +1151,7 @@ void FacebookProto::MessageRead(MCONTACT hContact) if (isChatRoom(hContact)) { // Load readers names - ptrW treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + ptrW treaders(getWStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); mir_snwprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???"); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){ diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index 9c87926832..84de3a28d8 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -33,7 +33,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile) { wchar_t name[MAX_PATH + 2]; - if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(name), (LPARAM)&name)) + if (CallService(MS_DB_GETPROFILENAMEW, (WPARAM)_countof(name), (LPARAM)&name)) return NULL; wchar_t *p = wcsrchr(name, '.'); @@ -41,12 +41,12 @@ LPTSTR CreateAvaFile(HANDLE *hFile) *p = 0; wchar_t path[MAX_PATH + 2]; - if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)&path)) + if (CallService(MS_DB_GETPROFILEPATHW, (WPARAM)_countof(path), (LPARAM)&path)) return NULL; wchar_t full[MAX_PATH + 2]; mir_snwprintf(full, AVA_FILE_NAME_FORMAT, path, name); - CreateDirectoryTreeT(full); + CreateDirectoryTreeW(full); HANDLE h = CreateFile(full, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (h == INVALID_HANDLE_VALUE) @@ -156,5 +156,5 @@ void SetAvatar(MCONTACT hContact) if (ava) CallService(MS_AV_SETAVATART, hContact, (LPARAM)L""); CallService(MS_AV_SETAVATART, hContact, (LPARAM)avaFile); - db_set_ts(hContact, SRMM_MODULE_NAME, SRMM_AVATAR_SETTING_NAME, avaFile); + db_set_ws(hContact, SRMM_MODULE_NAME, SRMM_AVATAR_SETTING_NAME, avaFile); } diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp index 691e065bc3..1d18ed6121 100644 --- a/protocols/GTalkExt/src/db.cpp +++ b/protocols/GTalkExt/src/db.cpp @@ -24,10 +24,10 @@ LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid) { - return db_get_tsa(0, name, _T2A(jid)); + return db_get_wsa(0, name, _T2A(jid)); } void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting) { - db_set_ts(0, name, _T2A(jid), setting); + db_set_ws(0, name, _T2A(jid), setting); } diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 2e73250e7d..f5433032a0 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -196,7 +196,7 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) void OpenContactInbox(LPCSTR szModuleName) { - ptrW tszJid(db_get_tsa(0, szModuleName, "jid")); + ptrW tszJid(db_get_wsa(0, szModuleName, "jid")); if (tszJid == NULL) return; diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index e2243609ca..e80e573742 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -54,7 +54,7 @@ LPCSTR GetJidAcc(LPCTSTR jid) Proto_EnumAccounts(&count, &protos); for (int i = 0; i < count; i++) { if (getJabberApi(protos[i]->szModuleName)) { - ptrW tszJid(db_get_tsa(0, protos[i]->szModuleName, "jid")); + ptrW tszJid(db_get_wsa(0, protos[i]->szModuleName, "jid")); if (!mir_wstrcmpi(jid, tszJid)) return protos[i]->szModuleName; } @@ -179,12 +179,12 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST if (displayName == NULL) { wchar_t *tszTemp = (wchar_t*)alloca((mir_wstrlen(jid) + mir_wstrlen(unreadCount) + 3 + 1) * sizeof(wchar_t)); FormatPseudocontactDisplayName(tszTemp, jid, unreadCount); - db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp); + db_set_ws(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp); } - else db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName); + else db_set_ws(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName); - db_set_ts(hContact, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateTS(MAIL_NOTIFICATIONS)); - db_set_ts(hContact, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount); + db_set_ws(hContact, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateW(MAIL_NOTIFICATIONS)); + db_set_ws(hContact, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount); return hContact; } @@ -263,7 +263,7 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre POPUPDATAT data = { 0 }; FormatPseudocontactDisplayName(&data.lptzContactName[0], jid, unreadCount); - CMString tszSenders; + CMStringW tszSenders; for (int i = 0; i < SENDER_COUNT; i++) { const SENDER &p = mtn->senders[i]; if (p.addr == NULL) @@ -276,9 +276,9 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre } if (ReadCheckbox(0, IDC_ADDSNIP, (UINT_PTR)TlsGetValue(itlsSettings))) - mir_snwprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip); + mir_snwprintf(data.lptzText, TranslateW(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip); else - mir_snwprintf(data.lptzText, TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str()); + mir_snwprintf(data.lptzText, TranslateW(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str()); ShowNotification(acc, &data, jid, url, unreadCount); } diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 9183d773e4..378f83404c 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -155,8 +155,8 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa void ShowTestPopup(HWND wnd) { POPUPDATAT data = { 0 }; - mir_snwprintf(data.lptzContactName, TranslateTS(TEST_LETTER_INBOX)); - mir_snwprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP)); + mir_snwprintf(data.lptzContactName, TranslateW(TEST_LETTER_INBOX)); + mir_snwprintf(data.lptzText, TranslateW(FULL_NOTIFICATION_FORMAT), TranslateW(TEST_LETTER_SUBJECT), TranslateW(TEST_LETTER_SENDER), TranslateW(TEST_LETTER_SNIP)); int len = SendDlgItemMessage(wnd, IDC_TIMEOUTEDIT, WM_GETTEXTLENGTH, 0, 0) + 1; LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(wchar_t)); diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 929078c2f7..5f7baa7f27 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -74,18 +74,18 @@ void SetLabelProp(int index, LPSTR setting) { sprintf(setting, LABEL_SETTING_PROP, index); //!!!!!!!!!!!!!! - ptrW tszProp(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting)); + ptrW tszProp(db_get_wsa(0, TIPPER_ITEMS_MOD_NAME, setting)); if (tszProp == NULL) return; - ptrW tszLastWritten(db_get_tsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING)); + ptrW tszLastWritten(db_get_wsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING)); if (tszLastWritten == NULL) return; if (!mir_wstrcmp(tszProp, tszLastWritten)) { - LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL); - db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); - db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, label); + LPTSTR label = TranslateW(UNREAD_THREADS_LABEL); + db_set_ws(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); + db_set_ws(0, TIPPER_ITEMS_MOD_NAME, setting, label); } } @@ -103,7 +103,7 @@ void AddTipperItem() for (i = 0; i < itemCount; i++) { mir_snprintf(setting, l, VALUE_SETTING_PROP, i); - ptrW tszSetting(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting)); + ptrW tszSetting(db_get_wsa(0, TIPPER_ITEMS_MOD_NAME, setting)); if (tszSetting) { if (!mir_wstrcmp(UNREAD_THREADS_RAW, tszSetting)) { SetLabelProp(i, setting); @@ -117,14 +117,14 @@ void AddTipperItem() #define WRITE_TIPPER_PROPS(index, value)\ mir_snprintf(setting, l, TipperItemProps[##index##], 0);\ - db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) + db_set_ws(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) #define WRITE_TIPPER_PROPB(index, value)\ mir_snprintf(setting, l, TipperItemProps[##index##], 0);\ db_set_b(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) - LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL); + LPTSTR label = TranslateW(UNREAD_THREADS_LABEL); - db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); + db_set_ws(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); WRITE_TIPPER_PROPS(0, label); WRITE_TIPPER_PROPB(1, 0); diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 764cc426ef..9587cd11b0 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -28,14 +28,14 @@ // void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW( L"%miranda_avatarcache%"), m_szModuleName); if (_waccess(pszDest, 0)) { - int ret = CreateDirectoryTreeT(pszDest); + int ret = CreateDirectoryTreeW(pszDest); if (ret == 0) - debugLog(L"getAvatarFilename(): Created new directory for avatar cache: %s.", pszDest); + debugLogW(L"getAvatarFilename(): Created new directory for avatar cache: %s.", pszDest); else { - debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno)); + debugLogW(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest); showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE); @@ -267,9 +267,9 @@ void __cdecl GGPROTO::avatarrequestthread(void*) _write(file_fd, resp->pData, resp->dataLength); _close(file_fd); result = 1; - debugLog(L"avatarrequestthread() new avatar_transfers item. Saved data to file=%s.", ai.filename); + debugLogW(L"avatarrequestthread() new avatar_transfers item. Saved data to file=%s.", ai.filename); } else { - debugLog(L"avatarrequestthread(): _wopen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno)); + debugLogW(L"avatarrequestthread(): _wopen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); @@ -361,7 +361,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) wchar_t *szFilename = (wchar_t*)param; int file_fd = _wopen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD); if (file_fd == -1) { - debugLog(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno)); + debugLogW(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index dec48051e4..8440ab94ab 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -69,7 +69,7 @@ void GGPROTO::disconnect() gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 6, "modemsg_mutex", 1); szMsg = mir_utf8encodeW(modemsg.online); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 6, 1, "modemsg_mutex", 1); - if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_TCHAR)) { + if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_WCHAR)) { if (dbv.ptszVal && *(dbv.ptszVal)) szMsg = mir_utf8encodeW(dbv.ptszVal); db_free(&dbv); @@ -79,7 +79,7 @@ void GGPROTO::disconnect() gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 7, "modemsg_mutex", 1); szMsg = mir_utf8encodeW(modemsg.away); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 7, 1, "modemsg_mutex", 1); - if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_TCHAR)) { + if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_WCHAR)) { if (dbv.ptszVal && *(dbv.ptszVal)) szMsg = mir_utf8encodeW(dbv.ptszVal); db_free(&dbv); @@ -89,7 +89,7 @@ void GGPROTO::disconnect() gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 8, "modemsg_mutex", 1); szMsg = mir_utf8encodeW(modemsg.dnd); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 8, 1, "modemsg_mutex", 1); - if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_TCHAR)) { + if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_WCHAR)) { if (dbv.ptszVal && *(dbv.ptszVal)) szMsg = mir_utf8encodeW(dbv.ptszVal); db_free(&dbv); @@ -99,7 +99,7 @@ void GGPROTO::disconnect() gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 9, "modemsg_mutex", 1); szMsg = mir_utf8encodeW(modemsg.freechat); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 9, 1, "modemsg_mutex", 1); - if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_TCHAR)) { + if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_WCHAR)) { if (dbv.ptszVal && *(dbv.ptszVal)) szMsg = mir_utf8encodeW(dbv.ptszVal); db_free(&dbv); @@ -109,7 +109,7 @@ void GGPROTO::disconnect() gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 10, "modemsg_mutex", 1); szMsg = mir_utf8encodeW(modemsg.invisible); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 10, 1, "modemsg_mutex", 1); - if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_TCHAR)) { + if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_WCHAR)) { if (dbv.ptszVal && *(dbv.ptszVal)) szMsg = mir_utf8encodeW(dbv.ptszVal); db_free(&dbv); @@ -381,7 +381,7 @@ retry: p.status_descr = mir_utf8encodeW(getstatusmsg(m_iDesiredStatus)); p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL); - debugLog(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus, + debugLogW(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus, p.status_descr ? getstatusmsg(m_iDesiredStatus) : L""); gg_LeaveCriticalSection(&modemsg_mutex, "mainthread", 13, 1, "modemsg_mutex", 1); @@ -418,7 +418,7 @@ retry: // Lookup for error desciption if (errno == EACCES) { for (int i = 0; reason[i].type; i++) if (reason[i].type == gg_failno) { - perror = TranslateTS(reason[i].str); + perror = TranslateW(reason[i].str); break; } } @@ -426,7 +426,7 @@ retry: mir_snwprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno)); perror = error; } - debugLog(L"mainthread() (%x): %s", this, perror); + debugLogW(L"mainthread() (%x): %s", this, perror); if (getByte(GG_KEY_SHOWCERRORS, GG_KEYDEF_SHOWCERRORS)) showpopup(m_tszUserName, perror, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE); @@ -548,7 +548,7 @@ retry: if (e->event.ack.seq && e->event.ack.recipient) { ProtoBroadcastAck(getcontact((DWORD)e->event.ack.recipient, 0, 0, NULL), - ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) e->event.ack.seq, 0); + ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)e->event.ack.seq, 0); } break; @@ -654,7 +654,7 @@ retry: GGSEARCHRESULT psr; memset(&psr, 0, sizeof(psr)); psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = __nickname; psr.firstName.w = __firstname; psr.lastName.w = __lastname; @@ -669,36 +669,36 @@ retry: { // Change nickname if it's not present if (__nickname && (res->seq == GG_SEQ_GETNICK || res->seq == GG_SEQ_CHINFO)) - setTString(hContact, GG_KEY_NICK, __nickname); + setWString(hContact, GG_KEY_NICK, __nickname); if (__nickname) - setTString(hContact, GG_KEY_PD_NICKNAME, __nickname); + setWString(hContact, GG_KEY_PD_NICKNAME, __nickname); else if (res->seq == GG_SEQ_CHINFO) delSetting(GG_KEY_PD_NICKNAME); // Change other info if (__city) - setTString(hContact, GG_KEY_PD_CITY, __city); + setWString(hContact, GG_KEY_PD_CITY, __city); else if (res->seq == GG_SEQ_CHINFO) delSetting(GG_KEY_PD_CITY); if (__firstname) - setTString(hContact, GG_KEY_PD_FIRSTNAME, __firstname); + setWString(hContact, GG_KEY_PD_FIRSTNAME, __firstname); else if (res->seq == GG_SEQ_CHINFO) delSetting(GG_KEY_PD_FIRSTNAME); if (__lastname) - setTString(hContact, GG_KEY_PD_LASTNAME, __lastname); + setWString(hContact, GG_KEY_PD_LASTNAME, __lastname); else if (res->seq == GG_SEQ_CHINFO) delSetting(GG_KEY_PD_LASTNAME); if (__familyname) - setTString(hContact, GG_KEY_PD_FAMILYNAME, __familyname); + setWString(hContact, GG_KEY_PD_FAMILYNAME, __familyname); else if (res->seq == GG_SEQ_CHINFO) delSetting(GG_KEY_PD_FAMILYNAME); if (__familycity) - setTString(hContact, GG_KEY_PD_FAMILYCITY, __familycity); + setWString(hContact, GG_KEY_PD_FAMILYCITY, __familycity); else if (res->seq == GG_SEQ_CHINFO) delSetting(GG_KEY_PD_FAMILYCITY); @@ -837,7 +837,7 @@ retry: gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0); gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time; gce.dwFlags = GCEF_ADDTOLOG; - debugLog(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id); + debugLogW(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); mir_free(messageT); } @@ -898,7 +898,7 @@ retry: wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message); gce.ptszText = messageT; wchar_t* nickT; - if (!getTString(GG_KEY_NICK, &dbv)){ + if (!getWString(GG_KEY_NICK, &dbv)){ nickT = mir_wstrdup(dbv.ptszVal); db_free(&dbv); } @@ -907,7 +907,7 @@ retry: gce.time = e->event.multilogon_msg.time; gce.bIsMe = 1; gce.dwFlags = GCEF_ADDTOLOG; - debugLog(L"mainthread() (%x): Sent conference message to room %s.", this, chat); + debugLogW(L"mainthread() (%x): Sent conference message to room %s.", this, chat); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); mir_free(messageT); mir_free(nickT); @@ -1055,7 +1055,7 @@ retry: wchar_t* filenameT = mir_a2u((char*)dcc7->filename); PROTORECVFILET pre = {0}; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = filenameT; @@ -1273,7 +1273,7 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM) // Terminate conference if contact is deleted DBVARIANT dbv; - if ( isChatRoom(hContact) && !getTString(hContact, "ChatRoomID", &dbv) && gc_enabled) + if ( isChatRoom(hContact) && !getWString(hContact, "ChatRoomID", &dbv) && gc_enabled) { GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -1347,7 +1347,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) // Groupchat window contact is being renamed DBVARIANT dbv; - if (isChatRoom(hContact) && !getTString(hContact, "ChatRoomID", &dbv)) + if (isChatRoom(hContact) && !getWString(hContact, "ChatRoomID", &dbv)) { // Most important... check redundancy (fucking cascading) static int cascade = 0; @@ -1377,7 +1377,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) if (!strcmp(cws->szSetting, "MyHandle")){ wchar_t* ptszVal = sttSettingToTchar(&(cws->value)); if(ptszVal==NULL) return 0; - setTString(hContact, GG_KEY_NICK, ptszVal); + setWString(hContact, GG_KEY_NICK, ptszVal); mir_free(ptszVal); } @@ -1538,7 +1538,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (!hContact) { - debugLog(L"getcontact(): Failed to create Gadu-Gadu contact %s", szNick); + debugLogW(L"getcontact(): Failed to create Gadu-Gadu contact %s", szNick); return NULL; } @@ -1558,7 +1558,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) // If nick specified use it if (szNick) - setTString(hContact, GG_KEY_NICK, szNick); + setWString(hContact, GG_KEY_NICK, szNick); else if (isonline()) { // Search for that nick gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); @@ -1571,7 +1571,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1); gg_pubdir50_free(req); wchar_t* uinT = mir_a2u(ditoa(uin)); - setTString(hContact, GG_KEY_NICK, uinT); + setWString(hContact, GG_KEY_NICK, uinT); mir_free(uinT); debugLogA("getcontact(): Search for nick on uin: %d", uin); } @@ -1701,8 +1701,8 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const wchar_t *idescr, // Check if there's description and if it's not empty if (idescr && *idescr) { - debugLog(L"changecontactstatus(): Saving for %d status descr \"%s\".", uin, idescr); - db_set_ts(hContact, "CList", GG_KEY_STATUSDESCR, idescr); + debugLogW(L"changecontactstatus(): Saving for %d status descr \"%s\".", uin, idescr); + db_set_ws(hContact, "CList", GG_KEY_STATUSDESCR, idescr); } else { // Remove status if there's nothing db_unset(hContact, "CList", GG_KEY_STATUSDESCR); diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 1aceff00a9..a662970ddf 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -112,7 +112,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule ptstr = str; mir_snwprintf(str, L"%S", dbv.pszVal); break; - case DBVT_TCHAR: + case DBVT_WCHAR: unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); ptstr = dbv.ptszVal; break; @@ -870,13 +870,13 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, int GGPROTO::options_init(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.flags = ODPF_TCHAR; + odp.flags = ODPF_UNICODE; odp.position = 1003000; odp.hInstance = hInstance; odp.pwszGroup = LPGENW("Network"); odp.pwszTitle = m_tszUserName; odp.dwInitParam = (LPARAM)this; - odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE; + odp.flags = ODPF_UNICODE | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE; odp.pwszTab = LPGENW("General"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL); @@ -918,7 +918,7 @@ int GGPROTO::details_init(WPARAM wParam, LPARAM lParam) } OPTIONSDIALOGPAGE odp = { 0 }; - odp.flags = ODPF_DONTTRANSLATE | ODPF_TCHAR; + odp.flags = ODPF_DONTTRANSLATE | ODPF_UNICODE; odp.hInstance = hInstance; odp.pfnDlgProc = gg_detailsdlgproc; odp.position = -1900000000; diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 38909300a0..682e3656d0 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -384,7 +384,7 @@ void __cdecl GGPROTO::dccmainthread(void*) wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename); PROTORECVFILET pre = {0}; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = filenameT; diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 18e264e031..88b3c060f5 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -174,9 +174,9 @@ void GGPROTO::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version); wchar_t avatarsPath[MAX_PATH]; - mir_snwprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName); + mir_snwprintf(avatarsPath, L"%s\\%s", VARSW( L"%miranda_avatarcache%"), m_tszUserName); - debugLog(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath); + debugLogW(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath); wchar_t spec[MAX_PATH + 10]; mir_snwprintf(spec, L"%s\\*.(null)", avatarsPath); @@ -187,7 +187,7 @@ void GGPROTO::cleanuplastplugin(DWORD version) wchar_t filePathT [2*MAX_PATH + 10]; mir_snwprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName); if (!_waccess(filePathT, 0)){ - debugLog(L"cleanuplastplugin() 1: remove file = %s", filePathT); + debugLogW(L"cleanuplastplugin() 1: remove file = %s", filePathT); _wremove(filePathT); } } while (FindNextFile(hFind, &ffd) != 0); @@ -287,7 +287,7 @@ void GGPROTO::menus_init() CMenuItem mi; mi.root = hRoot; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.name.w = LPGENW("Conference"); mi.position = 200001; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index be0a8943fe..1001112208 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -44,7 +44,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS; + nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; @@ -68,7 +68,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED); wchar_t szPath[MAX_PATH]; - mir_snwprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName); + mir_snwprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARSW(L"%miranda_userdata%"), m_tszUserName); hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName); DWORD dwVersion; @@ -595,9 +595,9 @@ void __cdecl GGPROTO::getawaymsgthread(void *arg) MCONTACT hContact = (UINT_PTR)arg; debugLogA("getawaymsgthread(): started"); gg_sleep(100, FALSE, "getawaymsgthread", 106, 1); - if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) { + if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_WCHAR)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); - debugLog(L"getawaymsgthread(): Reading away msg <%s>.", dbv.ptszVal); + debugLogW(L"getawaymsgthread(): Reading away msg <%s>.", dbv.ptszVal); db_free(&dbv); } else { @@ -627,7 +627,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) int status = gg_normalizestatus(iStatus); wchar_t **msgPtr; - debugLog(L"SetAwayMsg(): PS_SETAWAYMSG(%d, \"%s\".)", iStatus, newMsg); + debugLogW(L"SetAwayMsg(): PS_SETAWAYMSG(%d, \"%s\".)", iStatus, newMsg); gg_EnterCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, "modemsg_mutex", 1); // Select proper our msg ptr diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 52d5399ef8..29f3e39abc 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -58,7 +58,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) { if (gc_enabled) { CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.root = hRoot; // Conferencing @@ -128,7 +128,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) // Window terminated (Miranda exit) if (gch->pDest->iType == SESSION_TERMINATE) { - debugLog(L"gc_event(): Terminating chat %x, id %s from chat window...", chat, gch->pDest->ptszID); + debugLogW(L"gc_event(): Terminating chat %x, id %s from chat window...", chat, gch->pDest->ptszID); // Destroy chat entry free(chat->recipients); list_remove(&chats, chat, 1); @@ -137,7 +137,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) for (MCONTACT hContact = db_find_first(); hContact; ) { MCONTACT hNext = db_find_next(hContact); DBVARIANT dbv; - if (!getTString(hContact, "ChatRoomID", &dbv)) { + if (!getWString(hContact, "ChatRoomID", &dbv)) { if (dbv.ptszVal && !mir_wstrcmp(gch->pDest->ptszID, dbv.ptszVal)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); db_free(&dbv); @@ -158,7 +158,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) gce.ptszUID = id; gce.ptszText = gch->ptszText; wchar_t* nickT; - if (!getTString(GG_KEY_NICK, &dbv)){ + if (!getWString(GG_KEY_NICK, &dbv)){ nickT = mir_wstrdup(dbv.ptszVal); db_free(&dbv); } @@ -173,7 +173,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) gce.time = time(NULL); gce.bIsMe = 1; gce.dwFlags = GCEF_ADDTOLOG; - debugLog(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->pDest->ptszID, gch->ptszText); + debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->pDest->ptszID, gch->ptszText); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); mir_free(nickT); @@ -191,7 +191,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL))) CallService(MS_MSG_SENDMESSAGE, hContact, 0); } - debugLog(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, gch->ptszText); + debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, gch->ptszText); return 0; } @@ -246,9 +246,9 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou if (found == recipients_count) { if (chat->ignore) - debugLog(L"gc_getchat(): Ignoring existing id %s, size %d.", chat->id, chat->recipients_count); + debugLogW(L"gc_getchat(): Ignoring existing id %s, size %d.", chat->id, chat->recipients_count); else - debugLog(L"gc_getchat(): Returning existing id %s, size %d.", chat->id, chat->recipients_count); + debugLogW(L"gc_getchat(): Returning existing id %s, size %d.", chat->id, chat->recipients_count); return !(chat->ignore) ? chat->id : NULL; } } @@ -295,7 +295,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou for(; i < recipients_count; i++) chat->recipients[i] = recipients[i]; if (sender) chat->recipients[i] = sender; - debugLog(L"gc_getchat(): Ignoring new chat %s, count %d.", chat->id, chat->recipients_count); + debugLogW(L"gc_getchat(): Ignoring new chat %s, count %d.", chat->id, chat->recipients_count); list_add(&chats, chat, 0); return NULL; } @@ -330,7 +330,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou // Create new room if (CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM) &gcwindow)) { - debugLog(L"gc_getchat(): Cannot create new chat window %s.", chat->id); + debugLogW(L"gc_getchat(): Cannot create new chat window %s.", chat->id); free(name); free(chat); return NULL; @@ -353,7 +353,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou UIN2IDT(uin, id); wchar_t* nickT; - if (!getTString(GG_KEY_NICK, &dbv)) { + if (!getWString(GG_KEY_NICK, &dbv)) { nickT = mir_wstrdup(dbv.ptszVal); db_free(&dbv); } else { @@ -364,7 +364,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gce.bIsMe = 1; CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); mir_free(nickT); - debugLog(L"gc_getchat(): Myself %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus); + debugLogW(L"gc_getchat(): Myself %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus); } else debugLogA("gc_getchat(): Myself adding failed with uin %d !!!", uin); @@ -386,14 +386,14 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gce.ptszNick = TranslateT("'Unknown'"); gce.bIsMe = 0; gce.dwFlags = 0; - debugLog(L"gc_getchat(): Added %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus); + debugLogW(L"gc_getchat(): Added %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); } gcd.iType = GC_EVENT_CONTROL; CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce); CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); - debugLog(L"gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count); + debugLogW(L"gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count); list_add(&chats, chat, 0); return chat->id; } @@ -641,7 +641,7 @@ int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick) gce.ptszUID = id; gce.ptszText = ptszNick; - debugLog(L"gc_changenick(): Found room %s with uin %d, sending nick change %s.", chat->id, uin, id); + debugLogW(L"gc_changenick(): Found room %s with uin %d, sending nick change %s.", chat->id, uin, id); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); break; diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 106b8e2d5f..719d78591d 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -264,11 +264,11 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) { fwrite(dat->lpData, dat->nSize, 1, fp); fclose(fp); - gg->debugLog(L"gg_img_saveimage(): Image saved to %s.", szFileName); + gg->debugLogW(L"gg_img_saveimage(): Image saved to %s.", szFileName); } else { - gg->debugLog(L"gg_img_saveimage(): Cannot save image to %s.", szFileName); + gg->debugLogW(L"gg_img_saveimage(): Cannot save image to %s.", szFileName); MessageBox(hwnd, TranslateT("Image cannot be written to disk."), gg->m_tszUserName, MB_OK | MB_ICONERROR); } } @@ -398,22 +398,21 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP else dat->gg->debugLogA("gg_img_dlgproc(): WM_INITDIALOG Creation event not found, but someone might be waiting."); // Making buttons flat - SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONSETASFLATBTN, TRUE, 0); - - // Setting images for buttons - SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("previous", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("next", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("delete", FALSE)); - SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("save", FALSE)); - - // Setting tooltips for buttons - SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Previous image"), BATF_TCHAR); - SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Next image"), BATF_TCHAR); - SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete image from the list"), BATF_TCHAR); - SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Save image to disk"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("previous", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Previous image"), BATF_UNICODE); + + SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("next", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Next image"), BATF_UNICODE); + + SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("save", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Save image to disk"), BATF_UNICODE); + + SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("delete", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete image from the list"), BATF_UNICODE); // Set main window image Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_IMAGE)); @@ -812,11 +811,11 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } if ( _waccess(szPath, 0)){ - int ret = CreateDirectoryTreeT(szPath); + int ret = CreateDirectoryTreeW(szPath); if (ret == 0){ - debugLog(L"img_displayasmsg(): Created new directory for image cache: %s.", szPath); + debugLogW(L"img_displayasmsg(): Created new directory for image cache: %s.", szPath); } else { - debugLog(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno)); + debugLogW(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE); @@ -840,7 +839,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) res = fwrite(dat->lpData, dat->nSize, 1, fp) > 0; fclose(fp); } else { - debugLog(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno)); + debugLogW(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); @@ -857,9 +856,9 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) pre.timestamp = time(NULL); pre.szMessage = szMessage; ProtoChainRecvMsg(hContact, &pre); - debugLog(L"img_displayasmsg(): Image saved to %s.", szPath); + debugLogW(L"img_displayasmsg(): Image saved to %s.", szPath); } - else debugLog(L"img_displayasmsg(): Cannot save image to %s.", szPath); + else debugLogW(L"img_displayasmsg(): Cannot save image to %s.", szPath); return 0; } @@ -961,7 +960,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) FILE *fp = _wfopen(szFileName, L"rb"); if (!fp) { free(dat); - debugLog(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno)); + debugLogW(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName); showpopup(m_tszUserName, error, GG_POPUP_ERROR); @@ -973,7 +972,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) { fclose(fp); free(dat); - debugLog(L"img_loadpicture(): Zero file size \"%s\" failed.", szFileName); + debugLogW(L"img_loadpicture(): Zero file size \"%s\" failed.", szFileName); return NULL; } // Maximum acceptable image size @@ -981,7 +980,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) { fclose(fp); free(dat); - debugLog(L"img_loadpicture(): Image size of \"%s\" exceeds 255 KB.", szFileName); + debugLogW(L"img_loadpicture(): Image size of \"%s\" exceeds 255 KB.", szFileName); MessageBox(NULL, TranslateT("Image exceeds maximum allowed size of 255 KB."), m_tszUserName, MB_OK | MB_ICONEXCLAMATION); return NULL; } @@ -992,7 +991,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) free(dat->lpData); fclose(fp); free(dat); - debugLog(L"img_loadpicture(): Reading file \"%s\" failed.", szFileName); + debugLogW(L"img_loadpicture(): Reading file \"%s\" failed.", szFileName); return NULL; } fclose(fp); @@ -1037,7 +1036,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) } // Load image from file else - dat->hBitmap = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) szFileName, IMGL_TCHAR); + dat->hBitmap = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) szFileName, IMGL_WCHAR); // If everything is fine return the handle if (dat->hBitmap) return dat; diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 6e8e3f43f0..b2b686b4dc 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -32,7 +32,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup FirstName DBVARIANT dbv; - if (!gg->getTString(hContact, GG_KEY_PD_FIRSTNAME, &dbv)) + if (!gg->getWString(hContact, GG_KEY_PD_FIRSTNAME, &dbv)) { char* pszValA = mir_u2a(dbv.ptszVal); string_append(s, dbv.pszVal); @@ -41,7 +41,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) } string_append_c(s, ';'); // Readup LastName - if (!gg->getTString(hContact, GG_KEY_PD_LASTNAME, &dbv)) + if (!gg->getWString(hContact, GG_KEY_PD_LASTNAME, &dbv)) { char* pszValA = mir_u2a(dbv.ptszVal); string_append(s, dbv.pszVal); @@ -51,11 +51,11 @@ char *gg_makecontacts(GGPROTO *gg, int cr) string_append_c(s, ';'); // Readup Nick - if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !gg->getTString(hContact, GG_KEY_NICK, &dbv)) + if (!db_get_ws(hContact, "CList", "MyHandle", &dbv) || !gg->getWString(hContact, GG_KEY_NICK, &dbv)) { char* dbvA = mir_u2a(dbv.ptszVal); DBVARIANT dbv2; - if (!gg->getTString(hContact, GG_KEY_PD_NICKNAME, &dbv2)) + if (!gg->getWString(hContact, GG_KEY_PD_NICKNAME, &dbv2)) { char* pszValA = mir_u2a(dbv2.ptszVal); string_append(s, pszValA); @@ -218,18 +218,18 @@ void GGPROTO::parsecontacts(char *contacts) if (hContact && strGroup) { ptrW tszGrpName( mir_a2u(strGroup)); Clist_GroupCreate(0, tszGrpName); - db_set_ts(hContact, "CList", "Group", tszGrpName); + db_set_ws(hContact, "CList", "Group", tszGrpName); } // Write misc data if (hContact && strFirstName){ wchar_t *tstrFirstName = mir_a2u(strFirstName); - setTString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName); + setWString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName); mir_free(tstrFirstName); } if (hContact && strLastName){ wchar_t *tstrLastName = mir_a2u(strLastName); - setTString(hContact, GG_KEY_PD_LASTNAME, tstrLastName); + setWString(hContact, GG_KEY_PD_LASTNAME, tstrLastName); mir_free(tstrLastName); } if (hContact && strPhone) db_set_s(hContact, "UserInfo", "MyPhone0", strPhone); // Store now in User Info @@ -280,7 +280,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1); mir_snwprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); - debugLog(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno)); + debugLogW(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno)); } gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 2, "sess_mutex", 1); @@ -318,7 +318,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1); mir_snwprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); - debugLog(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno)); + debugLogW(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno)); } gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 2, "sess_mutex", 1); @@ -392,7 +392,7 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) wchar_t error[256]; mir_snwprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); - debugLog(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno)); + debugLogW(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno)); if (f) fclose(f); return 0; @@ -436,7 +436,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) ofn.lpstrDefExt = L"txt"; #ifdef DEBUGMODE - debugLog(L"export_text(%s).", str); + debugLogW(L"export_text(%s).", str); #endif if (!GetSaveFileName(&ofn)) return 0; @@ -454,7 +454,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) wchar_t error[128]; mir_snwprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); - debugLog(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno)); + debugLogW(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno)); } return 0; @@ -498,7 +498,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1); mir_snwprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); - debugLog(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno)); + debugLogW(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno)); } gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 2, "sess_mutex", 1); @@ -515,7 +515,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) void GGPROTO::import_init(HGENMENU hRoot) { CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.root = hRoot; // Import from server item diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index cc388ac8e8..6fc1a996ca 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -116,7 +116,7 @@ void GGPROTO::links_instance_init() { if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.position = g_Instances.getCount(); mi.name.w = m_tszUserName; hInstanceMenuItem = Menu_AddItem(hInstanceMenu, &mi, this); diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index c89521354f..6a11db6a33 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -59,7 +59,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) wchar_t error[128]; mir_snwprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); - debugLog(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno)); + debugLogW(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno)); } else { diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 7712477bc2..0d68758a86 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -79,7 +79,7 @@ void GGPROTO::initpopups() puc.cbSize = sizeof(puc); puc.PluginWindowProc = PopupWindowProc; puc.flags = PCF_TCHAR; - puc.ptszDescription = szDescr; + puc.pwszDescription = szDescr; puc.pszName = szName; puc.colorBack = RGB(173, 206, 247); diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index e0fde48c40..fbb314a22c 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -188,7 +188,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) //directly check if contact has protected user avatar set by AVS, and if yes return it as protocol avatar DBVARIANT dbv; - if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) { + if (!db_get_ws(pai->hContact, "ContactPhoto", "Backup", &dbv)) { if ((mir_wstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){ debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS"); wcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal); @@ -235,12 +235,12 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) } requestAvatarTransfer(pai->hContact, AvatarURL); - debugLog(L"getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged but file %s does not exist. errno=%d: %s. requestAvatarTransfer() fired. return GAIR_WAITFOR", uin, pai->filename, errno, ws_strerror(errno)); + debugLogW(L"getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged but file %s does not exist. errno=%d: %s. requestAvatarTransfer() fired. return GAIR_WAITFOR", uin, pai->filename, errno, ws_strerror(errno)); return GAIR_WAITFOR; } if ((wParam & GAIF_FORCE) != 0) { if (_wremove(pai->filename) != 0){ - debugLog(L"getavatarinfo(): refresh. _wremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); + debugLogW(L"getavatarinfo(): refresh. _wremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); @@ -255,7 +255,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (AvatarHash == NULL && AvatarSavedHash != NULL) { getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename)); if (_wremove(pai->filename) != 0){ - debugLog(L"getavatarinfo(): delete. _wremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); + debugLogW(L"getavatarinfo(): delete. _wremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); wchar_t error[512]; mir_snwprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); @@ -302,7 +302,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) debugLogA("getmyavatar(): Incoming request for self avatar information. returned ok."); return 0; } else { - debugLog(L"getmyavatar(): Incoming request for self avatar information. saved avatar file %s does not exist. return -1 (error)", szFilename); + debugLogW(L"getmyavatar(): Incoming request for self avatar information. saved avatar file %s does not exist. return -1 (error)", szFilename); return -1; } diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index cd2225ddad..cdf748a66d 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -417,7 +417,7 @@ BOOL GGPROTO::sessions_closedlg() void GGPROTO::sessions_menus_init(HGENMENU hRoot) { CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.root = hRoot; mi.pszService = GGS_CONCUR_SESS; diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 2b8be7fb7a..6fea4ce96e 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -44,7 +44,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Registration rejected") : ws_strerror(errno))); MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP); - gg->debugLog(L"gg_doregister(): Cannot register. errno=%d: %s", errno, ws_strerror(errno)); + gg->debugLogW(L"gg_doregister(): Cannot register. errno=%d: %s", errno, ws_strerror(errno)); } else { gg->setDword(GG_KEY_UIN, s->uin); @@ -90,7 +90,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad number or password") : ws_strerror(errno))); MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP); - gg->debugLog(L"gg_dounregister(): Cannot remove account. errno=%d: %s", errno, ws_strerror(errno)); + gg->debugLogW(L"gg_dounregister(): Cannot remove account. errno=%d: %s", errno, ws_strerror(errno)); } else { @@ -142,7 +142,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Invalid data entered") : ws_strerror(errno))); MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP); - gg->debugLog(L"gg_dochpass(): Cannot change password. errno=%d: %s", errno, ws_strerror(errno)); + gg->debugLogW(L"gg_dochpass(): Cannot change password. errno=%d: %s", errno, ws_strerror(errno)); } else { @@ -183,7 +183,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne mir_snwprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"), (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno))); MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP); - gg->debugLog(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno)); + gg->debugLogW(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno)); } else { diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index c4f076d1c7..8ef7cab404 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port) +BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmask, unsigned long adr, int port) { MCONTACT hContact; wchar_t szNick[256]; @@ -34,7 +34,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && db_get_b(hc, "CList", "Hidden", 0) == 0) bFlag = true; - CMString contactname = name; contactname += DCCSTRING; + CMStringW contactname = name; contactname += DCCSTRING; CONTACT user = { (wchar_t*)contactname.c_str(), NULL, NULL, false, false, true }; hContact = CList_AddContact(&user, false, false); @@ -89,7 +89,7 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) if (hContact) { if (InList) db_unset(hContact, "CList", "NotOnList"); - setTString(hContact, "Nick", user->name); + setWString(hContact, "Nick", user->name); db_unset(hContact, "CList", "Hidden"); if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) setWord(hContact, "Status", ID_STATUS_ONLINE); @@ -106,8 +106,8 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) else db_set_b(hContact, "CList", "NotOnList", 1); db_unset(hContact, "CList", "Hidden"); - setTString(hContact, "Nick", user->name); - setTString(hContact, "Default", user->name); + setWString(hContact, "Nick", user->name); + setWString(hContact, "Default", user->name); setWord(hContact, "Status", SetOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE); if (!InList && getByte("MirVerAutoRequestTemp", 0)) PostIrcMessage(L"/PRIVMSG %s \001VERSION\001", user->name); @@ -121,10 +121,10 @@ MCONTACT CIrcProto::CList_SetOffline(CONTACT *user) MCONTACT hContact = CList_FindContact(user); if (hContact) { DBVARIANT dbv; - if (!getTString(hContact, "Default", &dbv)) { + if (!getWString(hContact, "Default", &dbv)) { setString(hContact, "User", ""); setString(hContact, "Host", ""); - setTString(hContact, "Nick", dbv.ptszVal); + setWString(hContact, "Nick", dbv.ptszVal); setWord(hContact, "Status", ID_STATUS_OFFLINE); db_free(&dbv); return hContact; @@ -148,8 +148,8 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) if (ChatsToo) setWord(hContact, "Status", ID_STATUS_OFFLINE); } - else if (!getTString(hContact, "Default", &dbv)) { - setTString(hContact, "Nick", dbv.ptszVal); + else if (!getWString(hContact, "Default", &dbv)) { + setWString(hContact, "Nick", dbv.ptszVal); setWord(hContact, "Status", ID_STATUS_OFFLINE); db_free(&dbv); } @@ -173,11 +173,11 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) continue; MCONTACT hContact_temp = NULL; - ptrW DBNick(getTStringA(hContact, "Nick")); - ptrW DBUser(getTStringA(hContact, "UUser")); - ptrW DBHost(getTStringA(hContact, "UHost")); - ptrW DBDefault(getTStringA(hContact, "Default")); - ptrW DBWildcard(getTStringA(hContact, "UWildcard")); + ptrW DBNick(getWStringA(hContact, "Nick")); + ptrW DBUser(getWStringA(hContact, "UUser")); + ptrW DBHost(getWStringA(hContact, "UHost")); + ptrW DBDefault(getWStringA(hContact, "Default")); + ptrW DBWildcard(getWStringA(hContact, "UWildcard")); if (DBWildcard) CharLower(DBWildcard); diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index ab36e0d46e..cfd91e12b1 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -93,7 +93,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) return; } - CMString name = GetWord(ppro->m_channelsToWho.c_str(), 0); + CMStringW name = GetWord(ppro->m_channelsToWho.c_str(), 0); if (name.IsEmpty()) { ppro->m_channelsToWho = L""; int count = (int)CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)ppro->m_szModuleName); @@ -104,7 +104,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) gci.pszModule = ppro->m_szModuleName; if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM) if (gci.iCount <= ppro->m_onlineNotificationLimit) - ppro->m_channelsToWho += CMString(gci.pszName) + L" "; + ppro->m_channelsToWho += CMStringW(gci.pszName) + L" "; } } @@ -115,7 +115,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) name = GetWord(ppro->m_channelsToWho.c_str(), 0); ppro->DoUserhostWithReason(2, L"S" + name, true, L"%s", name.c_str()); - CMString temp = GetWordAddress(ppro->m_channelsToWho.c_str(), 1); + CMStringW temp = GetWordAddress(ppro->m_channelsToWho.c_str(), 1); ppro->m_channelsToWho = temp; if (ppro->m_iTempCheckTime) ppro->SetChatTimer(ppro->OnlineNotifTimer3, ppro->m_iTempCheckTime * 1000, OnlineNotifTimerProc3); @@ -136,8 +136,8 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) return; } - CMString name = GetWord(ppro->m_namesToWho.c_str(), 0); - CMString name2 = GetWord(ppro->m_namesToUserhost.c_str(), 0); + CMStringW name = GetWord(ppro->m_namesToWho.c_str(), 0); + CMStringW name2 = GetWord(ppro->m_namesToUserhost.c_str(), 0); if (name.IsEmpty() && name2.IsEmpty()) { DBVARIANT dbv; @@ -149,14 +149,14 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) BYTE bHidden = db_get_b(hContact, "CList", "Hidden", 0); if (bDCC || bHidden) continue; - if (ppro->getTString(hContact, "Default", &dbv)) + if (ppro->getWString(hContact, "Default", &dbv)) continue; BYTE bAdvanced = ppro->getByte(hContact, "AdvancedMode", 0); if (!bAdvanced) { db_free(&dbv); - if (!ppro->getTString(hContact, "Nick", &dbv)) { - ppro->m_namesToUserhost += CMString(dbv.ptszVal) + L" "; + if (!ppro->getWString(hContact, "Nick", &dbv)) { + ppro->m_namesToUserhost += CMStringW(dbv.ptszVal) + L" "; db_free(&dbv); } } @@ -166,15 +166,15 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) wchar_t* DBNick = NULL; wchar_t* DBWildcard = NULL; - if (!ppro->getTString(hContact, "Nick", &dbv)) + if (!ppro->getWString(hContact, "Nick", &dbv)) DBNick = dbv.ptszVal; - if (!ppro->getTString(hContact, "UWildcard", &dbv2)) + if (!ppro->getWString(hContact, "UWildcard", &dbv2)) DBWildcard = dbv2.ptszVal; if (DBNick && (!DBWildcard || !WCCmp(CharLower(DBWildcard), CharLower(DBNick)))) - ppro->m_namesToWho += CMString(DBNick) + L" "; + ppro->m_namesToWho += CMStringW(DBNick) + L" "; else if (DBWildcard) - ppro->m_namesToWho += CMString(DBWildcard) + L" "; + ppro->m_namesToWho += CMStringW(DBWildcard) + L" "; if (DBNick) db_free(&dbv); if (DBWildcard) db_free(&dbv2); @@ -189,7 +189,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) name = GetWord(ppro->m_namesToWho.c_str(), 0); name2 = GetWord(ppro->m_namesToUserhost.c_str(), 0); - CMString temp; + CMStringW temp; if (!name.IsEmpty()) { ppro->DoUserhostWithReason(2, L"S" + name, true, L"%s", name.c_str()); temp = GetWordAddress(ppro->m_namesToWho.c_str(), 1); @@ -197,14 +197,14 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) } if (!name2.IsEmpty()) { - CMString params; + CMStringW params; for (int i = 0; i < 3; i++) { params = L""; for (int j = 0; j < 5; j++) params += GetWord(ppro->m_namesToUserhost, i * 5 + j) + L" "; if (params[0] != ' ') - ppro->DoUserhostWithReason(1, CMString(L"S") + params, true, params); + ppro->DoUserhostWithReason(1, CMStringW(L"S") + params, true, params); } temp = GetWordAddress(ppro->m_namesToUserhost.c_str(), 15); ppro->m_namesToUserhost = temp; @@ -221,7 +221,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, wchar_t* msg) if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING) return 0; - CMString S = DoColorCodes(msg, TRUE, FALSE); + CMStringW S = DoColorCodes(msg, TRUE, FALSE); DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; @@ -274,7 +274,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) { static wchar_t host[1024]; int i = 0; - CMString word = GetWord(pmsg->parameters[1].c_str(), i); + CMStringW word = GetWord(pmsg->parameters[1].c_str(), i); while (!word.IsEmpty()) { if (wcschr(word.c_str(), '!') && wcschr(word.c_str(), '@')) { mir_wstrncpy(host, word.c_str(), _countof(host)); @@ -293,7 +293,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHOTOOLONG(const CIrcMessage* pmsg) { - CMString command = GetNextUserhostReason(2); + CMStringW command = GetNextUserhostReason(2); if (command[0] == 'U') ShowMessage(pmsg); @@ -357,7 +357,7 @@ bool CIrcProto::OnIrc_SETAWAY(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_JOIN(const CIrcMessage* pmsg) { if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming && pmsg->prefix.sNick != m_info.sNick) { - CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; + CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; DoEvent(GC_EVENT_JOIN, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), NULL, L"Normal", host.c_str(), NULL, true, false); DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE); } @@ -369,7 +369,7 @@ bool CIrcProto::OnIrc_JOIN(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg) { if (pmsg->m_bIncoming) { - CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; + CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; DoEvent(GC_EVENT_QUIT, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 0 ? pmsg->parameters[0].c_str() : NULL, NULL, host.c_str(), NULL, true, false); struct CONTACT user = { (LPTSTR)pmsg->prefix.sNick.c_str(), (LPTSTR)pmsg->prefix.sUser.c_str(), (LPTSTR)pmsg->prefix.sHost.c_str(), false, false, false }; CList_SetOffline(&user); @@ -387,10 +387,10 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg) { if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming) { - CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; + CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; DoEvent(GC_EVENT_PART, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : NULL, NULL, host.c_str(), NULL, true, false); if (pmsg->prefix.sNick == m_info.sNick) { - CMString S = MakeWndID(pmsg->parameters[0].c_str()); + CMStringW S = MakeWndID(pmsg->parameters[0].c_str()); GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; CallChatEvent(SESSION_OFFLINE, (LPARAM)&gce); @@ -409,7 +409,7 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg) ShowMessage(pmsg); if (pmsg->parameters[1] == m_info.sNick) { - CMString S = MakeWndID(pmsg->parameters[0].c_str()); + CMStringW S = MakeWndID(pmsg->parameters[0].c_str()); GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; CallChatEvent(SESSION_OFFLINE, (LPARAM)&gce); @@ -429,8 +429,8 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_MODEQUERY(const CIrcMessage* pmsg) { if (pmsg->parameters.getCount() > 2 && pmsg->m_bIncoming && IsChannel(pmsg->parameters[1])) { - CMString sPassword = L""; - CMString sLimit = L""; + CMStringW sPassword = L""; + CMStringW sLimit = L""; bool bAdd = false; int iParametercount = 3; @@ -464,8 +464,8 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) { bool flag = false; bool bContainsValidModes = false; - CMString sModes = L""; - CMString sParams = L""; + CMStringW sModes = L""; + CMStringW sParams = L""; if (pmsg->parameters.getCount() > 1 && pmsg->m_bIncoming) { if (IsChannel(pmsg->parameters[0])) { @@ -495,7 +495,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) iParametercount++; } if (strchr(sUserModes.c_str(), (char)*p1)) { - CMString sStatus = ModeToStatus(*p1); + CMStringW sStatus = ModeToStatus(*p1); if ((int)pmsg->parameters.getCount() > iParametercount) { if (!mir_wstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) { char cModeBit = -1; @@ -535,7 +535,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) mir_snwprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str()); - CMString sMessage = temp; + CMStringW sMessage = temp; for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) sMessage += L" " + pmsg->parameters[i]; @@ -557,7 +557,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) wchar_t temp[256]; mir_snwprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str()); - CMString sMessage = temp; + CMStringW sMessage = temp; for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) sMessage += L" " + pmsg->parameters[i]; @@ -576,10 +576,10 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) if (m_info.sNick == pmsg->prefix.sNick && pmsg->parameters.getCount() > 0) { m_info.sNick = pmsg->parameters[0]; - setTString("Nick", m_info.sNick.c_str()); + setWString("Nick", m_info.sNick.c_str()); } - CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; + CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; DoEvent(GC_EVENT_NICK, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, host.c_str(), NULL, true, bIsMe); DoEvent(GC_EVENT_CHUID, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, NULL, NULL, true, false); @@ -588,9 +588,9 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) if (hContact) { if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) setWord(hContact, "Status", ID_STATUS_ONLINE); - setTString(hContact, "Nick", pmsg->parameters[0].c_str()); - setTString(hContact, "User", pmsg->prefix.sUser.c_str()); - setTString(hContact, "Host", pmsg->prefix.sHost.c_str()); + setWString(hContact, "Nick", pmsg->parameters[0].c_str()); + setWString(hContact, "User", pmsg->prefix.sUser.c_str()); + setWString(hContact, "Host", pmsg->prefix.sHost.c_str()); } } else ShowMessage(pmsg); @@ -605,9 +605,9 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) return true; if (!m_ignore || !IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'n')) { - CMString S; - CMString S2; - CMString S3; + CMStringW S; + CMStringW S2; + CMStringW S3; if (pmsg->prefix.sNick.GetLength() > 0) S = pmsg->prefix.sNick; else @@ -620,11 +620,11 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) gci.Flags = GCF_BYID | GCF_TYPE; gci.pszModule = m_szModuleName; - CMString str = GetWord(pmsg->parameters[1].c_str(), 0); + CMStringW str = GetWord(pmsg->parameters[1].c_str(), 0); if (str[0] == '[' && str[1] == '#' && str[str.GetLength() - 1] == ']') { str.Delete(str.GetLength() - 1, 1); str.Delete(0, 1); - CMString Wnd = MakeWndID(str.c_str()); + CMStringW Wnd = MakeWndID(str.c_str()); gci.pszID = Wnd.c_str(); if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM) S2 = GetWord(gci.pszID, 0); @@ -685,7 +685,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) if (IsCTCP(pmsg)) return true; - CMString mess = pmsg->parameters[1]; + CMStringW mess = pmsg->parameters[1]; bool bIsChannel = IsChannel(pmsg->parameters[0]); if (pmsg->m_bIncoming && !bIsChannel) { @@ -708,8 +708,8 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) PROTORECVEVENT pre = { 0 }; pre.timestamp = (DWORD)time(NULL); pre.szMessage = mir_utf8encodeW(mess.c_str()); - setTString(hContact, "User", pmsg->prefix.sUser.c_str()); - setTString(hContact, "Host", pmsg->prefix.sHost.c_str()); + setWString(hContact, "User", pmsg->prefix.sUser.c_str()); + setWString(hContact, "Host", pmsg->prefix.sHost.c_str()); ProtoChainRecvMsg(hContact, &pre); mir_free(pre.szMessage); return true; @@ -732,7 +732,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) { // is it a ctcp command, i e is the first and last characer of a PRIVMSG or NOTICE text ASCII 1 - CMString mess = pmsg->parameters[1]; + CMStringW mess = pmsg->parameters[1]; if (!(mess.GetLength() > 3 && mess[0] == 1 && mess[mess.GetLength() - 1] == 1)) return false; @@ -749,8 +749,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) } // extract the type of ctcp command - CMString ocommand = GetWord(mess.c_str(), 0); - CMString command = GetWord(mess.c_str(), 0); + CMStringW ocommand = GetWord(mess.c_str(), 0); + CMStringW command = GetWord(mess.c_str(), 0); command.MakeLower(); // should it be ignored? @@ -854,15 +854,15 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // incoming DCC request... lots of stuff happening here... else if (pmsg->m_bIncoming && command == L"dcc") { - CMString type = GetWord(mess.c_str(), 1); + CMStringW type = GetWord(mess.c_str(), 1); type.MakeLower(); // components of a dcc message - CMString sFile = L""; + CMStringW sFile = L""; DWORD dwAdr = 0; int iPort = 0; unsigned __int64 dwSize = 0; - CMString sToken = L""; + CMStringW sToken = L""; bool bIsChat = (type == L"chat"); // 1. separate the dcc command into the correct pieces @@ -878,7 +878,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end); if (begin >= 0) { - CMString rest = mess.Mid(begin); + CMStringW rest = mess.Mid(begin); dwAdr = wcstoul(GetWord(rest.c_str(), 0).c_str(), NULL, 10); iPort = _wtoi(GetWord(rest.c_str(), 1).c_str()); dwSize = _wtoi64(GetWord(rest.c_str(), 2).c_str()); @@ -894,7 +894,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // look for the part of the ctcp command that contains adress, port and size while (!bFlag && !GetWord(mess.c_str(), index).IsEmpty()) { - CMString sTemp; + CMStringW sTemp; if (type == L"chat") sTemp = GetWord(mess.c_str(), index - 1) + GetWord(mess.c_str(), index); @@ -951,7 +951,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end); if (begin >= 0) { - CMString rest = mess.Mid(begin); + CMStringW rest = mess.Mid(begin); iPort = _wtoi(GetWord(rest.c_str(), 0).c_str()); dwSize = _wtoi(GetWord(rest.c_str(), 1).c_str()); sToken = GetWord(rest.c_str(), 2); @@ -966,7 +966,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // look for the part of the ctcp command that contains adress, port and size while (!bFlag && !GetWord(mess.c_str(), index).IsEmpty()) { - CMString sTemp = GetWord(mess.c_str(), index - 1) + GetWord(mess.c_str(), index); + CMStringW sTemp = GetWord(mess.c_str(), index - 1) + GetWord(mess.c_str(), index); // if all characters are number it indicates we have found the adress, port and size parameters int ind = 0; @@ -1033,7 +1033,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) } // remove path from the filename if the remote client (stupidly) sent it - CMString sFileCorrected = sFile; + CMStringW sFileCorrected = sFile; int i = sFile.ReverseFind('\\'); if (i != -1) sFileCorrected = sFile.Mid(i + 1); @@ -1055,7 +1055,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) } // remove path from the filename if the remote client (stupidly) sent it - CMString sFileCorrected = sFile; + CMStringW sFileCorrected = sFile; int i = sFile.ReverseFind('\\'); if (i != -1) sFileCorrected = sFile.Mid(i + 1); @@ -1074,7 +1074,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) m_DCCChatIgnore == 2 && hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0 && db_get_b(hContact, "CList", "Hidden", 0) == 0) { - CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; + CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost; CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist } else { @@ -1115,7 +1115,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) } if (type == L"send") { - CMString sTokenBackup = sToken; + CMStringW sTokenBackup = sToken; bool bTurbo = false; // TDCC indicator if (!sToken.IsEmpty() && sToken[sToken.GetLength() - 1] == 'T') { @@ -1157,13 +1157,13 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) if (di->bReverse) di->sToken = sTokenBackup; - setTString(hContact, "User", pmsg->prefix.sUser.c_str()); - setTString(hContact, "Host", pmsg->prefix.sHost.c_str()); + setWString(hContact, "User", pmsg->prefix.sUser.c_str()); + setWString(hContact, "Host", pmsg->prefix.sHost.c_str()); wchar_t* tszTemp = (wchar_t*)sFile.c_str(); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.timestamp = (DWORD)time(NULL); pre.fileCount = 1; pre.files.w = &tszTemp; @@ -1191,7 +1191,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false }; MCONTACT hContact = CList_FindContact(&user); if (hContact) - setTString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE)); + setWString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE)); } // if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window @@ -1244,7 +1244,7 @@ bool CIrcProto::OnIrc_NAMES(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) { if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) { - CMString name = L"a"; + CMStringW name = L"a"; int i = 0; BOOL bFlag = false; @@ -1270,7 +1270,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) sChanName++; // Add a new chat window - CMString sID = MakeWndID(sChanName); + CMStringW sID = MakeWndID(sChanName); BYTE btOwnMode = 0; GCSESSION gcw = { sizeof(gcw) }; @@ -1300,12 +1300,12 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) CallChatEvent(0, (LPARAM)&gce); { int k = 0; - CMString sTemp = GetWord(sNamesList.c_str(), k); + CMStringW sTemp = GetWord(sNamesList.c_str(), k); // Fill the nicklist while (!sTemp.IsEmpty()) { - CMString sStat; - CMString sTemp2 = sTemp; + CMStringW sStat; + CMStringW sTemp2 = sTemp; sStat = PrefixToStatus(sTemp[0]); // fix for networks like freshirc where they allow more than one prefix @@ -1386,16 +1386,16 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) gce.time = time(0); gce.pDest = &gcd; - if (!getTString("JTemp", &dbv)) { - CMString command = L"a"; - CMString save = L""; + if (!getWString("JTemp", &dbv)) { + CMStringW command = L"a"; + CMStringW save = L""; int k = 0; while (!command.IsEmpty()) { command = GetWord(dbv.ptszVal, k); k++; if (!command.IsEmpty()) { - CMString S = command.Mid(1); + CMStringW S = command.Mid(1); if (!mir_wstrcmpi(sChanName, S)) break; @@ -1422,7 +1422,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) if (save.IsEmpty()) db_unset(NULL, m_szModuleName, "JTemp"); else - setTString("JTemp", save.c_str()); + setWString("JTemp", save.c_str()); db_free(&dbv); } else CallChatEvent(SESSION_INITDONE, (LPARAM)&gce); @@ -1533,7 +1533,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) } lvItem.iSubItem = 3; - CMString S = DoColorCodes(temp, TRUE, FALSE); + CMStringW S = DoColorCodes(temp, TRUE, FALSE); lvItem.pszText = (wchar_t*)S.c_str(); ListView_SetItem(hListView, &lvItem); temp = save; @@ -1587,7 +1587,7 @@ bool CIrcProto::OnIrc_BANLIST(const CIrcMessage* pmsg) m_managerDlg->m_radio2.GetState() && pmsg->sCommand == L"346" || m_managerDlg->m_radio3.GetState() && pmsg->sCommand == L"348") && !m_managerDlg->m_radio1.Enabled() && !m_managerDlg->m_radio2.Enabled() && !m_managerDlg->m_radio3.Enabled()) { - CMString S = pmsg->parameters[2]; + CMStringW S = pmsg->parameters[2]; if (pmsg->parameters.getCount() > 3) { S += L" - "; S += pmsg->parameters[3]; @@ -1767,21 +1767,21 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) CONTACT user = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false }; MCONTACT hContact = CList_FindContact(&user); if (hContact) { - AddOutgoingMessageToDB(hContact, (wchar_t*)((CMString)L"> " + pmsg->parameters[2] + (CMString)L": " + pmsg->parameters[1]).c_str()); + AddOutgoingMessageToDB(hContact, (wchar_t*)((CMStringW)L"> " + pmsg->parameters[2] + (CMStringW)L": " + pmsg->parameters[1]).c_str()); DBVARIANT dbv; - if (!getTString(hContact, "Default", &dbv)) { - setTString(hContact, "Nick", dbv.ptszVal); + if (!getWString(hContact, "Default", &dbv)) { + setWString(hContact, "Nick", dbv.ptszVal); DBVARIANT dbv2; if (getByte(hContact, "AdvancedMode", 0) == 0) - DoUserhostWithReason(1, ((CMString)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal); + DoUserhostWithReason(1, ((CMStringW)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal); else { - if (!getTString(hContact, "UWildcard", &dbv2)) { - DoUserhostWithReason(2, ((CMString)L"S" + dbv2.ptszVal).c_str(), true, dbv2.ptszVal); + if (!getWString(hContact, "UWildcard", &dbv2)) { + DoUserhostWithReason(2, ((CMStringW)L"S" + dbv2.ptszVal).c_str(), true, dbv2.ptszVal); db_free(&dbv2); } - else DoUserhostWithReason(2, ((CMString)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal); + else DoUserhostWithReason(2, ((CMStringW)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal); } setString(hContact, "User", ""); setString(hContact, "Host", ""); @@ -1833,9 +1833,9 @@ bool CIrcProto::OnIrc_JOINERROR(const CIrcMessage* pmsg) { if (pmsg->m_bIncoming) { DBVARIANT dbv; - if (!getTString("JTemp", &dbv)) { - CMString command = L"a"; - CMString save = L""; + if (!getWString("JTemp", &dbv)) { + CMStringW command = L"a"; + CMStringW save = L""; int i = 0; while (!command.IsEmpty()) { @@ -1851,7 +1851,7 @@ bool CIrcProto::OnIrc_JOINERROR(const CIrcMessage* pmsg) if (save.IsEmpty()) db_unset(NULL, m_szModuleName, "JTemp"); else - setTString("JTemp", save.c_str()); + setWString("JTemp", save.c_str()); } } @@ -1899,7 +1899,7 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg) msn.szProto = m_szModuleName; msn.tszInfoTitle = TranslateT("IRC error"); - CMString S; + CMStringW S; if (pmsg->parameters.getCount() > 0) S = DoColorCodes(pmsg->parameters[0].c_str(), TRUE, FALSE); else @@ -1916,13 +1916,13 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) { - CMString command = GetNextUserhostReason(2); + CMStringW command = GetNextUserhostReason(2); if (command[0] == 'S') { if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) { // is it a channel? if (IsChannel(pmsg->parameters[1])) { - CMString S; - CMString User = GetWord(m_whoReply.c_str(), 0); + CMStringW S; + CMStringW User = GetWord(m_whoReply.c_str(), 0); while (!User.IsEmpty()) { if (GetWord(m_whoReply.c_str(), 3)[0] == 'G') { S += User; @@ -1931,7 +1931,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) } else DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[1].c_str(), User.c_str(), NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE); - CMString SS = GetWordAddress(m_whoReply.c_str(), 4); + CMStringW SS = GetWordAddress(m_whoReply.c_str(), 4); if (SS.IsEmpty()) break; m_whoReply = SS; @@ -1950,20 +1950,20 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) MCONTACT hContact = CList_FindContact(&ccUser); if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) { - ptrW DBHost(getTStringA(hContact, "UHost")); - ptrW DBNick(getTStringA(hContact, "Nick")); - ptrW DBUser(getTStringA(hContact, "UUser")); - ptrW DBDefault(getTStringA(hContact, "Default")); - ptrW DBManUser(getTStringA(hContact, "User")); - ptrW DBManHost(getTStringA(hContact, "Host")); - ptrW DBWildcard(getTStringA(hContact, "UWildcard")); + ptrW DBHost(getWStringA(hContact, "UHost")); + ptrW DBNick(getWStringA(hContact, "Nick")); + ptrW DBUser(getWStringA(hContact, "UUser")); + ptrW DBDefault(getWStringA(hContact, "Default")); + ptrW DBManUser(getWStringA(hContact, "User")); + ptrW DBManHost(getWStringA(hContact, "Host")); + ptrW DBWildcard(getWStringA(hContact, "UWildcard")); if (DBWildcard) CharLower(DBWildcard); - CMString nick; - CMString user; - CMString host; - CMString away = GetWord(p1, 3); + CMStringW nick; + CMStringW user; + CMStringW host; + CMStringW away = GetWord(p1, 3); while (!away.IsEmpty()) { nick = GetWord(p1, 0); @@ -1977,11 +1977,11 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) setWord(hContact, "Status", ID_STATUS_ONLINE); if ((DBNick && mir_wstrcmpi(nick.c_str(), DBNick)) || !DBNick) - setTString(hContact, "Nick", nick.c_str()); + setWString(hContact, "Nick", nick.c_str()); if ((DBManUser && mir_wstrcmpi(user.c_str(), DBManUser)) || !DBManUser) - setTString(hContact, "User", user.c_str()); + setWString(hContact, "User", user.c_str()); if ((DBManHost && mir_wstrcmpi(host.c_str(), DBManHost)) || !DBManHost) - setTString(hContact, "Host", host.c_str()); + setWString(hContact, "Host", host.c_str()); return true; } p1 = GetWordAddress(p1, 4); @@ -1989,9 +1989,9 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) } if (DBWildcard && DBNick && !WCCmp(CharLower(DBWildcard), CharLower(DBNick))) { - setTString(hContact, "Nick", DBDefault); + setWString(hContact, "Nick", DBDefault); - DoUserhostWithReason(2, ((CMString)L"S" + DBWildcard).c_str(), true, (wchar_t*)DBWildcard); + DoUserhostWithReason(2, ((CMStringW)L"S" + DBWildcard).c_str(), true, (wchar_t*)DBWildcard); setString(hContact, "User", ""); setString(hContact, "Host", ""); @@ -2000,7 +2000,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { setWord(hContact, "Status", ID_STATUS_OFFLINE); - setTString(hContact, "Nick", DBDefault); + setWString(hContact, "Nick", DBDefault); setString(hContact, "User", ""); setString(hContact, "Host", ""); } @@ -2013,7 +2013,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg) { - CMString command = PeekAtReasons(2); + CMStringW command = PeekAtReasons(2); if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 6 && command[0] == 'S') { m_whoReply.AppendFormat(L"%s %s %s %s ", pmsg->parameters[5].c_str(), pmsg->parameters[2].c_str(), pmsg->parameters[3].c_str(), pmsg->parameters[6].c_str()); if (mir_wstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) { @@ -2030,7 +2030,7 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_TRYAGAIN(const CIrcMessage* pmsg) { - CMString command = L""; + CMStringW command = L""; if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) { if (pmsg->parameters[1] == L"WHO") command = GetNextUserhostReason(2); @@ -2045,27 +2045,27 @@ bool CIrcProto::OnIrc_TRYAGAIN(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) { - CMString command; + CMStringW command; if (pmsg->m_bIncoming) { command = GetNextUserhostReason(1); if (!command.IsEmpty() && command != L"U" && pmsg->parameters.getCount() > 1) { CONTACT finduser = { NULL, NULL, NULL, false, false, false }; int awaystatus = 0; - CMString sTemp; - CMString host; - CMString user; - CMString nick; - CMString mask; - CMString mess; - CMString channel; + CMStringW sTemp; + CMStringW host; + CMStringW user; + CMStringW nick; + CMStringW mask; + CMStringW mess; + CMStringW channel; // Status-check pre-processing: Setup check-list - OBJLIST checklist(10); + OBJLIST checklist(10); if (command[0] == 'S') { sTemp = GetWord(command.c_str(), 0); sTemp.Delete(0, 1); for (int j = 1; !sTemp.IsEmpty(); j++) { - checklist.insert(new CMString(sTemp)); + checklist.insert(new CMStringW(sTemp)); sTemp = GetWord(command.c_str(), j); } } @@ -2113,9 +2113,9 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) MCONTACT hContact = CList_FindContact(&finduser); if (hContact && getByte(hContact, "AdvancedMode", 0) == 0) { setWord(hContact, "Status", awaystatus == '-' ? ID_STATUS_AWAY : ID_STATUS_ONLINE); - setTString(hContact, "User", user.c_str()); - setTString(hContact, "Host", host.c_str()); - setTString(hContact, "Nick", nick.c_str()); + setWString(hContact, "User", user.c_str()); + setWString(hContact, "Host", host.c_str()); + setWString(hContact, "Nick", nick.c_str()); // If user found, remove from checklist for (int i = 0; i < checklist.getCount(); i++) @@ -2128,7 +2128,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) case 'I': // m_ignore mess = L"/IGNORE %question=\""; mess += TranslateT("Please enter the hostmask (nick!user@host)\nNOTE! Contacts on your contact list are never ignored"); - mess += (CMString)L"\",\"" + TranslateT("Ignore") + L"\",\"*!*@" + host + L"\""; + mess += (CMStringW)L"\",\"" + TranslateT("Ignore") + L"\",\"*!*@" + host + L"\""; if (m_ignoreChannelDefault) mess += L" +qnidcm"; else @@ -2201,7 +2201,7 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg) DoOnConnect(pmsg); if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 0) { - CMString S; + CMStringW S; for (int i = 0; i < pmsg->parameters.getCount(); i++) { wchar_t* temp = mir_wstrdup(pmsg->parameters[i].c_str()); if (wcsstr(temp, L"CHANTYPES=")) { @@ -2286,7 +2286,7 @@ void CIrcProto::OnIrcDisconnected() m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)Temp, ID_STATUS_OFFLINE); - CMString sDisconn = L"\035\002"; + CMStringW sDisconn = L"\035\002"; sDisconn += TranslateT("*Disconnected*"); DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, sDisconn.c_str(), NULL, NULL, NULL, true, false); @@ -2299,7 +2299,7 @@ void CIrcProto::OnIrcDisconnected() // restore the original nick, cause it might be changed memcpy(m_nick, m_pNick, sizeof(m_nick)); - setTString("Nick", m_pNick); + setWString("Nick", m_pNick); Menu_EnableItem(hMenuJoin, false); Menu_EnableItem(hMenuList, false); @@ -2393,7 +2393,7 @@ int CIrcProto::DoPerform(const char* event) sSetting.MakeUpper(); DBVARIANT dbv; - if (!getTString(sSetting.c_str(), &dbv)) { + if (!getWString(sSetting.c_str(), &dbv)) { if (!my_strstri(dbv.ptszVal, L"/away")) PostIrcMessageWnd(NULL, NULL, dbv.ptszVal); else @@ -2404,12 +2404,12 @@ int CIrcProto::DoPerform(const char* event) return 0; } -int CIrcProto::IsIgnored(const CMString& nick, const CMString& address, const CMString& host, char type) +int CIrcProto::IsIgnored(const CMStringW& nick, const CMStringW& address, const CMStringW& host, char type) { return IsIgnored(nick + L"!" + address + L"@" + host, type); } -int CIrcProto::IsIgnored(CMString user, char type) +int CIrcProto::IsIgnored(CMStringW user, char type) { for (int i = 0; i < m_ignoreItems.getCount(); i++) { const CIrcIgnoreItem& C = m_ignoreItems[i]; @@ -2440,7 +2440,7 @@ int CIrcProto::IsIgnored(CMString user, char type) bool CIrcProto::AddIgnore(const wchar_t* mask, const wchar_t* flags, const wchar_t* network) { RemoveIgnore(mask); - m_ignoreItems.insert(new CIrcIgnoreItem(mask, (L"+" + CMString(flags)).c_str(), network)); + m_ignoreItems.insert(new CIrcIgnoreItem(mask, (L"+" + CMStringW(flags)).c_str(), network)); RewriteIgnoreSettings(); if (m_ignoreDlg) diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index c8deea034a..cbe0852a7c 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -24,19 +24,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NICKSUBSTITUTE L"!_nick_!" -void CIrcProto::FormatMsg(CMString& text) +void CIrcProto::FormatMsg(CMStringW& text) { wchar_t temp[30]; mir_wstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29); CharLower(temp); - CMString command = temp; - CMString S = L""; + CMStringW command = temp; + CMStringW S = L""; if (command == L"/quit" || command == L"/away") S = GetWord(text.c_str(), 0) + L" :" + GetWordAddress(text.c_str(), 1); else if (command == L"/privmsg" || command == L"/part" || command == L"/topic" || command == L"/notice") { S = GetWord(text.c_str(), 0) + L" " + GetWord(text.c_str(), 1) + L" :"; if (!GetWord(text.c_str(), 2).IsEmpty()) - S += CMString(GetWordAddress(text.c_str(), 2)); + S += CMStringW(GetWordAddress(text.c_str(), 2)); } else if (command == L"/kick") { S = GetWord(text.c_str(), 0) + L" " + GetWord(text.c_str(), 1) + L" " + GetWord(text.c_str(), 2) + L" :" + GetWordAddress(text.c_str(), 3); @@ -47,10 +47,10 @@ void CIrcProto::FormatMsg(CMString& text) S = GetWordAddress(text.c_str(), 0); } else { - CMString sNewNick = GetWord(text.c_str(), 1); + CMStringW sNewNick = GetWord(text.c_str(), 1); if (sNick4Perform == L"") { DBVARIANT dbv; - if (!getTString("PNick", &dbv)) { + if (!getWString("PNick", &dbv)) { sNick4Perform = dbv.ptszVal; db_free(&dbv); } @@ -66,15 +66,15 @@ void CIrcProto::FormatMsg(CMString& text) text = S; } -static void AddCR(CMString& text) +static void AddCR(CMStringW& text) { text.Replace(L"\n", L"\r\n"); text.Replace(L"\r\r", L"\r"); } -CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) +CMStringW CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) { - CMString Messageout = L""; + CMStringW Messageout = L""; const wchar_t* p1 = text; const wchar_t* p2 = text; bool LinebreakFlag = false, hasAlias = false; @@ -82,7 +82,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) if (!p2) p2 = wcschr(p1, '\0'); if (p1 == p2) - return (CMString)text; + return (CMStringW)text; do { if (LinebreakFlag) @@ -95,14 +95,14 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) test++; if (*test == '/') { mir_wstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1); - CMString S = line; + CMStringW S = line; delete[] line; line = new wchar_t[S.GetLength() + 2]; mir_wstrncpy(line, S.c_str(), S.GetLength() + 1); - CMString alias(m_alias); + CMStringW alias(m_alias); const wchar_t* p3 = wcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str()); if (p3 != alias.c_str()) { - CMString str = L"\r\n"; + CMStringW str = L"\r\n"; str += GetWord(line, 0) + L" "; p3 = wcsstr(alias.c_str(), str.c_str()); if (p3) @@ -115,7 +115,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) p4 = wcschr(p3, '\0'); *(wchar_t*)p4 = 0; - CMString str = p3; + CMStringW str = p3; str.Replace(L"##", window); str.Replace(L"$?", L"%question"); @@ -125,7 +125,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index))) str.Replace(buf, GetWord(line, index).c_str()); else { - CMString S1 = L"#"; + CMStringW S1 = L"#"; S1 += GetWord(line, index); str.Replace(buf, S1.c_str()); } @@ -158,7 +158,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) return hasAlias ? DoIdentifiers(Messageout, window) : Messageout; } -CMString CIrcProto::DoIdentifiers(CMString text, const wchar_t*) +CMStringW CIrcProto::DoIdentifiers(CMStringW text, const wchar_t*) { SYSTEMTIME time; wchar_t str[2]; @@ -209,13 +209,13 @@ static void __stdcall sttSetTimerOff(void* _pro) ppro->KillChatTimer(ppro->OnlineNotifTimer3); } -BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact) +BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact) { - CMString command(GetWord(text, 0)); command.MakeLower(); - CMString one = GetWord(text, 1); - CMString two = GetWord(text, 2); - CMString three = GetWord(text, 3); - CMString therest = GetWordAddress(text, 4); + CMStringW command(GetWord(text, 0)); command.MakeLower(); + CMStringW one = GetWord(text, 1); + CMStringW two = GetWord(text, 2); + CMStringW three = GetWord(text, 3); + CMStringW therest = GetWordAddress(text, 4); if (command == L"/servershow" || command == L"/serverhide") { if (m_useServer) { @@ -238,7 +238,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon } if (command == L"/clear") { - CMString S; + CMStringW S; if (!one.IsEmpty()) { if (one == L"server") S = SERVERWINDOW; @@ -258,7 +258,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/ignore") { if (IsConnected()) { - CMString IgnoreFlags; + CMStringW IgnoreFlags; wchar_t temp[500]; if (one.IsEmpty()) { if (m_ignore) @@ -296,7 +296,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon } else IgnoreFlags = L"qnidc"; - CMString szNetwork; + CMStringW szNetwork; if (three.IsEmpty()) szNetwork = m_info.sNetwork; else @@ -334,7 +334,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/joinx") { if (!one.IsEmpty()) { for (int i = 1;; i++) { - CMString tmp = GetWord(text, i); + CMStringW tmp = GetWord(text, i); if (tmp.IsEmpty()) break; @@ -349,7 +349,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/joinm") { if (!one.IsEmpty()) { for (int i = 1;; i++) { - CMString tmp = GetWord(text, i); + CMStringW tmp = GetWord(text, i); if (tmp.IsEmpty()) break; @@ -363,7 +363,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/nusers") { wchar_t szTemp[40]; - CMString S = MakeWndID(window); + CMStringW S = MakeWndID(window); GC_INFO gci = { 0 }; gci.Flags = GCF_BYID | GCF_NAME | GCF_COUNT; gci.pszModule = m_szModuleName; @@ -474,7 +474,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon return true; } - CMString S = MakeWndID(window); + CMStringW S = MakeWndID(window); GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce); @@ -492,7 +492,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon int minutes = (int)m_noOfChannels / 4000; int minutes2 = (int)m_noOfChannels / 9000; - CMString szMsg(FORMAT, TranslateT("This command is not recommended on a network of this size!\r\nIt will probably cause high CPU usage and/or high bandwidth\r\nusage for around %u to %u minute(s).\r\n\r\nDo you want to continue?"), minutes2, minutes); + CMStringW szMsg(FORMAT, TranslateT("This command is not recommended on a network of this size!\r\nIt will probably cause high CPU usage and/or high bandwidth\r\nusage for around %u to %u minute(s).\r\n\r\nDo you want to continue?"), minutes2, minutes); if (m_noOfChannels < 4000 || (m_noOfChannels >= 4000 && MessageBox(NULL, szMsg, TranslateT("IRC warning"), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)) { ListView_DeleteAllItems(GetDlgItem(m_listDlg->GetHwnd(), IDC_INFO_LISTVIEW)); PostIrcMessage(L"/lusers"); @@ -516,7 +516,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty()) return true; - CMString S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window); + CMStringW S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window); S.Replace(L"%", L"%%"); DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE); return true; @@ -526,7 +526,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty()) return true; - CMString S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window); + CMStringW S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window); S.Replace(L"%", L"%%"); DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE); return true; @@ -554,14 +554,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoUserhostWithReason(1, (L"S" + one).c_str(), true, one.c_str()); else { DBVARIANT dbv1; - if (!getTString(hContact, "UWildcard", &dbv1)) { - CMString S = L"S"; + if (!getWString(hContact, "UWildcard", &dbv1)) { + CMStringW S = L"S"; S += dbv1.ptszVal; DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal); db_free(&dbv1); } else { - CMString S = L"S"; + CMStringW S = L"S"; S += one; DoUserhostWithReason(2, S.c_str(), true, one.c_str()); } @@ -623,14 +623,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon CONTACT user = { (wchar_t*)two.c_str(), NULL, NULL, false, false, true }; MCONTACT ccNew = CList_AddContact(&user, false, false); if (ccNew) { - CMString s; + CMStringW s; if (getByte(ccNew, "AdvancedMode", 0) == 0) DoUserhostWithReason(1, (L"S" + two).c_str(), true, two.c_str()); else { DBVARIANT dbv1; - CMString S = L"S"; - if (!getTString(ccNew, "UWildcard", &dbv1)) { + CMStringW S = L"S"; + if (!getWString(ccNew, "UWildcard", &dbv1)) { S += dbv1.ptszVal; DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal); db_free(&dbv1); @@ -644,7 +644,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (three.IsEmpty()) CallService(MS_FILE_SENDFILE, ccNew, 0); else { - CMString temp = GetWordAddress(text.c_str(), 3); + CMStringW temp = GetWordAddress(text.c_str(), 3); wchar_t* pp[2]; wchar_t* p = (wchar_t*)temp.c_str(); pp[0] = p; @@ -670,7 +670,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost); if (ulAdr) { - CMString contact = two; contact += DCCSTRING; + CMStringW contact = two; contact += DCCSTRING; CONTACT user = { (wchar_t*)contact.c_str(), NULL, NULL, false, false, true }; MCONTACT ccNew = CList_AddContact(&user, false, false); setByte(ccNew, "DCC", 1); @@ -733,7 +733,7 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par) wchar_t* infotext = NULL; wchar_t* title = NULL; wchar_t* defaulttext = NULL; - CMString command = (wchar_t*)str; + CMStringW command = (wchar_t*)str; wchar_t* p = wcsstr((wchar_t*)str, L"%question"); if (p[9] == '=' && p[10] == '\"') { infotext = &p[11]; @@ -810,7 +810,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (!IsConnected() && !bDCC || !szBuf || mir_wstrlen(szBuf) < 1) return 0; - if (hContact && !getTString(hContact, "Nick", &dbv)) { + if (hContact && !getWString(hContact, "Nick", &dbv)) { mir_wstrncpy(windowname, dbv.ptszVal, 255); db_free(&dbv); } @@ -826,7 +826,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha } // remove unecessary linebreaks, and do the aliases - CMString Message = szBuf; + CMStringW Message = szBuf; AddCR(Message); RemoveLinebreaks(Message); if (!hContact && IsConnected()) { @@ -851,7 +851,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha while (!Message.IsEmpty()) { // split the text into lines, and do an automatic textsplit on long lies as well bool flag = false; - CMString DoThis = L""; + CMStringW DoThis = L""; int index = Message.Find(L"\r\n", 0); if (index == -1) index = Message.GetLength(); @@ -868,7 +868,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (GetWord(DoThis.c_str(), 1).IsEmpty()) continue; - CMString S = GetWordAddress(DoThis.c_str(), 1); + CMStringW S = GetWordAddress(DoThis.c_str(), 1); SendIrcMessage(S.c_str(), true, cp); continue; } @@ -877,11 +877,11 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if ((GetWord(DoThis.c_str(), 0)[0] != '/') || // not a command ((GetWord(DoThis.c_str(), 0)[0] == '/') && (GetWord(DoThis.c_str(), 0)[1] == '/')) || // or double backslash at the beginning hContact) { - CMString S = L"/PRIVMSG "; + CMStringW S = L"/PRIVMSG "; if (mir_wstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty()) S += m_info.sServerName + L" " + DoThis; else - S += CMString(windowname) + L" " + DoThis; + S += CMStringW(windowname) + L" " + DoThis; DoThis = S; flag = true; @@ -902,7 +902,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha CDccSession* dcc = FindDCCSession(hContact); if (dcc) { FormatMsg(DoThis); - CMString mess = GetWordAddress(DoThis.c_str(), 2); + CMStringW mess = GetWordAddress(DoThis.c_str(), 2); if (mess[0] == ':') mess.Delete(0, 1); mess += '\n'; diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index ab4430ad42..d734c12ee4 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -59,7 +59,7 @@ CIrcMessage::CIrcMessage(const CIrcMessage& m) : prefix.sHost = m.prefix.sHost; for (int i = 0; i < m.parameters.getCount(); i++) - parameters.insert(new CMString(m.parameters[i])); + parameters.insert(new CMStringW(m.parameters[i])); } CIrcMessage::~CIrcMessage() @@ -145,14 +145,14 @@ end_of_prefix: // seek end-of-message while (*p2) ++p2; - parameters.insert(new CMString(p1, p2 - p1)); + parameters.insert(new CMStringW(p1, p2 - p1)); break; } else { // seek end of parameter while (*p2 && *p2 != ' ') ++p2; - parameters.insert(new CMString(p1, p2 - p1)); + parameters.insert(new CMStringW(p1, p2 - p1)); // see next parameter while (*p2 && *p2 == ' ') ++p2; @@ -232,11 +232,11 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) NLSend("PASS %s\r\n", info.sPassword.c_str()); NLSend(L"NICK %s\r\n", info.sNick.c_str()); - CMString userID = GetWord(info.sUserID.c_str(), 0); + CMStringW userID = GetWord(info.sUserID.c_str(), 0); wchar_t szHostName[MAX_PATH]; DWORD cbHostName = _countof(szHostName); GetComputerName(szHostName, &cbHostName); - CMString HostName = GetWord(szHostName, 0); + CMStringW HostName = GetWord(szHostName, 0); if (userID.IsEmpty()) userID = L"Miranda"; if (HostName.IsEmpty()) @@ -525,7 +525,7 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szNam for (int i = 0; i < m_dcc_xfers.getCount(); i++) { CDccSession* p = m_dcc_xfers[i]; DBVARIANT dbv; - if (!getTString(p->di->hContact, "Nick", &dbv)) { + if (!getWString(p->di->hContact, "Nick", &dbv)) { if (p->di->iType == DCC_SEND && !p->di->bSender && !mir_wstrcmpi(szName, dbv.ptszVal) && iPort == p->di->iPort) { db_free(&dbv); return p; @@ -548,7 +548,7 @@ CDccSession* CIrcProto::FindPassiveDCCSend(int iToken) return 0; } -CDccSession* CIrcProto::FindPassiveDCCRecv(CMString sName, CMString sToken) +CDccSession* CIrcProto::FindPassiveDCCRecv(CMStringW sName, CMStringW sToken) { mir_cslock lck(m_dcc); @@ -867,7 +867,7 @@ int CDccSession::SetupConnection() pfts.tszCurrentFile = (wchar_t*)di->sFileAndPath.c_str(); pfts.tszWorkingDir = (wchar_t*)di->sPath.c_str(); pfts.hContact = di->hContact; - pfts.flags = PFTS_TCHAR + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING); + pfts.flags = PFTS_UNICODE + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING); pfts.totalFiles = 1; pfts.currentFileNumber = 0; pfts.totalBytes = di->dwSize; @@ -974,7 +974,7 @@ int CDccSession::SetupConnection() di->iPort = nb.wPort; // store the port internally so it is possible to search for it (for resuming of filetransfers purposes) - CMString sFileWithQuotes = di->sFile; + CMStringW sFileWithQuotes = di->sFile; // if spaces in the filename surround with quotes if (sFileWithQuotes.Find(' ', 0) != -1) { diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index 069c545a12..4e46810551 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -38,18 +38,18 @@ struct DCCINFO : public MZeroedObject DWORD dwAdr; unsigned __int64 dwSize; DWORD iType; - CMString sToken; + CMStringW sToken; int iPort; BOOL bTurbo; BOOL bSSL; BOOL bSender; BOOL bReverse; - CMString sPath; - CMString sFile; - CMString sFileAndPath; - CMString sHostmask; + CMStringW sPath; + CMStringW sFile; + CMStringW sFileAndPath; + CMStringW sHostmask; MCONTACT hContact; - CMString sContactName; + CMStringW sContactName; }; class CIrcMessage @@ -57,13 +57,13 @@ class CIrcMessage public : struct Prefix { - CMString sNick, sUser, sHost; + CMStringW sNick, sUser, sHost; } prefix; CIrcProto* m_proto; - CMString sCommand; - OBJLIST parameters; + CMStringW sCommand; + OBJLIST parameters; bool m_bIncoming; bool m_bNotify; int m_codePage; @@ -87,13 +87,13 @@ private : struct CIrcSessionInfo { CMStringA sServer; - CMString sServerName; - CMString sNick; - CMString sUserID; - CMString sFullName; + CMStringW sServerName; + CMStringW sNick; + CMStringW sUserID; + CMStringW sFullName; CMStringA sPassword; - CMString sIdentServerType; - CMString sNetwork; + CMStringW sIdentServerType; + CMStringW sNetwork; bool bIdentServer; bool bNickFlag; int m_iSSL; @@ -114,7 +114,7 @@ struct CIrcIgnoreItem CIrcIgnoreItem( int codepage, const char*, const char*, const char* ); ~CIrcIgnoreItem(); - CMString mask, flags, network; + CMStringW mask, flags, network; }; //////////////////////////////////////////////////////////////////// diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 2d3b16f50f..222691d3d7 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -179,13 +179,13 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) db_unset(NULL, m_szModuleName, "JTemp"); nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(name, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; char szTemp2[256]; mir_snprintf(szTemp2, "%s DCC", m_szModuleName); nlu.szSettingsModule = szTemp2; @@ -255,10 +255,10 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < performToConvert.getCount(); i++) { CMStringA s = performToConvert[i]; DBVARIANT dbv; - if (!getTString(s, &dbv)) { + if (!getWString(s, &dbv)) { db_unset(NULL, m_szModuleName, s); s.MakeUpper(); - setTString(s, dbv.ptszVal); + setWString(s, dbv.ptszVal); db_free(&dbv); } } @@ -275,13 +275,13 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) wchar_t szBuf[40]; if (mir_wstrlen(m_alternativeNick) == 0) { mir_snwprintf(szBuf, L"%s%u", m_nick, rand() % 9999); - setTString("AlernativeNick", szBuf); + setWString("AlernativeNick", szBuf); mir_wstrncpy(m_alternativeNick, szBuf, 30); } if (mir_wstrlen(m_name) == 0) { mir_snwprintf(szBuf, L"Miranda%u", rand() % 9999); - setTString("Name", szBuf); + setWString("Name", szBuf); mir_wstrncpy(m_name, szBuf, 200); } } @@ -305,14 +305,14 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) if (hContact) { DBVARIANT dbv1; - CMString S = L"S"; + CMStringW S = L"S"; if (getByte(hContact, "AdvancedMode", 0) == 0) { S += user.name; DoUserhostWithReason(1, S, true, user.name); } else { - if (!getTString(hContact, "UWildcard", &dbv1)) { + if (!getWString(hContact, "UWildcard", &dbv1)) { S += dbv1.ptszVal; DoUserhostWithReason(2, S, true, dbv1.ptszVal); db_free(&dbv1); @@ -417,7 +417,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** if (_wstat64(di->sFileAndPath.c_str(), &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) dwPos = statbuf.st_size; - CMString sFileWithQuotes = di->sFile; + CMStringW sFileWithQuotes = di->sFile; // if spaces in the filename surround witrh quotes if (sFileWithQuotes.Find(' ', 0) != -1) { @@ -484,7 +484,7 @@ void __cdecl CIrcProto::AckBasicSearch(void *arg) AckBasicSearchParam *param = (AckBasicSearchParam*)arg; PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = psr.nick.w = param->buf; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); @@ -550,7 +550,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** } DBVARIANT dbv; - if (!getTString(hContact, "Nick", &dbv)) { + if (!getWString(hContact, "Nick", &dbv)) { // set up a basic DCCINFO struct and pass it to a DCC object dci = new DCCINFO; dci->sFileAndPath = ppszFiles[index]; @@ -561,7 +561,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** dci->sFile = dci->sFileAndPath.Mid(i + 1); } - CMString sFileWithQuotes = dci->sFile; + CMStringW sFileWithQuotes = dci->sFile; // if spaces in the filename surround witrh quotes if (sFileWithQuotes.Find(' ', 0) != -1) { @@ -583,7 +583,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** AddDCCSession(dci, dcc); // need to make sure that %'s are doubled to avoid having chat interpret as color codes - CMString sFileCorrect = dci->sFile; + CMStringW sFileCorrect = dci->sFile; sFileCorrect.Replace(L"%", L"%%"); // is it an reverse filetransfer (receiver acts as server) @@ -786,13 +786,13 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact) // bypass chat contacts. if (!isChatRoom(hContact)) { - if (hContact && !getTString(hContact, "Nick", &dbv)) { + if (hContact && !getWString(hContact, "Nick", &dbv)) { int i = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (i != ID_STATUS_AWAY) { db_free(&dbv); return 0; } - CMString S = L"WHOIS "; + CMStringW S = L"WHOIS "; S += dbv.ptszVal; if (IsConnected()) SendIrcMessage(S.c_str(), false); @@ -814,7 +814,7 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg) break; default: - CMString newStatus = msg; + CMStringW newStatus = msg; newStatus.Replace(L"\r\n", L" "); if (m_statusMessage.IsEmpty() || msg == NULL || m_statusMessage != newStatus) { if (msg == NULL || *msg == 0) diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 9102b14c3a..940251a7ca 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -59,8 +59,8 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) *(char**)ptr = NULL; } break; - case DBVT_TCHAR: - if (!getTString(p->name, &dbv)) { + case DBVT_WCHAR: + if (!getWString(p->name, &dbv)) { if (p->size != -1) { size_t len = min(p->size - 1, mir_wstrlen(dbv.ptszVal)); memcpy(ptr, dbv.pszVal, len*sizeof(wchar_t)); @@ -100,11 +100,11 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count ) setString(p->name, (char*)ptr); break; - case DBVT_TCHAR: + case DBVT_WCHAR: if (p->size == -1) - setTString(p->name, *(wchar_t**)ptr); + setWString(p->name, *(wchar_t**)ptr); else - setTString(p->name, (wchar_t*)ptr); + setWString(p->name, (wchar_t*)ptr); break; } } } @@ -398,9 +398,9 @@ struct CServerDlg : public CProtoDlgBase static TDbSetting ConnectSettings[] = { - { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, _countof(pZero->m_userID) }, - { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, _countof(pZero->m_identSystem) }, - { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, _countof(pZero->m_identPort) }, + { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_WCHAR, _countof(pZero->m_userID) }, + { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_WCHAR, _countof(pZero->m_identSystem) }, + { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_WCHAR, _countof(pZero->m_identPort) }, { FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, _countof(pZero->m_serverName) }, { FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, _countof(pZero->m_portStart) }, @@ -412,10 +412,10 @@ static TDbSetting ConnectSettings[] = { FIELD_OFFSET(CIrcProto, m_onlineNotificationTime) , "OnlineNotificationTime", DBVT_WORD, 0, 30 }, { FIELD_OFFSET(CIrcProto, m_onlineNotificationLimit) , "OnlineNotificationLimit", DBVT_WORD, 0, 50 }, { FIELD_OFFSET(CIrcProto, m_channelAwayNotification), "ChannelAwayNotification", DBVT_BYTE, 0, 1 }, - { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_TCHAR, _countof(pZero->m_nick) }, - { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_TCHAR, _countof(pZero->m_pNick) }, - { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_TCHAR, _countof(pZero->m_alternativeNick) }, - { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_TCHAR, _countof(pZero->m_name) }, + { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_WCHAR, _countof(pZero->m_nick) }, + { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_WCHAR, _countof(pZero->m_pNick) }, + { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_WCHAR, _countof(pZero->m_alternativeNick) }, + { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_WCHAR, _countof(pZero->m_name) }, { FIELD_OFFSET(CIrcProto, m_disableDefaultServer), "DisableDefaultServer", DBVT_BYTE }, { FIELD_OFFSET(CIrcProto, m_ident), "Ident", DBVT_BYTE }, { FIELD_OFFSET(CIrcProto, m_identTimer), "IdentTimer", DBVT_BYTE }, @@ -778,7 +778,7 @@ void CConnectPrefsDlg::OnApply() static TDbSetting CtcpSettings[] = { - { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_TCHAR, _countof(pZero->m_userInfo) }, + { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_WCHAR, _countof(pZero->m_userInfo) }, { FIELD_OFFSET(CIrcProto, m_DCCPacketSize), "DccPacketSize", DBVT_WORD, 0, 4096 }, { FIELD_OFFSET(CIrcProto, m_DCCPassive), "DccPassive", DBVT_BYTE }, { FIELD_OFFSET(CIrcProto, m_DCCMode), "DCCMode", DBVT_BYTE }, @@ -849,14 +849,14 @@ void CCtcpPrefsDlg::OnInitDialog() else { if (m_proto->m_IPFromServer) { if (m_proto->m_myHost[0]) { - CMString s = (CMString)TranslateT("m_myHost) + L">"; + CMStringW s = (CMStringW)TranslateT("m_myHost) + L">"; m_ip.SetText(s.c_str()); } else m_ip.SetText(TranslateT("")); } else { if (m_proto->m_myLocalHost[0]) { - CMString s = (CMString)TranslateT("m_myLocalHost) + L">"; + CMStringW s = (CMStringW)TranslateT("m_myLocalHost) + L">"; m_ip.SetText(s.c_str()); } else m_ip.SetText(TranslateT("")); @@ -874,14 +874,14 @@ void CCtcpPrefsDlg::OnClicked(CCtrlData*) else { if (m_fromServer.GetState()) { if (m_proto->m_myHost[0]) { - CMString s = (CMString)TranslateT("m_myHost) + L">"; + CMStringW s = (CMStringW)TranslateT("m_myHost) + L">"; m_ip.SetText(s.c_str()); } else m_ip.SetText(TranslateT("")); } else { if (m_proto->m_myLocalHost[0]) { - CMString s = (CMString)TranslateT("m_myLocalHost) + L">"; + CMStringW s = (CMStringW)TranslateT("m_myLocalHost) + L">"; m_ip.SetText(s.c_str()); } else m_ip.SetText(TranslateT("")); @@ -925,8 +925,8 @@ void CCtcpPrefsDlg::OnApply() static TDbSetting OtherSettings[] = { - { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_TCHAR, _countof(pZero->m_quitMessage) }, - { FIELD_OFFSET(CIrcProto, m_alias), "Alias", DBVT_TCHAR, -1 }, + { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_WCHAR, _countof(pZero->m_quitMessage) }, + { FIELD_OFFSET(CIrcProto, m_alias), "Alias", DBVT_WCHAR, -1 }, { FIELD_OFFSET(CIrcProto, m_codepage), "Codepage", DBVT_DWORD, 0, CP_ACP }, { FIELD_OFFSET(CIrcProto, m_utfAutodetect), "UtfAutodetect", DBVT_BYTE }, { FIELD_OFFSET(CIrcProto, m_perform), "Perform", DBVT_BYTE }, @@ -1160,7 +1160,7 @@ void COtherPrefsDlg::OnApply() continue; if (!pPerf->mText.IsEmpty()) - m_proto->setTString(pPerf->mSetting.c_str(), pPerf->mText.c_str()); + m_proto->setWString(pPerf->mSetting.c_str(), pPerf->mText.c_str()); else db_unset(NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str()); } @@ -1175,7 +1175,7 @@ void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName) PERFORM_INFO* pPref; DBVARIANT dbv; - if (!m_proto->getTString(sSetting.c_str(), &dbv)) { + if (!m_proto->getWString(sSetting.c_str(), &dbv)) { pPref = new PERFORM_INFO(sSetting.c_str(), dbv.ptszVal); db_free(&dbv); } @@ -1218,7 +1218,7 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*) { wchar_t szMask[500]; wchar_t szNetwork[500]; - CMString flags; + CMStringW flags; if (IsDlgButtonChecked(m_hwnd, IDC_Q) == BST_CHECKED) flags += 'q'; if (IsDlgButtonChecked(m_hwnd, IDC_N) == BST_CHECKED) flags += 'n'; if (IsDlgButtonChecked(m_hwnd, IDC_I) == BST_CHECKED) flags += 'i'; @@ -1229,7 +1229,7 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*) GetDlgItemText(m_hwnd, IDC_MASK, szMask, _countof(szMask)); GetDlgItemText(m_hwnd, IDC_NETWORK, szNetwork, _countof(szNetwork)); - CMString Mask = GetWord(szMask, 0); + CMStringW Mask = GetWord(szMask, 0); if (Mask.GetLength() != 0) { if (!wcschr(Mask.c_str(), '!') && !wcschr(Mask.c_str(), '@')) Mask += L"!*@*"; @@ -1357,12 +1357,12 @@ void CIrcProto::InitIgnore(void) mir_snprintf(settingName, "IGNORE:%d", idx++); DBVARIANT dbv; - if (getTString(settingName, &dbv)) + if (getWString(settingName, &dbv)) break; - CMString mask = GetWord(dbv.ptszVal, 0); - CMString flags = GetWord(dbv.ptszVal, 1); - CMString network = GetWord(dbv.ptszVal, 2); + CMStringW mask = GetWord(dbv.ptszVal, 0); + CMStringW flags = GetWord(dbv.ptszVal, 1); + CMStringW network = GetWord(dbv.ptszVal, 2); m_ignoreItems.insert(new CIrcIgnoreItem(mask.c_str(), flags.c_str(), network.c_str())); db_free(&dbv); } @@ -1383,7 +1383,7 @@ void CIrcProto::RewriteIgnoreSettings(void) mir_snprintf(settingName, "IGNORE:%d", i); CIrcIgnoreItem& C = m_ignoreItems[i]; - setTString(settingName, (C.mask + L" " + C.flags + L" " + C.network).c_str()); + setWString(settingName, (C.mask + L" " + C.flags + L" " + C.network).c_str()); } } @@ -1638,7 +1638,7 @@ int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.pwszTitle = m_tszUserName; odp.pwszGroup = LPGENW("Network"); - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszTab = LPGENW("Account"); odp.pDialog = new CConnectPrefsDlg(this); @@ -1690,12 +1690,12 @@ void CIrcProto::InitPrefs(void) if (m_pNick[0] == 0) { if (m_nick[0] != 0) { memcpy(m_pNick, m_nick, sizeof(m_pNick)); - setTString("PNick", m_nick); + setWString("PNick", m_nick); } } else { memcpy(m_nick, m_pNick, sizeof(m_nick)); - setTString("Nick", m_nick); + setWString("Nick", m_nick); } m_mySpecifiedHostIP[0] = 0; diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp index eacf4c785b..9eb5181e91 100644 --- a/protocols/IRCG/src/output.cpp +++ b/protocols/IRCG/src/output.cpp @@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static CMString FormatOutput(const CIrcMessage* pmsg) +static CMStringW FormatOutput(const CIrcMessage* pmsg) { - CMString sMessage; + CMStringW sMessage; if (pmsg->m_bIncoming) { // Is it an incoming message? if (pmsg->sCommand == L"WALLOPS" && pmsg->parameters.getCount() > 0) { @@ -85,10 +85,10 @@ static CMString FormatOutput(const CIrcMessage* pmsg) int l = pmsg->parameters[1].GetLength(); if (l > 3 && pmsg->parameters[1][0] == 1 && pmsg->parameters[1][l - 1] == 1) { // CTCP reply - CMString tempstr = pmsg->parameters[1]; + CMStringW tempstr = pmsg->parameters[1]; tempstr.Delete(0, 1); tempstr.Delete(tempstr.GetLength() - 1, 1); - CMString type = GetWord(tempstr.c_str(), 0); + CMStringW type = GetWord(tempstr.c_str(), 0); if (mir_wstrcmpi(type.c_str(), L"ping") == 0) mir_snwprintf(temp, TranslateT("CTCP %s reply sent to %s"), type.c_str(), pmsg->parameters[0].c_str()); else @@ -131,7 +131,7 @@ THE_END: BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg) { - CMString mess = FormatOutput(pmsg); + CMStringW mess = FormatOutput(pmsg); if (!pmsg->m_bIncoming) mess.Replace(L"%%", L"%"); diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 9813630002..a2586f1258 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -92,7 +92,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) gchook->ptszUID = NULL; if (gch->pDest->ptszID) { - CMString S = MakeWndID(gch->pDest->ptszID); + CMStringW S = MakeWndID(gch->pDest->ptszID); gchook->pDest->ptszID = wcsdup(S.c_str()); } else gchook->pDest->ptszID = NULL; @@ -112,7 +112,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) { if (m_scriptingEnabled && lparam) { CMStringA sString = (char*)lparam, sRequest; - CMString sOutput, sChannel; + CMStringW sOutput, sChannel; int i = sString.Find("|"); if (i != -1) { @@ -142,7 +142,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) (m_IPFromServer) ? m_myHost : m_myLocalHost); else if (sRequest == "usercount" && !sChannel.IsEmpty()) { - CMString S = MakeWndID(sChannel.c_str()); + CMStringW S = MakeWndID(sChannel.c_str()); GC_INFO gci = { 0 }; gci.Flags = GCF_BYID | GCF_COUNT; gci.pszModule = m_szModuleName; @@ -154,7 +154,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) } } else if (sRequest == "userlist" && !sChannel.IsEmpty()) { - CMString S = MakeWndID(sChannel.c_str()); + CMStringW S = MakeWndID(sChannel.c_str()); GC_INFO gci = { 0 }; gci.Flags = GCF_BYID | GCF_USERS; gci.pszModule = m_szModuleName; @@ -163,7 +163,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) return (INT_PTR)mir_strdup(gci.pszUsers); } else if (sRequest == "channellist") { - CMString S = L""; + CMStringW S = L""; int n = CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_szModuleName); if (n >= 0) { int j = 0; @@ -174,7 +174,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.iItem = j; if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) { if (mir_wstrcmpi(gci.pszID, SERVERWINDOW)) { - CMString S1 = gci.pszID; + CMStringW S1 = gci.pszID; int k = S1.Find(L" "); if (k != -1) S1 = S1.Mid(0, k); diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index a05b6d0b17..e97a5abae5 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -198,10 +198,10 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) return 0; DBVARIANT dbv; - if (!getTString(hContact, "Nick", &dbv)) { + if (!getWString(hContact, "Nick", &dbv)) { int type = getByte(hContact, "ChatRoom", 0); if (type != 0) { - CMString S = L""; + CMStringW S = L""; if (type == GCW_CHATROOM) S = MakeWndID(dbv.ptszVal); if (type == GCW_SERVER) @@ -232,7 +232,7 @@ INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM) return 0; DBVARIANT dbv; - if (!getTString((MCONTACT)wp, "Nick", &dbv)) { + if (!getWString((MCONTACT)wp, "Nick", &dbv)) { if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) PostIrcMessage(L"/JOIN %s", dbv.ptszVal); db_free(&dbv); @@ -246,11 +246,11 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM) return 0; DBVARIANT dbv; - if (!getTString((MCONTACT)wp, "Nick", &dbv)) { + if (!getWString((MCONTACT)wp, "Nick", &dbv)) { if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) { PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo); - CMString S = MakeWndID(dbv.ptszVal); + CMStringW S = MakeWndID(dbv.ptszVal); GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce); @@ -267,7 +267,7 @@ INT_PTR __cdecl CIrcProto::OnMenuChanSettings(WPARAM wp, LPARAM) MCONTACT hContact = (MCONTACT)wp; DBVARIANT dbv; - if (!getTString(hContact, "Nick", &dbv)) { + if (!getWString(hContact, "Nick", &dbv)) { PostIrcMessageWnd(dbv.ptszVal, NULL, L"/CHANNELMANAGER"); db_free(&dbv); } @@ -281,7 +281,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM) DBVARIANT dbv; - if (!getTString((MCONTACT)wp, "Nick", &dbv)) { + if (!getWString((MCONTACT)wp, "Nick", &dbv)) { PostIrcMessage(L"/WHOIS %s %s", dbv.ptszVal, dbv.ptszVal); db_free(&dbv); } @@ -303,7 +303,7 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM) MCONTACT hContact = (MCONTACT)wp; DBVARIANT dbv; - if (!getTString(hContact, "Nick", &dbv)) { + if (!getWString(hContact, "Nick", &dbv)) { if (!isChatRoom(hContact)) { char* host = NULL; DBVARIANT dbv1; @@ -481,7 +481,7 @@ static void DoChatFormatting(wchar_t* pszText) int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) { GCHOOK *gch = (GCHOOK*)lParam; - CMString S = L""; + CMStringW S = L""; mir_cslock lock(m_gchook); @@ -574,7 +574,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case 9: // nickserv remind password { DBVARIANT dbv; - if (!getTString("Nick", &dbv)) { + if (!getWString("Nick", &dbv)) { PostIrcMessage(L"/nickserv SENDPASS %s", dbv.ptszVal); db_free(&dbv); } @@ -670,13 +670,13 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) p1, gch->ptszUID, TranslateT("Please enter the reason"), TranslateT("Kick"), TranslateT("Jerk")); break; case 7: - DoUserhostWithReason(1, L"B" + (CMString)p1, true, L"%s", gch->ptszUID); + DoUserhostWithReason(1, L"B" + (CMStringW)p1, true, L"%s", gch->ptszUID); break; case 8: - DoUserhostWithReason(1, L"K" + (CMString)p1, true, L"%s", gch->ptszUID); + DoUserhostWithReason(1, L"K" + (CMStringW)p1, true, L"%s", gch->ptszUID); break; case 9: - DoUserhostWithReason(1, L"L" + (CMString)p1, true, L"%s", gch->ptszUID); + DoUserhostWithReason(1, L"L" + (CMStringW)p1, true, L"%s", gch->ptszUID); break; case 10: PostIrcMessage(L"/WHOIS %s %s", gch->ptszUID, gch->ptszUID); @@ -723,28 +723,28 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) gch->ptszUID, TranslateT("Please enter the channel name to invite to"), TranslateT("Invite to channel")); break; case 30: - { - PROTOSEARCHRESULT psr = { 0 }; - psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; - psr.id.w = gch->ptszUID; - psr.nick.w = gch->ptszUID; - - ADDCONTACTSTRUCT acs = { 0 }; - acs.handleType = HANDLE_SEARCHRESULT; - acs.szProto = m_szModuleName; - acs.psr = &psr; - CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); - } + { + PROTOSEARCHRESULT psr = { 0 }; + psr.cbSize = sizeof(psr); + psr.flags = PSR_UNICODE; + psr.id.w = gch->ptszUID; + psr.nick.w = gch->ptszUID; + + ADDCONTACTSTRUCT acs = { 0 }; + acs.handleType = HANDLE_SEARCHRESULT; + acs.szProto = m_szModuleName; + acs.psr = &psr; + CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); + } break; case 31: //slap - PostIrcMessageWnd(p1, NULL, CMString(FORMAT, L"/slap %s", gch->ptszUID)); + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/slap %s", gch->ptszUID)); break; case 32: //nickserv info - PostIrcMessageWnd(p1, NULL, CMString(FORMAT, L"/nickserv INFO %s ALL", gch->ptszUID)); + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv INFO %s ALL", gch->ptszUID)); break; case 33: //nickserv ghost - PostIrcMessageWnd(p1, NULL, CMString(FORMAT, L"/nickserv GHOST %s", gch->ptszUID)); + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv GHOST %s", gch->ptszUID)); break; } break; @@ -923,7 +923,7 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM hContact, LPARAM) Menu_ShowItem(hUMenuChanSettings, true); // context menu for contact - else if (!getTString(hContact, "Default", &dbv)) { + else if (!getWString(hContact, "Default", &dbv)) { Menu_ShowItem(hUMenuChanSettings, false); // for DCC contact @@ -966,7 +966,7 @@ int __cdecl CIrcProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(cws->szSetting, "NotOnList")) { DBVARIANT dbv; - if (!getTString(hContact, "Nick", &dbv)) { + if (!getWString(hContact, "Nick", &dbv)) { if (getByte("MirVerAutoRequest", 1)) PostIrcMessage(L"/PRIVMSG %s \001VERSION\001", dbv.ptszVal); db_free(&dbv); diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 460b5a54f2..4e8670af7f 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -152,7 +152,7 @@ struct PERFORM_INFO // Contains 'm_perform buffer' for different networks {} CMStringA mSetting; - CMString mText; + CMStringW mText; }; struct CONTACT // Contains info about users @@ -319,15 +319,15 @@ struct CIrcProto : public PROTO COLORREF colors[16]; HICON hIcon[13]; - OBJLIST vUserhostReasons; - OBJLIST vWhoInProgress; + OBJLIST vUserhostReasons; + OBJLIST vWhoInProgress; mir_cs cs; mir_cs m_gchook; mir_cs m_resolve; HANDLE m_evWndCreate; - CMString m_statusMessage; + CMStringW m_statusMessage; int m_iTempCheckTime; CIrcSessionInfo si; @@ -354,7 +354,7 @@ struct CIrcProto : public PROTO int m_noOfChannels, m_manualWhoisCount; CMStringA sChannelModes, sUserModes; - CMString sChannelPrefixes, sUserModePrefixes, WhoisAwayReply; + CMStringW sChannelPrefixes, sUserModePrefixes, WhoisAwayReply; //clist.cpp MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline); @@ -363,7 +363,7 @@ struct CIrcProto : public PROTO bool CList_AddEvent(CONTACT *user, HICON Icon, HANDLE event, const char *tooltip, int type ) ; MCONTACT CList_FindContact(CONTACT *user); - BOOL CList_AddDCCChat(const CMString &name, const CMString &hostmask, unsigned long adr, int port) ; + BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port) ; //commandmonitor.cpp UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3; @@ -374,15 +374,15 @@ struct CIrcProto : public PROTO void __cdecl ResolveIPThread(void *di); bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network) ; - int IsIgnored(const CMString &nick, const CMString &address, const CMString &host, char type) ; - int IsIgnored(CMString user, char type); + int IsIgnored(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type) ; + int IsIgnored(CMStringW user, char type); bool RemoveIgnore(const wchar_t *mask) ; //input.cpp - CMString DoAlias( const wchar_t *text, wchar_t *window); - BOOL DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact); - CMString DoIdentifiers(CMString text, const wchar_t *window); - void FormatMsg(CMString &text); + CMStringW DoAlias( const wchar_t *text, wchar_t *window); + BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact); + CMStringW DoIdentifiers(CMStringW text, const wchar_t *window); + void FormatMsg(CMStringW &text); bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf); bool PostIrcMessage(const wchar_t *fmt, ...); @@ -404,14 +404,14 @@ struct CIrcProto : public PROTO OBJLIST m_ignoreItems; int m_channelNumber; - CMString m_whoReply; - CMString sNamesList; - CMString sTopic; - CMString sTopicName; - CMString sTopicTime; - CMString m_namesToWho; - CMString m_channelsToWho; - CMString m_namesToUserhost; + CMStringW m_whoReply; + CMStringW sNamesList; + CMStringW sTopic; + CMStringW sTopicName; + CMStringW sTopicTime; + CMStringW m_namesToWho; + CMStringW m_channelsToWho; + CMStringW m_namesToUserhost; void InitPrefs(void); void InitIgnore(void); @@ -439,25 +439,25 @@ struct CIrcProto : public PROTO void __cdecl DisconnectServerThread( void* ); //tools.cpp - void AddToJTemp(wchar_t op, CMString& sCommand); - bool AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic); + void AddToJTemp(wchar_t op, CMStringW& sCommand); + bool AddWindowItemData(CMStringW window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic); INT_PTR CallChatEvent(WPARAM wParam, LPARAM lParam); INT_PTR DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick, const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1); void FindLocalIP(HANDLE con); - bool FreeWindowItemData(CMString window, CHANNELINFO* wis); + bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis); bool IsChannel(const char* sName); bool IsChannel(const wchar_t* sName); void KillChatTimer(UINT_PTR &nIDEvent); - CMString MakeWndID(const wchar_t* sWindow); - CMString ModeToStatus(int sMode); - CMString PrefixToStatus(int cPrefix); - int SetChannelSBText(CMString sWindow, CHANNELINFO * wi); + CMStringW MakeWndID(const wchar_t* sWindow); + CMStringW ModeToStatus(int sMode); + CMStringW PrefixToStatus(int cPrefix); + int SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi); void SetChatTimer(UINT_PTR &nIDEvent,UINT uElapse, TIMERPROC lpTimerFunc); void ClearUserhostReasons(int type); - void DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...); - CMString GetNextUserhostReason(int type); - CMString PeekAtReasons(int type); + void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...); + CMStringW GetNextUserhostReason(int type); + CMStringW PeekAtReasons(int type); // userinfo.cpp void __cdecl AckUserInfoSearch( void* hContact ); @@ -475,7 +475,7 @@ struct CIrcProto : public PROTO CDccSession* FindDCCSendByPort(int iPort); CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t* szName); CDccSession* FindPassiveDCCSend(int iToken); - CDccSession* FindPassiveDCCRecv(CMString sName, CMString sToken); + CDccSession* FindPassiveDCCRecv(CMStringW sName, CMStringW sToken); void DisconnectAllDCCSessions(bool Shutdown); void CheckDCCTimeout(void); @@ -575,7 +575,7 @@ private : PfnIrcMessageHandler FindMethod(const wchar_t* lpszName); void OnIrcMessage(const CIrcMessage* pmsg); - CMString sNick4Perform; + CMStringW sNick4Perform; }; // map actual member functions to their associated IRC command. @@ -619,9 +619,9 @@ HANDLE GetIconHandle(int iconId); //tools.cpp int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string); char* __stdcall IrcLoadFile(wchar_t * szPath); -CMString __stdcall GetWord(const wchar_t* text, int index); +CMStringW __stdcall GetWord(const wchar_t* text, int index); const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index); -void __stdcall RemoveLinebreaks( CMString& Message ); +void __stdcall RemoveLinebreaks( CMStringW& Message ); wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2) ; wchar_t* __stdcall DoColorCodes (const wchar_t* text, bool bStrip, bool bReplacePercent); diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 4869720b3f..eb3068d7de 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -23,13 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// -void CIrcProto::AddToJTemp(wchar_t op, CMString& sCommand) +void CIrcProto::AddToJTemp(wchar_t op, CMStringW& sCommand) { - CMString res; + CMStringW res; int pos = 0; for (;;) { - CMString tmp = sCommand.Tokenize(L",", pos); + CMStringW tmp = sCommand.Tokenize(L",", pos); if (pos == -1) break; @@ -41,15 +41,15 @@ void CIrcProto::AddToJTemp(wchar_t op, CMString& sCommand) } DBVARIANT dbv; - if (!getTString("JTemp", &dbv)) { - res = CMString(dbv.ptszVal) + L" " + res; + if (!getWString("JTemp", &dbv)) { + res = CMStringW(dbv.ptszVal) + L" " + res; db_free(&dbv); } - setTString("JTemp", res.c_str()); + setWString("JTemp", res.c_str()); } -CMString __stdcall GetWord(const wchar_t* text, int index) +CMStringW __stdcall GetWord(const wchar_t* text, int index) { if (text && *text) { wchar_t* p1 = (wchar_t*)text; @@ -75,11 +75,11 @@ CMString __stdcall GetWord(const wchar_t* text, int index) p2 = wcschr(p1, '\0'); if (p1 != p2) - return CMString(p1, p2 - p1); + return CMStringW(p1, p2 - p1); } } - return CMString(); + return CMStringW(); } const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index) @@ -108,7 +108,7 @@ const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index) return temp; } -void __stdcall RemoveLinebreaks(CMString &Message) +void __stdcall RemoveLinebreaks(CMStringW &Message) { while (Message.Find(L"\r\n\r\n", 0) != -1) Message.Replace(L"\r\n\r\n", L"\r\n"); @@ -386,8 +386,8 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp) { GCDEST gcd = { m_szModuleName, NULL, iEvent }; - CMString sID; - CMString sText = L""; + CMStringW sID; + CMStringW sText = L""; if (iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho) return false; @@ -401,7 +401,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* if (pszWindow) { if (mir_wstrcmpi(pszWindow, SERVERWINDOW)) - sID = pszWindow + (CMString)L" - " + m_info.sNetwork; + sID = pszWindow + (CMStringW)L" - " + m_info.sNetwork; else sID = pszWindow; gcd.ptszID = (wchar_t*)sID.c_str(); @@ -430,29 +430,29 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* return CallChatEvent(0, (LPARAM)&gce); } -CMString CIrcProto::ModeToStatus(int sMode) +CMStringW CIrcProto::ModeToStatus(int sMode) { if (sUserModes.Find(sMode) != -1) { switch (sMode) { case 'q': - return (CMString)L"Owner"; + return (CMStringW)L"Owner"; case 'o': - return (CMString)L"Op"; + return (CMStringW)L"Op"; case 'v': - return (CMString)L"Voice"; + return (CMStringW)L"Voice"; case 'h': - return (CMString)L"Halfop"; + return (CMStringW)L"Halfop"; case 'a': - return (CMString)L"Admin"; + return (CMStringW)L"Admin"; default: - return (CMString)L"Unknown"; + return (CMStringW)L"Unknown"; } } - return (CMString)L"Normal"; + return (CMStringW)L"Normal"; } -CMString CIrcProto::PrefixToStatus(int cPrefix) +CMStringW CIrcProto::PrefixToStatus(int cPrefix) { const wchar_t* p = wcschr(sUserModePrefixes.c_str(), cPrefix); if (p) { @@ -460,7 +460,7 @@ CMString CIrcProto::PrefixToStatus(int cPrefix) return ModeToStatus(sUserModes[index]); } - return (CMString)L"Normal"; + return (CMStringW)L"Normal"; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -531,9 +531,9 @@ void CIrcProto::KillChatTimer(UINT_PTR &nIDEvent) ///////////////////////////////////////////////////////////////////////////////////////// -int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi) +int CIrcProto::SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi) { - CMString sTemp = L""; + CMStringW sTemp = L""; if (wi->pszMode) { sTemp += L"["; sTemp += wi->pszMode; @@ -545,14 +545,14 @@ int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi) return DoEvent(GC_EVENT_SETSBTEXT, sWindow.c_str(), NULL, sTemp.c_str(), NULL, NULL, NULL, FALSE, FALSE, 0); } -CMString CIrcProto::MakeWndID(const wchar_t* sWindow) +CMStringW CIrcProto::MakeWndID(const wchar_t* sWindow) { wchar_t buf[200]; mir_snwprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline")); - return CMString(buf); + return CMStringW(buf); } -bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis) +bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO* wis) { CHANNELINFO *wi; if (!wis) @@ -570,7 +570,7 @@ bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis) return false; } -bool CIrcProto::AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic) +bool CIrcProto::AddWindowItemData(CMStringW window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic) { CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0); if (wi) { @@ -610,10 +610,10 @@ void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber } } -void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...) +void CIrcProto::DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...) { wchar_t temp[4096]; - CMString S = L""; + CMStringW S = L""; switch (type) { case 1: S = L"USERHOST"; @@ -633,22 +633,22 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman // Add reason if (type == 1) - vUserhostReasons.insert(new CMString(reason)); + vUserhostReasons.insert(new CMStringW(reason)); else if (type == 2) - vWhoInProgress.insert(new CMString(reason)); + vWhoInProgress.insert(new CMStringW(reason)); // Do command if (IsConnected() && bSendCommand) SendIrcMessage(temp, false); } -CMString CIrcProto::GetNextUserhostReason(int type) +CMStringW CIrcProto::GetNextUserhostReason(int type) { - CMString reason = L""; + CMStringW reason = L""; switch (type) { case 1: if (!vUserhostReasons.getCount()) - return CMString(); + return CMStringW(); // Get reason reason = vUserhostReasons[0]; @@ -656,7 +656,7 @@ CMString CIrcProto::GetNextUserhostReason(int type) break; case 2: if (!vWhoInProgress.getCount()) - return CMString(); + return CMStringW(); // Get reason reason = vWhoInProgress[0]; @@ -667,21 +667,21 @@ CMString CIrcProto::GetNextUserhostReason(int type) return reason; } -CMString CIrcProto::PeekAtReasons(int type) +CMStringW CIrcProto::PeekAtReasons(int type) { switch (type) { case 1: if (!vUserhostReasons.getCount()) - return CMString(); + return CMStringW(); return vUserhostReasons[0]; case 2: if (!vWhoInProgress.getCount()) - return CMString(); + return CMStringW(); return vWhoInProgress[0]; } - return CMString(); + return CMStringW(); } void CIrcProto::ClearUserhostReasons(int type) diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 0079e410e0..68b3705a5f 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -63,26 +63,26 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(m_hwnd, IDC_WILDCARD), bAdvanced); if (!bAdvanced) { - SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_BASIC)); - if (!p->ppro->getTString(p->hContact, "Default", &dbv)) { + SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_BASIC)); + if (!p->ppro->getWString(p->hContact, "Default", &dbv)) { SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal); db_free(&dbv); } } else { - SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED)); - if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) { + SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_ADVANCED)); + if (!p->ppro->getWString(p->hContact, "UWildcard", &dbv)) { SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal); db_free(&dbv); } } - if (!p->ppro->getTString(p->hContact, "UUser", &dbv)) { + if (!p->ppro->getWString(p->hContact, "UUser", &dbv)) { SetDlgItemText(m_hwnd, IDC_USER, dbv.ptszVal); db_free(&dbv); } - if (!p->ppro->getTString(p->hContact, "UHost", &dbv)) { + if (!p->ppro->getWString(p->hContact, "UHost", &dbv)) { SetDlgItemText(m_hwnd, IDC_HOST, dbv.ptszVal); db_free(&dbv); } @@ -107,18 +107,18 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_WILDCARD)) == 0 || GetWindowTextLength(GetDlgItem(m_hwnd, IDC_USER)) == 0 || GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HOST)) == 0) { - MessageBox(NULL, TranslateTS(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR); + MessageBox(NULL, TranslateW(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR); return FALSE; } DBVARIANT dbv; - if (!p->ppro->getTString(p->hContact, "Default", &dbv)) { - CMString S = STR_ERROR; + if (!p->ppro->getWString(p->hContact, "Default", &dbv)) { + CMStringW S = STR_ERROR; S += L" ("; S += dbv.ptszVal; S += L")"; if ((mir_wstrlen(temp) < 4 && mir_wstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) { - MessageBox(NULL, TranslateTS(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR); + MessageBox(NULL, TranslateW(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR); db_free(&dbv); return FALSE; } @@ -127,7 +127,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp)); if (mir_wstrlen(GetWord(temp, 0).c_str())) - p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str()); + p->ppro->setWString(p->hContact, "UWildcard", GetWord(temp, 0).c_str()); else db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard"); } @@ -136,13 +136,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM GetDlgItemText(m_hwnd, IDC_USER, temp, _countof(temp)); if (mir_wstrlen(GetWord(temp, 0).c_str())) - p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str()); + p->ppro->setWString(p->hContact, "UUser", GetWord(temp, 0).c_str()); else db_unset(p->hContact, p->ppro->m_szModuleName, "UUser"); GetDlgItemText(m_hwnd, IDC_HOST, temp, _countof(temp)); if (mir_wstrlen(GetWord(temp, 0).c_str())) - p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str()); + p->ppro->setWString(p->hContact, "UHost", GetWord(temp, 0).c_str()); else db_unset(p->hContact, p->ppro->m_szModuleName, "UHost"); @@ -162,10 +162,10 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM } if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO1) { - SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_BASIC)); + SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_BASIC)); DBVARIANT dbv; - if (!p->ppro->getTString(p->hContact, "Default", &dbv)) { + if (!p->ppro->getWString(p->hContact, "Default", &dbv)) { SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal); db_free(&dbv); } @@ -174,8 +174,8 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO2) { DBVARIANT dbv; - SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED)); - if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) { + SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_ADVANCED)); + if (!p->ppro->getWString(p->hContact, "UWildcard", &dbv)) { SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal); db_free(&dbv); } @@ -200,7 +200,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) return 0; DBVARIANT dbv; - if (!getTString(hContact, "Default", &dbv)) { + if (!getWString(hContact, "Default", &dbv)) { if (IsChannel(dbv.ptszVal)) { db_free(&dbv); return 0; diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 494000553c..40c30af560 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -211,7 +211,7 @@ void CNickDlg::OnInitDialog() Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_RENAME)); DBVARIANT dbv; - if (!m_proto->getTString("RecentNicks", &dbv)) { + if (!m_proto->getWString("RecentNicks", &dbv)) { for (int i = 0; i < 10; i++) if (!GetWord(dbv.ptszVal, i).IsEmpty()) SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)GetWord(dbv.ptszVal, i).c_str()); @@ -232,17 +232,17 @@ void CNickDlg::OnOk(CCtrlButton*) m_Enick.GetText(szTemp, _countof(szTemp)); m_proto->PostIrcMessage(L"/NICK %s", szTemp); - CMString S = szTemp; + CMStringW S = szTemp; DBVARIANT dbv; - if (!m_proto->getTString("RecentNicks", &dbv)) { + if (!m_proto->getWString("RecentNicks", &dbv)) { for (int i = 0; i < 10; i++) { - CMString s = GetWord(dbv.ptszVal, i); + CMStringW s = GetWord(dbv.ptszVal, i); if (!s.IsEmpty() && s != szTemp) S += L" " + s; } db_free(&dbv); } - m_proto->setTString("RecentNicks", S.c_str()); + m_proto->setWString("RecentNicks", S.c_str()); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -503,10 +503,10 @@ void CJoinDlg::OnInitDialog() CCoolIrcDlg::OnInitDialog(); DBVARIANT dbv; - if (!m_proto->getTString("RecentChannels", &dbv)) { + if (!m_proto->getWString("RecentChannels", &dbv)) { for (int i = 0; i < 20; i++) { if (!GetWord(dbv.ptszVal, i).IsEmpty()) { - CMString S = GetWord(dbv.ptszVal, i); + CMStringW S = GetWord(dbv.ptszVal, i); S.Replace(L"%newl", L" "); SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)S.c_str()); } @@ -530,20 +530,20 @@ void CJoinDlg::OnOk(CCtrlButton*) else m_proto->PostIrcMessage(L"/JOIN #%s", szTemp); - CMString S = szTemp; + CMStringW S = szTemp; S.Replace(L" ", L"%newl"); - CMString SL = S; + CMStringW SL = S; DBVARIANT dbv; - if (!m_proto->getTString("RecentChannels", &dbv)) { + if (!m_proto->getWString("RecentChannels", &dbv)) { for (int i = 0; i < 20; i++) { - CMString W = GetWord(dbv.ptszVal, i); + CMStringW W = GetWord(dbv.ptszVal, i); if (!W.IsEmpty() && W != SL) S += L" " + W; } db_free(&dbv); } - m_proto->setTString("RecentChannels", S.c_str()); + m_proto->setWString("RecentChannels", S.c_str()); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -756,7 +756,7 @@ void CQuestionDlg::OnOk(CCtrlButton*) else *p1 = '\0'; } - CMString S('\0', j + 2); + CMStringW S('\0', j + 2); GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, S.GetBuffer(), j + 1); S.Replace(text, l); m_proto->PostIrcMessageWnd(NULL, NULL, S); @@ -909,11 +909,11 @@ void CManagerDlg::OnClose() wchar_t window[256]; GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window)); - CMString S = L""; + CMStringW S = L""; wchar_t temp[1000]; for (int i = 0; i < 5; i++) { if (m_topic.SendMsg(CB_GETLBTEXT, i, (LPARAM)temp) != LB_ERR) { - CMString S1 = temp; + CMStringW S1 = temp; /* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */ #if !defined(__GNUC__) || !defined(UNICODE) S1.Replace(L" ", L"%¤"); @@ -925,7 +925,7 @@ void CManagerDlg::OnClose() if (!S.IsEmpty() && m_proto->IsConnected()) { mir_snwprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str()); char* p = mir_u2a(temp); - m_proto->setTString(p, S.c_str()); + m_proto->setWString(p, S.c_str()); mir_free(p); } DestroyWindow(m_hwnd); @@ -978,7 +978,7 @@ void CManagerDlg::OnEdit(CCtrlButton*) int i = m_list.GetCurSel(); if (i != LB_ERR) { wchar_t* m = m_list.GetItemText(i); - CMString user = GetWord(m, 0); + CMStringW user = GetWord(m, 0); mir_free(m); wchar_t temp[100]; @@ -1027,7 +1027,7 @@ void CManagerDlg::OnRemove(CCtrlButton*) wchar_t temp[100], mode[3]; wchar_t* m = m_list.GetItemText(i, temp, _countof(temp)); - CMString user = GetWord(m, 0); + CMStringW user = GetWord(m, 0); if (m_radio1.GetState()) { mir_wstrcpy(mode, L"-b"); @@ -1083,8 +1083,8 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) if (wi) { wchar_t toadd[10]; *toadd = '\0'; wchar_t toremove[10]; *toremove = '\0'; - CMString appendixadd = L""; - CMString appendixremove = L""; + CMStringW appendixadd = L""; + CMStringW appendixremove = L""; if (wi->pszMode && wcschr(wi->pszMode, 't')) { if (!m_check1.GetState()) mir_wstrcat(toremove, L"t"); @@ -1134,12 +1134,12 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) else if (m_check9.GetState()) mir_wstrcat(toadd, L"c"); - CMString Key = L""; - CMString Limit = L""; + CMStringW Key = L""; + CMStringW Limit = L""; if (wi->pszMode && wi->pszPassword && wcschr(wi->pszMode, 'k')) { if (!m_check5.GetState()) { mir_wstrcat(toremove, L"k"); - appendixremove += L" " + CMString(wi->pszPassword); + appendixremove += L" " + CMStringW(wi->pszPassword); } else if (GetWindowTextLength(m_key.GetHwnd())) { wchar_t temp[400]; @@ -1148,8 +1148,8 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) if (Key != temp) { mir_wstrcat(toremove, L"k"); mir_wstrcat(toadd, L"k"); - appendixadd += L" " + CMString(temp); - appendixremove += L" " + CMString(wi->pszPassword); + appendixadd += L" " + CMStringW(temp); + appendixremove += L" " + CMStringW(wi->pszPassword); } } } @@ -1170,7 +1170,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp)); if (wi->pszLimit && mir_wstrcmpi(wi->pszLimit, temp)) { mir_wstrcat(toadd, L"l"); - appendixadd += L" " + CMString(temp); + appendixadd += L" " + CMStringW(temp); } } } @@ -1283,9 +1283,9 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window) char* p = mir_u2a(temp); DBVARIANT dbv; - if (!m_proto->getTString(p, &dbv)) { + if (!m_proto->getWString(p, &dbv)) { for (int i = 0; i < 5; i++) { - CMString S = GetWord(dbv.ptszVal, i); + CMStringW S = GetWord(dbv.ptszVal, i); if (!S.IsEmpty()) { /* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */ #if !defined(__GNUC__) || !defined(UNICODE) diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index 104c7c8652..1d2b182bd9 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -947,7 +947,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c } contacts[iContact] = (ICQSEARCHRESULT*)SAFE_MALLOC(sizeof(ICQSEARCHRESULT)); contacts[iContact]->hdr.cbSize = sizeof(ICQSEARCHRESULT); - contacts[iContact]->hdr.flags = PSR_TCHAR; + contacts[iContact]->hdr.flags = PSR_UNICODE; contacts[iContact]->hdr.nick.w = null_strdup(L""); contacts[iContact]->hdr.id.w = ansi_to_tchar(szUid); @@ -1682,7 +1682,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, for (int i = 0; i < nContacts; i++) { isrList[i] = (ICQSEARCHRESULT*)SAFE_MALLOC(sizeof(ICQSEARCHRESULT)); isrList[i]->hdr.cbSize = sizeof(ICQSEARCHRESULT); - isrList[i]->hdr.flags = PSR_TCHAR; + isrList[i]->hdr.flags = PSR_UNICODE; if (IsStringUIN(pszMsgField[1 + i * 2])) { // icq contact isrList[i]->uin = atoi(pszMsgField[1 + i * 2]); if (isrList[i]->uin == 0) diff --git a/protocols/IcqOscarJ/src/fam_0alookup.cpp b/protocols/IcqOscarJ/src/fam_0alookup.cpp index bb37764957..909ae75838 100644 --- a/protocols/IcqOscarJ/src/fam_0alookup.cpp +++ b/protocols/IcqOscarJ/src/fam_0alookup.cpp @@ -92,7 +92,7 @@ void CIcqProto::handleLookupEmailReply(BYTE* buf, size_t wLen, DWORD dwCookie) debugLogA("SNAC(0x0A,0x3): Lookup reply"); sr.hdr.cbSize = sizeof(sr); - sr.hdr.flags = PSR_TCHAR; + sr.hdr.flags = PSR_UNICODE; sr.hdr.email.w = ansi_to_tchar(pCookie->szObject); // Syntax check, read chain diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index c2cc01818e..bfd2b1ee14 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -57,11 +57,11 @@ avatars_request::~avatars_request() wchar_t* CIcqProto::GetOwnAvatarFileName() { DBVARIANT dbvFile = {DBVT_DELETED}; - if (getTString(NULL, "AvatarFile", &dbvFile)) + if (getWString(NULL, "AvatarFile", &dbvFile)) return NULL; wchar_t tmp[MAX_PATH * 2]; - PathToAbsoluteT(dbvFile.ptszVal, tmp); + PathToAbsoluteW(dbvFile.ptszVal, tmp); db_free(&dbvFile); return null_strdup(tmp); @@ -76,7 +76,7 @@ void CIcqProto::GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest, size_t cbLen) { wchar_t szPath[MAX_PATH * 2]; - mir_snwprintf(szPath, L"%s\\%S\\", VARST(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(szPath, L"%s\\%S\\", VARSW(L"%miranda_avatarcache%"), m_szModuleName); FOLDERSGETDATA fgd = { sizeof(fgd) }; fgd.nMaxPathSize = _countof(szPath); @@ -88,7 +88,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest size_t tPathLen = mir_wstrlen(pszDest); // make sure the avatar cache directory exists - CreateDirectoryTreeT(szPath); + CreateDirectoryTreeW(szPath); if (dwUin != 0) _ltow(dwUin, pszDest + tPathLen, 10); @@ -99,7 +99,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest } else { wchar_t szBuf[MAX_PATH]; - if (CallService(MS_DB_GETPROFILENAMET, MAX_PATH, (LPARAM)szBuf)) + if (CallService(MS_DB_GETPROFILENAMEW, MAX_PATH, (LPARAM)szBuf)) mir_wstrcpy(pszDest + tPathLen, L"avatar"); else { wchar_t *szLastDot = wcsrchr(szBuf, '.'); @@ -1226,7 +1226,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen if (!pCookieData->hContact) { // our avatar, set filename wchar_t tmp[MAX_PATH * 2]; PathToRelativeT(tszImageFile, tmp); - ppro->setTString(NULL, "AvatarFile", tmp); + ppro->setWString(NULL, "AvatarFile", tmp); } else { // contact's avatar set hash DBVARIANT dbv = { DBVT_DELETED }; diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index bafbfb8dda..938a486e08 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -169,7 +169,7 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns char *oldStatusMsg = NULL; DBVARIANT dbv; - if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) { oldStatusMsg = make_utf8_string(dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index 93382f6b04..f1855ce4b4 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -155,7 +155,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD wchar_t* ptszFileName = mir_utf8decodeW(pszFileName); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = mir_utf8decodeW(pszDescription); diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index a767d5987a..94633b1d97 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -93,14 +93,14 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP LoadDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive", DEFAULT_KEEPALIVE_ENABLED); SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETRANGE, FALSE, MAKELONG(0, 4)); SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETPOS, TRUE, 4 - ppro->getByte("ShowLogLevel", LOG_WARNING)); - SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); + SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateW(szLogLevelDescr[4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_HIDE); LoadDBCheckState(ppro, hwndDlg, IDC_NOERRMULTI, "IgnoreMultiErrorBox", 0); } return TRUE; case WM_HSCROLL: - SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); + SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateW(szLogLevelDescr[4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); OptDlgChanged(hwndDlg); break; @@ -514,7 +514,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pwszGroup = LPGENW("Network"); odp.dwInitParam = LPARAM(this); odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszTab = LPGENW("Account"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQ); diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 0c755f0d79..fe362f382a 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -160,7 +160,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : wchar_t szBuffer[MAX_PATH + 64]; mir_snwprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName); nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.ptszDescriptiveName = szBuffer; nlu.szSettingsModule = m_szModuleName; nlu.szHttpGatewayHello = "http://http.proxy.icq.com/hello"; @@ -174,7 +174,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : char szP2PModuleName[MAX_PATH]; mir_snprintf(szP2PModuleName, "%sP2P", m_szModuleName); mir_snwprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName); - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_UNICODE; nlu.ptszDescriptiveName = szBuffer; nlu.szSettingsModule = szP2PModuleName; nlu.minIncomingPorts = 1; diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 52f532436f..417541d349 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -893,7 +893,7 @@ void InitXStatusIcons() SKINICONDESC sid = { 0 }; sid.section.a = "Protocols/" ICQ_PROTOCOL_NAME "/" LPGEN("Custom Status"); - sid.flags = SIDF_PATH_TCHAR; + sid.flags = SIDF_PATH_UNICODE; sid.defaultFile.w = InitXStatusIconLibrary(lib, _countof(lib)); for (int i = 0; i < XSTATUS_COUNT; i++) { @@ -945,13 +945,13 @@ INT_PTR CIcqProto::SetXStatusEx(WPARAM, LPARAM lParam) if (m_bXStatusEnabled && (pData->flags & CSSF_MASK_NAME)) { // set custom status name if (pData->flags & CSSF_UNICODE) - setTString(DBSETTING_XSTATUS_NAME, pData->pwszName); + setWString(DBSETTING_XSTATUS_NAME, pData->pwszName); else setString(DBSETTING_XSTATUS_NAME, pData->pszName); } if (pData->flags & CSSF_MASK_MESSAGE) { // set custom status message if (pData->flags & CSSF_UNICODE) - setTString(DBSETTING_XSTATUS_MSG, pData->pwszMessage); + setWString(DBSETTING_XSTATUS_MSG, pData->pwszMessage); else setString(DBSETTING_XSTATUS_MSG, pData->pszMessage); diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index d8e50a1837..b1ec3e8330 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -66,7 +66,7 @@ static int LookupDatabaseSetting(const FieldNamesItem* table, int code, DBVARIAN } else if (type == DBVT_WCHAR) { WCHAR* wtext = make_unicode_string(text); - dbv->pwszVal = mir_wstrdup(TranslateTS(wtext)); + dbv->pwszVal = mir_wstrdup(TranslateW(wtext)); dbv->type = DBVT_WCHAR; SAFE_FREE((void**)&wtext); } @@ -524,7 +524,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) wchar_t tmp[MAX_PATH]; PathToRelativeT(tszMyFile, tmp); - setTString(NULL, "AvatarFile", tmp); + setWString(NULL, "AvatarFile", tmp); SAFE_FREE((void**)&hash); } else { @@ -542,7 +542,7 @@ INT_PTR CIcqProto::SetNickName(WPARAM wParam, LPARAM lParam) return 0; // failure if (wParam & SMNN_UNICODE) - setTString("Nick", (WCHAR*)lParam); + setWString("Nick", (WCHAR*)lParam); else setString("Nick", (char*)lParam); @@ -668,7 +668,7 @@ INT_PTR icq_getEventTextMissedMessage(WPARAM, LPARAM lParam) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszText, (int)mir_strlen(pszText), pwszText, wchars); - nRetVal = (INT_PTR)mir_wstrdup(TranslateTS(pwszText)); + nRetVal = (INT_PTR)mir_wstrdup(TranslateW(pwszText)); } else if (pEvent->datatype == DBVT_ASCIIZ) nRetVal = (INT_PTR)mir_strdup(Translate(pszText)); diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index fdfa9da536..5d5d480194 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -500,7 +500,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * wchar_t* ptszFileName = mir_utf8decodeW(pszFileName); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = mir_utf8decodeW(pszDescription); diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 25ba1d7e98..f58065619b 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -268,7 +268,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) return 0; OPTIONSDIALOGPAGE odp = { 0 }; - odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.hInstance = hInst; odp.dwInitParam = LPARAM(this); odp.pfnDlgProc = IcqDlgProc; diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 3e13e9efe1..c1f05aacbb 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1443,7 +1443,7 @@ char* __fastcall ICQTranslateUtf(const char *src) { // we can use unicode translate (0.5+) WCHAR* usrc = make_unicode_string(src); - szRes = make_utf8_string(TranslateTS(usrc)); + szRes = make_utf8_string(TranslateW(usrc)); SAFE_FREE((void**)&usrc); } @@ -1455,7 +1455,7 @@ char* __fastcall ICQTranslateUtfStatic(const char *src, char *buf, size_t bufsiz if (mir_strlen(src)) { // we can use unicode translate (0.5+) WCHAR *usrc = make_unicode_string(src); - make_utf8_string_static(TranslateTS(usrc), buf, bufsize); + make_utf8_string_static(TranslateW(usrc), buf, bufsize); SAFE_FREE((void**)&usrc); } diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index c074e502ef..18008f7313 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -124,7 +124,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) } // init fontservice for info frame - FontIDT fontid = { 0 }; + FontIDW fontid = { 0 }; fontid.cbSize = sizeof(fontid); wcsncpy_s(fontid.group, LPGENW("Jabber"), _TRUNCATE); strncpy_s(fontid.dbSettingsGroup, GLOBAL_SETTING_MODULE, _TRUNCATE); @@ -141,14 +141,14 @@ static int OnModulesLoaded(WPARAM, LPARAM) wcsncpy_s(fontid.name, LPGENW("Frame title"), _TRUNCATE); strncpy_s(fontid.prefix, "fntFrameTitle", _TRUNCATE); fontid.deffontsettings.style = DBFONTF_BOLD; - FontRegisterT(&fontid); + FontRegisterW(&fontid); wcsncpy_s(fontid.name, LPGENW("Frame text"), _TRUNCATE); strncpy_s(fontid.prefix, "fntFrameClock", _TRUNCATE); fontid.deffontsettings.style = 0; - FontRegisterT(&fontid); + FontRegisterW(&fontid); - ColourIDT colourid = {0}; + ColourIDW colourid = {0}; colourid.cbSize = sizeof(colourid); wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); strncpy_s(colourid.dbSettingsGroup, GLOBAL_SETTING_MODULE, _TRUNCATE); @@ -156,7 +156,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) wcsncpy_s(colourid.name, L"Background", _TRUNCATE); strncpy_s(colourid.setting, "clFrameBack", _TRUNCATE); colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterT(&colourid); + ColourRegisterW(&colourid); return 0; } diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index e29f3fde4e..b643adf547 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -181,7 +181,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe const wchar_t *name = XmlGetAttrValue(itemNode, L"name"); if (!name) name = XmlGetAttrValue(itemNode, L"node"); - ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg, IDC_FRAME), TranslateTS(name), nodeIdx, ypos, (nodeIdx == 1) ? 1 : 0); + ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg, IDC_FRAME), TranslateW(name), nodeIdx, ypos, (nodeIdx == 1) ? 1 : 0); dat->CurrentHeight = ypos; } } @@ -232,7 +232,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA else if (LPCTSTR ptszTitle = XmlGetText(XmlGetChild(xNode, "title"))) JabberFormSetInstruction(hwndDlg, ptszTitle); else - JabberFormSetInstruction(hwndDlg, TranslateTS(status)); + JabberFormSetInstruction(hwndDlg, TranslateW(status)); JabberFormCreateUI(hFrame, xNode, &dat->CurrentHeight); ShowDlgItem(hwndDlg, IDC_FRAME, SW_SHOW); } @@ -242,7 +242,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA sttShowControls(hwndDlg, FALSE, toHide); LPCTSTR noteText = XmlGetText(XmlGetChild(commandNode, "note")); - JabberFormSetInstruction(hwndDlg, noteText ? noteText : TranslateTS(status)); + JabberFormSetInstruction(hwndDlg, noteText ? noteText : TranslateW(status)); } // check actions @@ -513,7 +513,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) int res = -1; if ((hContact != NULL || lParam != 0) && m_bJabberOnline) { - ptrW szJid(getTStringA(hContact, "jid")); + ptrW szJid(getWStringA(hContact, "jid")); if (hContact && szJid != NULL) { JABBER_LIST_ITEM *item = NULL; int selected = 0; diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 167c518bdc..45fcc27744 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -57,7 +57,7 @@ MCONTACT CJabberProto::ContactFromJID(LPCTSTR jid) LPTSTR CJabberProto::ContactToJID(MCONTACT hContact) { - return getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"); + return getWStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"); } LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid) @@ -87,7 +87,7 @@ LPTSTR CJabberProto::GetResourceList(LPCTSTR jid) if (!item->arResources.getCount()) return NULL; - CMString res; + CMStringW res; for (int i=0; i < item->arResources.getCount(); i++) { res.Append(item->arResources[i]->m_tszResourceName); res.AppendChar(0); diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index a940fee985..c6cd6c33d2 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -153,7 +153,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) BOOL bDirect = m_options.BsDirect; if (m_options.BsProxyManual) { - ptrW proxyJid( getTStringA("BsProxyServer")); + ptrW proxyJid( getWStringA("BsProxyServer")); if (proxyJid) { jbt->bProxyDiscovered = FALSE; jbt->szProxyHost = NULL; @@ -626,7 +626,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) port = (WORD)_wtoi(szPort); replaceStrW(jbt->streamhostJID, str); - debugLog(L"bytestream_recv connecting to %s:%d", szHost, port); + debugLogW(L"bytestream_recv connecting to %s:%d", szHost, port); NETLIBOPENCONNECTION nloc = { 0 }; nloc.cbSize = sizeof(nloc); nloc.szHost = mir_u2a(szHost); diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index f4457137c8..0a4e6b25a6 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -268,7 +268,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app m_clientCapsManager.SetClientCaps(r->m_tszCapsNode, token, JABBER_RESOURCE_CAPS_IN_PROGRESS, pInfo->GetIqId()); m_ThreadInfo->send( - XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", CMString(FORMAT, L"%s#%s", r->m_tszCapsNode, token))); + XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", CMStringW(FORMAT, L"%s#%s", r->m_tszCapsNode, token))); bRequestSent = TRUE; } @@ -558,12 +558,12 @@ JabberCapsBits CJabberClientCapsManager::GetClientCaps(wchar_t *szNode, wchar_t CJabberClientCaps *pClient = FindClient(szNode); if (!pClient) { lck.unlock(); - ppro->debugLog(L"CAPS: get no caps for: %s, %s", szNode, szVer); + ppro->debugLogW(L"CAPS: get no caps for: %s, %s", szNode, szVer); return JABBER_RESOURCE_CAPS_UNINIT; } JabberCapsBits jcbCaps = pClient->GetPartialCaps(szVer); lck.unlock(); - ppro->debugLog(L"CAPS: get caps %I64x for: %s, %s", jcbCaps, szNode, szVer); + ppro->debugLogW(L"CAPS: get caps %I64x for: %s, %s", jcbCaps, szNode, szVer); return jcbCaps; } @@ -581,7 +581,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(const wchar_t *szNode, const wchar_ } BOOL bOk = pClient->SetPartialCaps(szVer, jcbCaps, nIqId); lck.unlock(); - ppro->debugLog(L"CAPS: set caps %I64x for: %s, %s", jcbCaps, szNode, szVer); + ppro->debugLogW(L"CAPS: set caps %I64x for: %s, %s", jcbCaps, szNode, szVer); return bOk; } diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 0de9eda1bb..e775f43923 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -50,7 +50,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPCTSTR hint = params->hint; if (hint == NULL) hint = TranslateT("Enter the text you see"); - SetDlgItemText(hwndDlg, IDC_INSTRUCTION, TranslateTS(hint)); + SetDlgItemText(hwndDlg, IDC_INSTRUCTION, TranslateW(hint)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)params); return TRUE; diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 4f3cf9534c..d5599c001b 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -74,7 +74,7 @@ struct TRoleOrAffiliationInfo } void translate() { - this->title = TranslateTS(this->title_en); + this->title = TranslateW(this->title_en); } }; @@ -141,27 +141,27 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) if (JABBER_LIST_ITEM *bookmark = ListGetItemPtr(LIST_BOOKMARK, item->jid)) { if (bookmark->name) { - ptrW myHandle(db_get_tsa(si->hContact, "CList", "MyHandle")); + ptrW myHandle(db_get_wsa(si->hContact, "CList", "MyHandle")); if (myHandle == NULL) - db_set_ts(si->hContact, "CList", "MyHandle", bookmark->name); + db_set_ws(si->hContact, "CList", "MyHandle", bookmark->name); } } - ptrW tszNick(getTStringA(si->hContact, "MyNick")); + ptrW tszNick(getWStringA(si->hContact, "MyNick")); if (tszNick != NULL) { if (!mir_wstrcmp(tszNick, szNick)) delSetting(si->hContact, "MyNick"); else - setTString(si->hContact, "MyNick", item->nick); + setWString(si->hContact, "MyNick", item->nick); } - else setTString(si->hContact, "MyNick", item->nick); + else setWString(si->hContact, "MyNick", item->nick); - ptrW passw(getTStringA(si->hContact, "Password")); + ptrW passw(getWStringA(si->hContact, "Password")); if (lstrcmp_null(passw, item->password)) { if (!item->password || !item->password[0]) delSetting(si->hContact, "Password"); else - setTString(si->hContact, "Password", item->password); + setWString(si->hContact, "Password", item->password); } } @@ -170,7 +170,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP }; GCEVENT gce = { sizeof(gce), &gcd }; for (int i = _countof(sttStatuses) - 1; i >= 0; i--) { - gce.ptszStatus = TranslateTS(sttStatuses[i]); + gce.ptszStatus = TranslateW(sttStatuses[i]); CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); } @@ -184,7 +184,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus { if (!item || !user || (item->bChatActive != 2)) return; - CMString buf; + CMStringW buf; switch (type) { case INFO_BAN: @@ -300,7 +300,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t } gce.ptszText = TranslateT("Moderator"); } - gce.ptszStatus = TranslateTS(sttStatuses[JabberGcGetStatus(JS)]); + gce.ptszStatus = TranslateW(sttStatuses[JabberGcGetStatus(JS)]); gce.bIsMe = (mir_wstrcmp(nick, myNick) == 0); statusToSet = JS->m_iStatus; break; @@ -331,11 +331,11 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) wchar_t *szMessage = NULL; if (code != 307 && code != 301) { - ptrW tszMessage(getTStringA("GcMsgQuit")); + ptrW tszMessage(getWStringA("GcMsgQuit")); if (tszMessage != NULL) szMessage = NEWWSTR_ALLOCA(tszMessage); else - szMessage = TranslateTS(JABBER_GC_MSG_QUIT); + szMessage = TranslateW(JABBER_GC_MSG_QUIT); } else { ptrW myNick(JabberNickFromJID(m_szJabberJID)); @@ -729,7 +729,7 @@ public: { CSuper::OnInitDialog(); - SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMString(FORMAT, TranslateT("Invite Users to\n%s"), m_room)); + SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMStringW(FORMAT, TranslateT("Invite Users to\n%s"), m_room)); Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP)); SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_CLIST), GWL_STYLE, @@ -786,7 +786,7 @@ public: if (int hItem = SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0)) { if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { - ptrW jid(m_proto->getTStringA(hContact, "jid")); + ptrW jid(m_proto->getWStringA(hContact, "jid")); if (jid != NULL) InviteUser(jid, text); } @@ -998,7 +998,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* enum { BAN_KICK_INTERVAL = 1000 }; static DWORD dwLastBanKickTime = 0; - CMString szBuffer, szTitle; + CMStringW szBuffer, szTitle; if ((gch->dwData >= CLISTMENUIDMIN) && (gch->dwData <= CLISTMENUIDMAX)) { if (him->m_tszRealJid && *him->m_tszRealJid) @@ -1010,9 +1010,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* switch (gch->dwData) { case IDM_SLAP: if (ppro->m_bJabberOnline) { - ptrW szMessage(ppro->getTStringA("GcMsgSlap")); + ptrW szMessage(ppro->getWStringA("GcMsgSlap")); if (szMessage == NULL) - szMessage = mir_wstrdup(TranslateTS(JABBER_GC_MSG_SLAP)); + szMessage = mir_wstrdup(TranslateW(JABBER_GC_MSG_SLAP)); wchar_t buf[256]; // do not use snprintf to avoid possible problems with % symbol @@ -1031,10 +1031,10 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_VCARD: { - CMString jid(FORMAT, L"%s/%s", item->jid, him->m_tszResourceName); + CMStringW jid(FORMAT, L"%s/%s", item->jid, him->m_tszResourceName); MCONTACT hContact = ppro->AddToListByJID(jid, PALF_TEMPORARY); - ppro->setTString(hContact, "Nick", him->m_tszResourceName); + ppro->setWString(hContact, "Nick", him->m_tszResourceName); ppro->ListAdd(LIST_VCARD_TEMP, jid, hContact); ppro->ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority); @@ -1217,7 +1217,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_tszRealJid && *him->m_tszRealJid) { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = NEWWSTR_ALLOCA(him->m_tszRealJid); if (wchar_t *tmp = wcschr(psr.id.w, '/')) *tmp = 0; @@ -1235,7 +1235,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* gch) { - CMString szBuffer, szTitle; + CMStringW szBuffer, szTitle; switch (gch->dwData) { case IDM_LST_PARTICIPANT: @@ -1372,7 +1372,7 @@ static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, co ppro->setWord(hContact, "Status", r->m_iStatus); db_set_b(hContact, "CList", "Hidden", 1); - ppro->setTString(hContact, "Nick", nick); + ppro->setWString(hContact, "Nick", nick); db_set_dw(hContact, "Ignore", "Mask1", 0); CallService(MS_MSG_SENDMESSAGE, hContact, 0); } diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 28af8638a0..1a330e2ae7 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -346,7 +346,7 @@ void CJabberDlgConsole::OnInitDialog() m_proto->m_filterInfo.type = (TFilterInfo::Type)m_proto->getByte("consoleWnd_ftype", TFilterInfo::T_OFF); *m_proto->m_filterInfo.pattern = 0; - ptrW tszPattern( m_proto->getTStringA("consoleWnd_fpattern")); + ptrW tszPattern( m_proto->getWStringA("consoleWnd_fpattern")); if (tszPattern != NULL) mir_wstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern)); @@ -397,7 +397,7 @@ void CJabberDlgConsole::OnClose() m_proto->setByte("consoleWnd_presence", m_proto->m_filterInfo.presence); m_proto->setByte("consoleWnd_iq", m_proto->m_filterInfo.iq); m_proto->setByte("consoleWnd_ftype", m_proto->m_filterInfo.type); - m_proto->setTString("consoleWnd_fpattern", m_proto->m_filterInfo.pattern); + m_proto->setWString("consoleWnd_fpattern", m_proto->m_filterInfo.pattern); Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "consoleWnd_"); DestroyWindow(m_hwnd); @@ -568,7 +568,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) for (i = 0; i < _countof(filter_modes); i++) AppendMenu(hMenu, MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0), - filter_modes[i].type + 1, TranslateTS(filter_modes[i].title)); + filter_modes[i].type + 1, TranslateW(filter_modes[i].title)); RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_BTN_FILTER), &rc); CheckDlgButton(m_hwnd, IDC_BTN_FILTER, BST_CHECKED); diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 9f2d52f03e..6fefdf6ca2 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -450,14 +450,14 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) for (int i = 0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, "discoWnd_favName_%d", i); - ptrW tszName(getTStringA(setting)); + ptrW tszName(getWStringA(setting)); if (tszName == NULL) continue; mir_snprintf(setting, "discoWnd_favJID_%d", i); - ptrW dbvJid(getTStringA(setting)); + ptrW dbvJid(getWStringA(setting)); mir_snprintf(setting, "discoWnd_favNode_%d", i); - ptrW dbvNode(getTStringA(setting)); + ptrW dbvNode(getWStringA(setting)); CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(dbvJid, dbvNode, tszName); SendBothRequests(pNode, NULL); } @@ -802,7 +802,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) for (int i = 0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, "discoWnd_favName_%d", i); - ptrW tszName(m_proto->getTStringA(setting)); + ptrW tszName(m_proto->getWStringA(setting)); if (tszName != NULL) { HMENU hSubMenu = CreatePopupMenu(); AppendMenu(hSubMenu, MF_STRING, 100 + i * 10 + 0, TranslateT("Navigate")); @@ -851,11 +851,11 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, "discoWnd_favJID_%d", res); - ptrW dbv(m_proto->getTStringA(setting)); + ptrW dbv(m_proto->getWStringA(setting)); if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv); mir_snprintf(setting, "discoWnd_favNode_%d", res); - dbv = m_proto->getTStringA(setting); + dbv = m_proto->getWStringA(setting); if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_NODE, dbv); PostMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_BUTTON_BROWSE, 0), 0); @@ -1235,9 +1235,9 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM MCONTACT hContact; if ((items[i].action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) { HMENU hContactMenu = Menu_BuildContactMenu(hContact); - AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hContactMenu, TranslateTS(items[i].title)); + AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hContactMenu, TranslateW(items[i].title)); } - else AppendMenu(hMenu, MF_STRING, items[i].action, TranslateTS(items[i].title)); + else AppendMenu(hMenu, MF_STRING, items[i].action, TranslateW(items[i].title)); lastSeparator = FALSE; } else if (!lastSeparator) { @@ -1257,7 +1257,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM if (bFeatureOk) { if (items[i].title) { - AppendMenu(hMenu, MF_STRING, items[i].action, TranslateTS(items[i].title)); + AppendMenu(hMenu, MF_STRING, items[i].action, TranslateW(items[i].title)); lastSeparator = FALSE; } else if (!lastSeparator) { @@ -1341,11 +1341,11 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM char setting[MAXMODULELABELLENGTH]; int count = getDword("discoWnd_favCount", 0); mir_snprintf(setting, "discoWnd_favName_%d", count); - setTString(setting, pNode->GetName() ? pNode->GetName() : pNode->GetJid()); + setWString(setting, pNode->GetName() ? pNode->GetName() : pNode->GetJid()); mir_snprintf(setting, "discoWnd_favJID_%d", count); - setTString(setting, pNode->GetJid()); + setWString(setting, pNode->GetJid()); mir_snprintf(setting, "discoWnd_favNode_%d", count); - setTString(setting, pNode->GetNode() ? pNode->GetNode() : L""); + setWString(setting, pNode->GetNode() ? pNode->GetNode() : L""); setDword("discoWnd_favCount", ++count); } break; @@ -1365,7 +1365,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_PROXY: m_options.BsDirect = FALSE; m_options.BsProxyManual = TRUE; - setTString("BsProxyServer", pNode->GetJid()); + setWString("BsProxyServer", pNode->GetJid()); break; case SD_ACT_JOIN: diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h index ecc55393e6..dbef9300f7 100644 --- a/protocols/JabberG/src/jabber_disco.h +++ b/protocols/JabberG/src/jabber_disco.h @@ -347,7 +347,7 @@ public: BOOL GetTooltipText(wchar_t *szText, int nMaxLength) { - CMString tszTmp; + CMStringW tszTmp; tszTmp.AppendFormat(L"Jid: %s\r\n", m_szJid); diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 61aecd3a6b..c02aed14c2 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -36,7 +36,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) if (!m_bJabberOnline) // should never happen return 0; - ptrW jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid")); + ptrW jid(getWStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid")); if (jid == NULL) return 0; @@ -76,13 +76,13 @@ static wchar_t* sttSettingToTchar(DBCONTACTWRITESETTING *cws) void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hContact) { - JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid"))); + JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getWStringA(hContact, "jid"))); if (item == NULL) return; - ptrW tszNick(db_get_tsa(hContact, "CList", "MyHandle")); + ptrW tszNick(db_get_wsa(hContact, "CList", "MyHandle")); if (tszNick == NULL) - tszNick = getTStringA(hContact, "Nick"); + tszNick = getWStringA(hContact, "Nick"); if (tszNick == NULL) tszNick = JabberNickFromJID(item->jid); if (tszNick == NULL) @@ -97,7 +97,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC else { wchar_t *p = sttSettingToTchar(cws); if (cws->value.pszVal != NULL && mir_wstrcmp(p, item->group)) { - debugLog(L"Group set to %s", p); + debugLogW(L"Group set to %s", p); if (p) AddContactToRoster(item->jid, tszNick, p); } @@ -107,7 +107,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT hContact) { - JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW( getTStringA(hContact, "jid"))); + JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW( getWStringA(hContact, "jid"))); if (item == NULL) return; @@ -120,7 +120,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT ptrW newNick( sttSettingToTchar(cws)); if (newNick && mir_wstrcmp(item->nick, newNick)) { - debugLog(L"Renaming contact %s: %s -> %s", item->jid, item->nick, newNick); + debugLogW(L"Renaming contact %s: %s -> %s", item->jid, item->nick, newNick); AddContactToRoster(item->jid, newNick, item->group); } } @@ -130,23 +130,23 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, MCONT if (cws->value.type != DBVT_DELETED && !(cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) return; - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid == NULL) return; - debugLog(L"Add %s permanently to list", jid); - ptrW nick(db_get_tsa(hContact, "CList", "MyHandle")); + debugLogW(L"Add %s permanently to list", jid); + ptrW nick(db_get_wsa(hContact, "CList", "MyHandle")); if (nick == NULL) - nick = getTStringA(hContact, "Nick"); + nick = getWStringA(hContact, "Nick"); if (nick == NULL) nick = JabberNickFromJID(jid); if (nick == NULL) return; - AddContactToRoster(jid, nick, ptrW(db_get_tsa(hContact, "CList", "Group"))); + AddContactToRoster(jid, nick, ptrW(db_get_wsa(hContact, "CList", "Group"))); XmlNode xPresence(L"presence"); xPresence << XATTR(L"to", LPCTSTR(jid)) << XATTR(L"type", L"subscribe"); - ptrW myNick(getTStringA(NULL, "Nick")); + ptrW myNick(getWStringA(NULL, "Nick")); if (myNick != NULL) xPresence << XCHILD(L"nick", LPCTSTR(myNick)) << XATTR(L"xmlns", JABBER_FEAT_NICK); m_ThreadInfo->send(xPresence); diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 27eda280b2..efb423bb95 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -390,11 +390,11 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, if (ft->httpPath == NULL) debugLogA("Requested file name does not matched (httpPath == NULL)"); else - debugLog(L"Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t); + debugLogW(L"Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t); ft->state = FT_ERROR; break; } - debugLog(L"Sending [%s]", ft->std.ptszFiles[currentFile]); + debugLogW(L"Sending [%s]", ft->std.ptszFiles[currentFile]); _wstat64(ft->std.ptszFiles[currentFile], &statbuf); // file size in statbuf.st_size if ((fileId = _wopen(ft->std.ptszFiles[currentFile], _O_BINARY | _O_RDONLY)) < 0) { debugLogA("File cannot be opened"); @@ -448,7 +448,7 @@ filetransfer::filetransfer(CJabberProto *proto) ppro = proto; fileId = -1; std.cbSize = sizeof(std); - std.flags = PFTS_TCHAR; + std.flags = PFTS_UNICODE; } filetransfer::~filetransfer() @@ -512,12 +512,12 @@ int filetransfer::create() WaitForSingleObject(hWaitEvent, INFINITE); if (fileId == -1) { - ppro->debugLog(L"Saving to [%s]", std.tszCurrentFile); + ppro->debugLogW(L"Saving to [%s]", std.tszCurrentFile); fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE); } if (fileId == -1) - ppro->debugLog(L"Cannot create file '%s' during a file transfer", filefull); + ppro->debugLogW(L"Cannot create file '%s' during a file transfer", filefull); else if (std.currentFileSize != 0) _chsize(fileId, std.currentFileSize); diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index ceabe55ba9..e1ee55f08a 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -727,7 +727,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (jfi->xNode != NULL && (n = XmlGetChild(jfi->xNode, L"title")) != NULL && XmlGetText(n) != NULL) SetWindowText(hwndDlg, XmlGetText(n)); else - SetWindowText(hwndDlg, TranslateTS(jfi->defTitle)); + SetWindowText(hwndDlg, TranslateW(jfi->defTitle)); // Set instruction field if (jfi->xNode != NULL && (n = XmlGetChild(jfi->xNode, L"instructions")) != NULL && XmlGetText(n) != NULL) @@ -736,7 +736,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (jfi->xNode != NULL && (n = XmlGetChild(jfi->xNode, L"title")) != NULL && XmlGetText(n) != NULL) JabberFormSetInstruction(hwndDlg, XmlGetText(n)); else - JabberFormSetInstruction(hwndDlg, TranslateTS(jfi->defTitle)); + JabberFormSetInstruction(hwndDlg, TranslateW(jfi->defTitle)); } // Create form diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index e1da41f62c..d9e880c771 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -82,7 +82,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto): frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", NULL, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, NULL, hInst, this); frame.align = alBottom; frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default - frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR; + frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_UNICODE; frame.tname = mir_a2u(proto->m_szModuleName); frame.TBtname = proto->m_tszUserName; m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0); @@ -240,24 +240,24 @@ void CJabberInfoFrame::ReloadFonts() { LOGFONT lfFont; - FontIDT fontid = {0}; + FontIDW fontid = {0}; fontid.cbSize = sizeof(fontid); wcsncpy_s(fontid.group, L"Jabber", _TRUNCATE); wcsncpy_s(fontid.name, L"Frame title", _TRUNCATE); - m_clTitle = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont); + m_clTitle = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lfFont); DeleteObject(m_hfntTitle); m_hfntTitle = CreateFontIndirect(&lfFont); wcsncpy_s(fontid.name, L"Frame text", _TRUNCATE); - m_clText = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont); + m_clText = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lfFont); DeleteObject(m_hfntText); m_hfntText = CreateFontIndirect(&lfFont); - ColourIDT colourid = {0}; + ColourIDW colourid = {0}; colourid.cbSize = sizeof(colourid); wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); wcsncpy_s(colourid.name, L"Background", _TRUNCATE); - m_clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, 0); + m_clBack = CallService(MS_COLOUR_GETW, (WPARAM)&colourid, 0); UpdateSize(); } diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 01ef6ac638..e68ce31eac 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -187,10 +187,10 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft) char* buffer; int numRead; - debugLog(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]); + debugLogW(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]); _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size if ((fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) { - debugLog(L"File cannot be opened"); + debugLogW(L"File cannot be opened"); return FALSE; } @@ -217,7 +217,7 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft) BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft) { - debugLog(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]); + debugLogW(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]); struct _stati64 statbuf; _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size @@ -375,7 +375,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) ft->std.totalBytes = ft->std.currentFileSize = filesize; PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.files.w = (wchar_t**)&filename; diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 52bef54a38..433414bb59 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -120,16 +120,16 @@ struct JabberGcRecentInfo { char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, "rcMuc_%d_server", iRecent); - m_server = ppro->getTStringA(setting); + m_server = ppro->getWStringA(setting); mir_snprintf(setting, "rcMuc_%d_room", iRecent); - m_room = ppro->getTStringA(setting); + m_room = ppro->getWStringA(setting); mir_snprintf(setting, "rcMuc_%d_nick", iRecent); - m_nick = ppro->getTStringA(setting); + m_nick = ppro->getWStringA(setting); mir_snprintf(setting, "password_rcMuc_%d", iRecent); - m_password = ppro->getTStringA(NULL, setting); + m_password = ppro->getWStringA(NULL, setting); return m_room || m_server || m_nick || m_password; } @@ -140,25 +140,25 @@ struct JabberGcRecentInfo mir_snprintf(setting, "rcMuc_%d_server", iRecent); if (m_server) - ppro->setTString(setting, m_server); + ppro->setWString(setting, m_server); else ppro->delSetting(setting); mir_snprintf(setting, "rcMuc_%d_room", iRecent); if (m_room) - ppro->setTString(setting, m_room); + ppro->setWString(setting, m_room); else ppro->delSetting(setting); mir_snprintf(setting, "rcMuc_%d_nick", iRecent); if (m_nick) - ppro->setTString(setting, m_nick); + ppro->setWString(setting, m_nick); else ppro->delSetting(setting); mir_snprintf(setting, "password_rcMuc_%d", iRecent); if (m_password) - ppro->setTString(setting, m_password); + ppro->setWString(setting, m_password); else ppro->delSetting(setting); } @@ -185,16 +185,16 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleJoinGroupchat(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM) { - ptrW jid(getTStringA(hContact, "ChatRoomID")); + ptrW jid(getWStringA(hContact, "ChatRoomID")); if (jid == NULL) return 0; - ptrW nick(getTStringA(hContact, "MyNick")); + ptrW nick(getWStringA(hContact, "MyNick")); if (nick == NULL) - if ((nick = getTStringA("Nick")) == NULL) + if ((nick = getWStringA("Nick")) == NULL) return 0; - ptrW password(getTStringA(hContact, "Password")); + ptrW password(getWStringA(hContact, "Password")); if (getWord(hContact, "Status", 0) != ID_STATUS_ONLINE) { wchar_t *p = wcschr(jid, '@'); @@ -209,7 +209,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM hContact, LPARAM) { - ptrW jid(getTStringA(hContact, "ChatRoomID")); + ptrW jid(getWStringA(hContact, "ChatRoomID")); if (jid != NULL) { if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid); @@ -439,7 +439,7 @@ void CJabberDlgGcJoin::OnInitDialog() delete pInfo; } - ptrW tszNick(m_proto->getTStringA("Nick")); + ptrW tszNick(m_proto->getWStringA("Nick")); if (tszNick == NULL) tszNick = JabberNickFromJID(m_proto->m_szJabberJID); SetDlgItemText(m_hwnd, IDC_NICK, tszNick); @@ -747,14 +747,14 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) JABBER_LIST_ITEM *item = param->ppro->ListGetItemPtr(LIST_CHATROOM, param->jid); if (item != NULL) { - CMString szBuffer, szTitle; + CMStringW szBuffer, szTitle; szTitle.Format(TranslateT("Change nickname in <%s>"), item->name ? item->name : item->jid); if (item->nick) szBuffer = item->nick; if (param->ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) { replaceStrW(item->nick, szBuffer); - param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMString(FORMAT, L"%s/%s", item->jid, szBuffer), NULL); + param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMStringW(FORMAT, L"%s/%s", item->jid, szBuffer), NULL); } } @@ -792,7 +792,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t * MCONTACT hContact = HContactFromJID(item->jid); if (hContact != NULL) - setTString(hContact, "MyNick", newNick); + setWString(hContact, "MyNick", newNick); } GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_CHUID }; @@ -1000,7 +1000,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) ptrW str(JabberErrorMsg(errorNode, &errorCode)); if (errorCode == JABBER_ERROR_CONFLICT) { - ptrW newNick(getTStringA("GcAltNick")); + ptrW newNick(getWStringA("GcAltNick")); if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) { replaceStrW(item->nick, newNick); wchar_t text[1024] = { 0 }; @@ -1026,7 +1026,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) HXML n, m; const wchar_t *from, *type, *p, *nick, *resource; JABBER_LIST_ITEM *item; - CMString imgLink; + CMStringW imgLink; if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"message")) return; if ((from = XmlGetAttrValue(node, L"from")) == NULL) return; @@ -1106,7 +1106,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) } else nick = NULL; - CMString tszText(msgText); + CMStringW tszText(msgText); tszText.Replace(L"%", L"%%"); tszText += imgLink; @@ -1141,7 +1141,7 @@ class CGroupchatInviteAcceptDlg : public CJabberDlgBase { typedef CJabberDlgBase CSuper; CCtrlButton m_accept; - CMString m_roomJid, m_from, m_reason, m_password; + CMStringW m_roomJid, m_from, m_reason, m_password; public: CGroupchatInviteAcceptDlg(CJabberProto *ppro, const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password) : @@ -1193,9 +1193,9 @@ void CJabberProto::GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t return; if (m_options.AutoAcceptMUC) { - ptrW nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick")); + ptrW nick(getWStringA(HContactFromJID(m_szJabberJID), "MyNick")); if (nick == NULL) - nick = getTStringA("Nick"); + nick = getWStringA("Nick"); if (nick == NULL) nick = JabberNickFromJID(m_szJabberJID); AcceptGroupchatInvite(roomJid, nick, password); diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 64aae7a25b..1a83ffad04 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -124,7 +124,7 @@ void CIconPool::RegisterIcon(const char *name, wchar_t *filename, int iconid, wc sid.pszName = szSettingName; sid.section.w = szSection; sid.description.w = szDescription; - sid.flags = SIDF_ALL_TCHAR; + sid.flags = SIDF_ALL_UNICODE; sid.iDefaultIndex = iconid; item->m_hIcolibItem = IcoLib_AddIcon(&sid); @@ -292,7 +292,7 @@ static HICON LoadTransportIcon(char *filename, int i, char *IconName, wchar_t *S sid.description.w = Description; sid.defaultFile.a = szMyPath; sid.iDefaultIndex = i; - sid.flags = SIDF_TCHAR; + sid.flags = SIDF_UNICODE; IcoLib_AddIcon(&sid); } return IcoLib_GetIcon(IconName); @@ -389,7 +389,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransported", 0)) return -1; - int iID = GetTransportProtoID(ptrW(getTStringA(hContact, "Transport"))); + int iID = GetTransportProtoID(ptrW(getWStringA(hContact, "Transport"))); if (iID < 0) return -1; @@ -436,7 +436,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon } if (isTransported) { - setTString(hContact, "Transport", domain); + setWString(hContact, "Transport", domain); setByte(hContact, "IsTransported", 1); } return isTransported; @@ -445,7 +445,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon void CJabberProto::CheckAllContactsAreTransported() { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid) DBCheckIsTransportedContact(jid, hContact); } diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 79db2a2232..a34fa92b9f 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -171,7 +171,7 @@ void CJabberIqManager::ExpireInfo(CJabberIqInfo *pInfo) if ((pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (pInfo->m_szFrom)) pInfo->m_hContact = ppro->HContactFromJID(pInfo->m_szFrom); - ppro->debugLog(L"Expiring iq id %d, sent to %s", pInfo->m_nIqId, pInfo->m_szReceiver ? pInfo->m_szReceiver : L"server"); + ppro->debugLogW(L"Expiring iq id %d, sent to %s", pInfo->m_nIqId, pInfo->m_szReceiver ? pInfo->m_szReceiver : L"server"); pInfo->m_nIqType = JABBER_IQ_TYPE_FAIL; (ppro->*(pInfo->m_pHandler))(NULL, pInfo); @@ -336,7 +336,7 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) if ((pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (iqInfo.m_szFrom)) iqInfo.m_hContact = ppro->HContactFromJID(iqInfo.m_szFrom); - ppro->debugLog(L"Handling iq id %s, type %s, from %s", iqInfo.m_szId, szType, iqInfo.m_szFrom); + ppro->debugLogW(L"Handling iq id %s, type %s, from %s", iqInfo.m_szId, szType, iqInfo.m_szFrom); if ((ppro->*(pInfo.m_pHandler))(pNode, &iqInfo)) return true; } diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 84e5c93ef8..301b24e15b 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -227,7 +227,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // invalid JID if (!bRetVal) { - debugLog(L" attempt to hack via roster push from %s", pInfo->GetFrom()); + debugLogW(L" attempt to hack via roster push from %s", pInfo->GetFrom()); return TRUE; } } @@ -256,7 +256,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) if (hContact == NULL) hContact = DBCreateContact(jid, nick, false, false); else - setTString(hContact, "jid", jid); + setWString(hContact, "jid", jid); JABBER_LIST_ITEM *item = ListAdd(LIST_ROSTER, jid, hContact); replaceStrW(item->nick, nick); @@ -265,21 +265,21 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) replaceStrW(item->group, XmlGetText(groupNode)); if (name != NULL) { - ptrW tszNick(getTStringA(hContact, "Nick")); + ptrW tszNick(getWStringA(hContact, "Nick")); if (tszNick != NULL) { if (mir_wstrcmp(nick, tszNick) != 0) - db_set_ts(hContact, "CList", "MyHandle", nick); + db_set_ws(hContact, "CList", "MyHandle", nick); else db_unset(hContact, "CList", "MyHandle"); } - else db_set_ts(hContact, "CList", "MyHandle", nick); + else db_set_ws(hContact, "CList", "MyHandle", nick); } else db_unset(hContact, "CList", "MyHandle"); if (!m_options.IgnoreRosterGroups) { if (item->group != NULL) { Clist_GroupCreate(0, item->group); - db_set_ts(hContact, "CList", "Group", item->group); + db_set_ws(hContact, "CList", "Group", item->group); } else db_unset(hContact, "CList", "Group"); } @@ -291,7 +291,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) else if (!mir_wstrcmp(str, L"to")) item->subscription = SUB_TO; else if (!mir_wstrcmp(str, L"from")) item->subscription = SUB_FROM; else item->subscription = SUB_NONE; - debugLog(L"Roster push for jid=%s, set subscription to %s", jid, str); + debugLogW(L"Roster push for jid=%s, set subscription to %s", jid, str); MCONTACT hContact = HContactFromJID(jid); @@ -371,7 +371,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) desc = (wchar_t*)XmlGetText(n); wchar_t *str2; - debugLog(L"description = %s", desc); + debugLogW(L"description = %s", desc); if ((str2 = wcsrchr(ft->httpPath, '/')) != NULL) str2++; else @@ -380,7 +380,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) JabberHttpUrlDecode(str2); PROTORECVFILET pre; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.timestamp = time(NULL); pre.descr.w = desc; pre.files.w = &str2; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index caa0532da6..1f94d96dc7 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -149,9 +149,9 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) if (item->nick && item->nick[0]) GroupchatJoinRoom(server, p, item->nick, item->password, true); else { - ptrW nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick")); + ptrW nick(getWStringA(HContactFromJID(m_szJabberJID), "MyNick")); if (nick == NULL) - nick = getTStringA("Nick"); + nick = getWStringA("Nick"); if (nick == NULL) nick = JabberNickFromJID(m_szJabberJID); @@ -264,9 +264,9 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return; if (!mir_wstrcmp(type, L"result")) { - ptrW tszNick(getTStringA("Nick")); + ptrW tszNick(getWStringA("Nick")); if (tszNick == NULL) - setTString("Nick", m_ThreadInfo->conn.username); + setWString("Nick", m_ThreadInfo->conn.username); OnLoggedIn(); } @@ -290,9 +290,9 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo) LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid"); if (szJid) { if (!wcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID))) - debugLog(L"Result Bind: %s confirmed ", m_ThreadInfo->fullJID); + debugLogW(L"Result Bind: %s confirmed ", m_ThreadInfo->fullJID); else { - debugLog(L"Result Bind: %s changed to %s", m_ThreadInfo->fullJID, szJid); + debugLogW(L"Result Bind: %s changed to %s", m_ThreadInfo->fullJID, szJid); wcsncpy_s(m_ThreadInfo->fullJID, szJid, _TRUNCATE); } } @@ -318,7 +318,7 @@ void CJabberProto::OnIqResultSession(HXML, CJabberIqInfo *pInfo) void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) { - ptrW roomjid(getTStringA(hContact, "ChatRoomID")); + ptrW roomjid(getWStringA(hContact, "ChatRoomID")); if (roomjid == NULL) return; @@ -329,14 +329,14 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) server[0] = 0; server++; - ptrW nick(getTStringA(hContact, "MyNick")); + ptrW nick(getWStringA(hContact, "MyNick")); if (nick == NULL) { nick = JabberNickFromJID(m_szJabberJID); if (nick == NULL) return; } - GroupchatJoinRoom(server, room, nick, ptrW(getTStringA(hContact, "Password")), autojoin); + GroupchatJoinRoom(server, room, nick, ptrW(getWStringA(hContact, "Password")), autojoin); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -427,14 +427,14 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) } if (name != NULL) { - ptrW tszNick(getTStringA(hContact, "Nick")); + ptrW tszNick(getWStringA(hContact, "Nick")); if (tszNick != NULL) { if (mir_wstrcmp(nick, tszNick) != 0) - db_set_ts(hContact, "CList", "MyHandle", nick); + db_set_ws(hContact, "CList", "MyHandle", nick); else db_unset(hContact, "CList", "MyHandle"); } - else db_set_ts(hContact, "CList", "MyHandle", nick); + else db_set_ws(hContact, "CList", "MyHandle", nick); } else db_unset(hContact, "CList", "MyHandle"); @@ -461,12 +461,12 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) Clist_GroupCreate(0, item->group); // Don't set group again if already correct, or Miranda may show wrong group count in some case - ptrW tszGroup(db_get_tsa(hContact, "CList", "Group")); + ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); if (tszGroup != NULL) { if (mir_wstrcmp(tszGroup, item->group)) - db_set_ts(hContact, "CList", "Group", item->group); + db_set_ws(hContact, "CList", "Group", item->group); } - else db_set_ts(hContact, "CList", "Group", item->group); + else db_set_ws(hContact, "CList", "Group", item->group); } else db_unset(hContact, "CList", "Group"); } @@ -492,9 +492,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (m_options.RosterSync == TRUE) { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) { MCONTACT hNext = db_find_next(hContact, m_szModuleName); - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL && !ListGetItemPtr(LIST_ROSTER, jid)) { - debugLog(L"Syncing roster: preparing to delete %s (hContact=0x%x)", jid, hContact); + debugLogW(L"Syncing roster: preparing to delete %s (hContact=0x%x)", jid, hContact); CallService(MS_DB_CONTACT_DELETE, hContact, 0); } hContact = hNext; @@ -601,7 +601,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP wchar_t szAvatarFileName[MAX_PATH]; GetAvatarFileName(hContact, szAvatarFileName, _countof(szAvatarFileName)); - debugLog(L"Picture file name set to %s", szAvatarFileName); + debugLogW(L"Picture file name set to %s", szAvatarFileName); HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return; @@ -618,10 +618,10 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP hasPhoto = true; CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)szAvatarFileName); - debugLog(L"My picture saved to %s", szAvatarFileName); + debugLogW(L"My picture saved to %s", szAvatarFileName); } else { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid); if (item == NULL) { @@ -634,7 +634,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP if (item->photoFileName && mir_wstrcmp(item->photoFileName, szAvatarFileName)) DeleteFile(item->photoFileName); replaceStrW(item->photoFileName, szAvatarFileName); - debugLog(L"Contact's picture saved to %s", szAvatarFileName); + debugLogW(L"Contact's picture saved to %s", szAvatarFileName); OnIqResultGotAvatar(hContact, o, szPicType); } } @@ -672,7 +672,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (!mir_wstrcmp(type, L"result")) { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = sttGetText(vCardNode, "NICKNAME"); psr.firstName.w = sttGetText(vCardNode, "FN"); psr.lastName.w = L""; @@ -726,13 +726,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (!mir_wstrcmp(XmlGetName(n), L"FN")) { if (XmlGetText(n) != NULL) { hasFn = true; - setTString(hContact, "FullName", XmlGetText(n)); + setWString(hContact, "FullName", XmlGetText(n)); } } else if (!mir_wstrcmp(XmlGetName(n), L"NICKNAME")) { if (XmlGetText(n) != NULL) { hasNick = true; - setTString(hContact, "Nick", XmlGetText(n)); + setWString(hContact, "Nick", XmlGetText(n)); } } else if (!mir_wstrcmp(XmlGetName(n), L"N")) { @@ -740,15 +740,15 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (!hasGiven && !hasFamily && !hasMiddle) { if ((m = XmlGetChild(n, "GIVEN")) != NULL && XmlGetText(m) != NULL) { hasGiven = true; - setTString(hContact, "FirstName", XmlGetText(m)); + setWString(hContact, "FirstName", XmlGetText(m)); } if ((m = XmlGetChild(n, "FAMILY")) != NULL && XmlGetText(m) != NULL) { hasFamily = true; - setTString(hContact, "LastName", XmlGetText(m)); + setWString(hContact, "LastName", XmlGetText(m)); } if ((m = XmlGetChild(n, "MIDDLE")) != NULL && XmlGetText(m) != NULL) { hasMiddle = true; - setTString(hContact, "MiddleName", XmlGetText(m)); + setWString(hContact, "MiddleName", XmlGetText(m)); } } } @@ -765,7 +765,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) mir_snprintf(text, "e-mail%d", nEmail - 1); } else mir_snprintf(text, "e-mail%d", nEmail); - setTString(hContact, text, XmlGetText(m)); + setWString(hContact, text, XmlGetText(m)); if (hContact == NULL) { mir_snprintf(text, "e-mailFlag%d", nEmail); @@ -800,7 +800,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) } else { hasBday = true; - setTString("BirthDate", XmlGetText(n)); + setWString("BirthDate", XmlGetText(n)); } } } @@ -815,7 +815,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) } else { hasGender = true; - setTString("GenderString", XmlGetText(n)); + setWString("GenderString", XmlGetText(n)); } } } @@ -834,36 +834,36 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else wcsncpy_s(text, XmlGetText(m), _TRUNCATE); text[_countof(text) - 1] = '\0'; - setTString(hContact, "Street", text); + setWString(hContact, "Street", text); } else { - setTString(hContact, "Street", XmlGetText(m)); + setWString(hContact, "Street", XmlGetText(m)); if ((m = XmlGetChild(n, "EXTADR")) == NULL) m = XmlGetChild(n, "EXTADD"); if (m != NULL && XmlGetText(m) != NULL) { hasHomeStreet2 = true; - setTString(hContact, "Street2", XmlGetText(m)); + setWString(hContact, "Street2", XmlGetText(m)); } } } if ((m = XmlGetChild(n, "LOCALITY")) != NULL && XmlGetText(m) != NULL) { hasHomeLocality = true; - setTString(hContact, "City", XmlGetText(m)); + setWString(hContact, "City", XmlGetText(m)); } if ((m = XmlGetChild(n, "REGION")) != NULL && XmlGetText(m) != NULL) { hasHomeRegion = true; - setTString(hContact, "State", XmlGetText(m)); + setWString(hContact, "State", XmlGetText(m)); } if ((m = XmlGetChild(n, "PCODE")) != NULL && XmlGetText(m) != NULL) { hasHomePcode = true; - setTString(hContact, "ZIP", XmlGetText(m)); + setWString(hContact, "ZIP", XmlGetText(m)); } if ((m = XmlGetChild(n, "CTRY")) == NULL || XmlGetText(m) == NULL) // Some bad client use instead of m = XmlGetChild(n, "COUNTRY"); if (m != NULL && XmlGetText(m) != NULL) { hasHomeCtry = true; - setTString(hContact, "Country", XmlGetText(m)); + setWString(hContact, "Country", XmlGetText(m)); } } @@ -881,36 +881,36 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else wcsncpy_s(text, XmlGetText(m), _TRUNCATE); text[_countof(text) - 1] = '\0'; - setTString(hContact, "CompanyStreet", text); + setWString(hContact, "CompanyStreet", text); } else { - setTString(hContact, "CompanyStreet", XmlGetText(m)); + setWString(hContact, "CompanyStreet", XmlGetText(m)); if ((m = XmlGetChild(n, "EXTADR")) == NULL) m = XmlGetChild(n, "EXTADD"); if (m != NULL && XmlGetText(m) != NULL) { hasWorkStreet2 = true; - setTString(hContact, "CompanyStreet2", XmlGetText(m)); + setWString(hContact, "CompanyStreet2", XmlGetText(m)); } } } if ((m = XmlGetChild(n, "LOCALITY")) != NULL && XmlGetText(m) != NULL) { hasWorkLocality = true; - setTString(hContact, "CompanyCity", XmlGetText(m)); + setWString(hContact, "CompanyCity", XmlGetText(m)); } if ((m = XmlGetChild(n, "REGION")) != NULL && XmlGetText(m) != NULL) { hasWorkRegion = true; - setTString(hContact, "CompanyState", XmlGetText(m)); + setWString(hContact, "CompanyState", XmlGetText(m)); } if ((m = XmlGetChild(n, "PCODE")) != NULL && XmlGetText(m) != NULL) { hasWorkPcode = true; - setTString(hContact, "CompanyZIP", XmlGetText(m)); + setWString(hContact, "CompanyZIP", XmlGetText(m)); } if ((m = XmlGetChild(n, "CTRY")) == NULL || XmlGetText(m) == NULL) // Some bad client use instead of m = XmlGetChild(n, "COUNTRY"); if (m != NULL && XmlGetText(m) != NULL) { hasWorkCtry = true; - setTString(hContact, "CompanyCountry", XmlGetText(m)); + setWString(hContact, "CompanyCountry", XmlGetText(m)); } } } @@ -920,11 +920,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (hContact != NULL) { if (!hasFax && XmlGetChild(n, "FAX") != NULL) { hasFax = true; - setTString(hContact, "Fax", XmlGetText(m)); + setWString(hContact, "Fax", XmlGetText(m)); } else if (!hasCell && XmlGetChild(n, "CELL") != NULL) { hasCell = true; - setTString(hContact, "Cellular", XmlGetText(m)); + setWString(hContact, "Cellular", XmlGetText(m)); } else if (!hasPhone && (XmlGetChild(n, "HOME") != NULL || XmlGetChild(n, "WORK") != NULL || XmlGetChild(n, "VOICE") != NULL || @@ -939,13 +939,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) XmlGetChild(n, "PCS") == NULL))) { hasPhone = true; - setTString(hContact, "Phone", XmlGetText(m)); + setWString(hContact, "Phone", XmlGetText(m)); } } else { char text[100]; mir_snprintf(text, "Phone%d", nPhone); - setTString(text, XmlGetText(m)); + setWString(text, XmlGetText(m)); mir_snprintf(text, "PhoneFlag%d", nPhone); int nFlag = 0; @@ -970,39 +970,39 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) // Homepage if (!hasUrl && XmlGetText(n) != NULL) { hasUrl = true; - setTString(hContact, "Homepage", XmlGetText(n)); + setWString(hContact, "Homepage", XmlGetText(n)); } } else if (!mir_wstrcmp(XmlGetName(n), L"ORG")) { if (!hasOrgname && !hasOrgunit) { if ((m = XmlGetChild(n, "ORGNAME")) != NULL && XmlGetText(m) != NULL) { hasOrgname = true; - setTString(hContact, "Company", XmlGetText(m)); + setWString(hContact, "Company", XmlGetText(m)); } if ((m = XmlGetChild(n, "ORGUNIT")) != NULL && XmlGetText(m) != NULL) { // The real vCard can have multiple but we will only display the first one hasOrgunit = true; - setTString(hContact, "CompanyDepartment", XmlGetText(m)); + setWString(hContact, "CompanyDepartment", XmlGetText(m)); } } } else if (!mir_wstrcmp(XmlGetName(n), L"ROLE")) { if (!hasRole && XmlGetText(n) != NULL) { hasRole = true; - setTString(hContact, "Role", XmlGetText(n)); + setWString(hContact, "Role", XmlGetText(n)); } } else if (!mir_wstrcmp(XmlGetName(n), L"TITLE")) { if (!hasTitle && XmlGetText(n) != NULL) { hasTitle = true; - setTString(hContact, "CompanyPosition", XmlGetText(n)); + setWString(hContact, "CompanyPosition", XmlGetText(n)); } } else if (!mir_wstrcmp(XmlGetName(n), L"DESC")) { if (!hasDesc && XmlGetText(n) != NULL) { hasDesc = true; - CMString tszMemo(XmlGetText(n)); + CMStringW tszMemo(XmlGetText(n)); tszMemo.Replace(L"\n", L"\r\n"); - setTString(hContact, "About", tszMemo); + setWString(hContact, "About", tszMemo); } } else if (!mir_wstrcmp(XmlGetName(n), L"PHOTO")) @@ -1011,10 +1011,10 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) } if (hasFn && !hasNick) { - ptrW nick(getTStringA(hContact, "Nick")); + ptrW nick(getWStringA(hContact, "Nick")); ptrW jidNick(JabberNickFromJID(jid)); if (!nick || (jidNick && !mir_wstrcmpi(nick, jidNick))) - setTString(hContact, "Nick", ptrW(getTStringA(hContact, "FullName"))); + setWString(hContact, "Nick", ptrW(getWStringA(hContact, "FullName"))); } if (!hasFn) delSetting(hContact, "FullName"); @@ -1125,7 +1125,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) debugLogA("Has no avatar"); delSetting(hContact, "AvatarHash"); - if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) { + if (ptrW(getWStringA(hContact, "AvatarSaved")) != NULL) { delSetting(hContact, "AvatarSaved"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL); } @@ -1173,7 +1173,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if (!mir_wstrcmp(XmlGetName(itemNode), L"item")) { if ((jid = XmlGetAttrValue(itemNode, L"jid")) != NULL) { psr.id.w = (wchar_t*)jid; - debugLog(L"Result jid = %s", jid); + debugLogW(L"Result jid = %s", jid); if ((n = XmlGetChild(itemNode, "nick")) != NULL && XmlGetText(n) != NULL) psr.nick.w = (wchar_t*)XmlGetText(n); else @@ -1190,7 +1190,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) psr.email.w = (wchar_t*)XmlGetText(n); else psr.email.w = L""; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr); } } @@ -1227,7 +1227,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; for (int j = 0;; j++) { HXML fieldNode = XmlGetChild(itemNode, j); @@ -1247,7 +1247,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (!mir_wstrcmp(fieldName, L"jid")) { psr.id.w = (wchar_t*)XmlGetText(n); - debugLog(L"Result jid = %s", psr.id.w); + debugLogW(L"Result jid = %s", psr.id.w); } else if (!mir_wstrcmp(fieldName, L"nickname")) psr.nick.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L""; @@ -1309,7 +1309,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) if (XmlGetChildCount(vCard) == 0) { delSetting(hContact, "AvatarHash"); - if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) { + if (ptrW(getWStringA(hContact, "AvatarSaved")) != NULL) { delSetting(hContact, "AvatarSaved"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL); } @@ -1420,7 +1420,7 @@ void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t else if (!mir_wstrcmp(mimeType, L"image/bmp")) pictureType = PA_FORMAT_BMP; else { LBL_ErrFormat: - debugLog(L"Invalid mime type specified for picture: %s", mimeType); + debugLogW(L"Invalid mime type specified for picture: %s", mimeType); return; } } @@ -1456,7 +1456,7 @@ LBL_ErrFormat: char buffer[41]; setString(hContact, "AvatarSaved", bin2hex(digest, sizeof(digest), buffer)); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, HANDLE(&ai), NULL); - debugLog(L"Broadcast new avatar: %s", ai.filename); + debugLogW(L"Broadcast new avatar: %s", ai.filename); } else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, HANDLE(&ai), NULL); } @@ -1622,7 +1622,7 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo *pInfo) LPCTSTR szTz = XPathFmt(pIqNode, L"time[@xmlns='%s']/tz", JABBER_FEAT_ENTITY_TIME); if (szTz) - setTString(pInfo->m_hContact, "TzName", szTz); + setWString(pInfo->m_hContact, "TzName", szTz); else delSetting(pInfo->m_hContact, "TzName"); return; diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 1904cb0cf7..afbdfe383b 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -322,7 +322,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w lvi.cchTextMax = _countof(text); ListView_GetItem(nm->hdr.hwndFrom, &lvi); if (lvi.lParam == -1) { - CMString szBuffer(dat->type2str()); + CMStringW szBuffer(dat->type2str()); if (!dat->ppro->EnterString(szBuffer, NULL, ESF_COMBO, "gcAddNick_")) break; @@ -331,7 +331,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w if (szBuffer.IsEmpty()) break; - CMString rsn(dat->type2str()); + CMStringW rsn(dat->type2str()); if (dat->type == MUC_BANLIST) { dat->ppro->EnterString(rsn, TranslateT("Reason to ban"), ESF_COMBO, "gcAddReason_"); if (szBuffer) diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index 1e4c95f77f..1df982ec43 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -91,12 +91,12 @@ void CJabberProto::ListInit(void) { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) { - ptrW jid(getTStringA(hContact, "ChatRoomID")); + ptrW jid(getWStringA(hContact, "ChatRoomID")); if (jid != NULL) ListAdd(LIST_CHATROOM, jid, hContact); } else { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) ListAdd(LIST_ROSTER, jid, hContact); } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 512ec95593..7a91ec5498 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -303,7 +303,7 @@ void g_MenuInit(void) g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi); UNSET_UID(mi); - mi.flags |= CMIF_TCHAR | CMIF_SYSTEM; + mi.flags |= CMIF_UNICODE | CMIF_SYSTEM; mi.root = g_hMenuDirectPresence[0]; for (int i = 0; i < _countof(PresenceModeArray); i++) { char buf[] = "Jabber/DirectPresenceX"; @@ -374,7 +374,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool bIsTransport = getBool(hContact, "IsTransport", false); if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) { - if (ptrW(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) { + if (ptrW(getWStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) { Menu_ShowItem(g_hMenuConvert, TRUE); Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENW("&Convert to Contact") : LPGENW("&Convert to Chat Room")); } @@ -388,7 +388,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ModifyItem(g_hMenuDirectPresence[i + 1], NULL, Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode)); if (bIsChatRoom) { - ptrW roomid(getTStringA(hContact, "ChatRoomID")); + ptrW roomid(getWStringA(hContact, "ChatRoomID")); if (roomid != NULL) { Menu_ShowItem(g_hMenuRosterAdd, FALSE); @@ -406,7 +406,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(g_hMenuRefresh, TRUE); } - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid == NULL) return 0; @@ -441,7 +441,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) mi.flags = CMIF_SYSTEM; mi.pszService = text; - CMString szTmp; + CMStringW szTmp; for (int i = 0; i < nMenuResourceItemsNew; i++) { mir_snprintf(text, "/UseResource_%d", i); if (i >= m_nMenuResourceItems) { @@ -477,10 +477,10 @@ INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM hContact, LPARAM) BYTE bIsChatRoom = isChatRoom(hContact); const char *szSetting = (bIsChatRoom) ? "ChatRoomID" : "jid"; - ptrW jid(getTStringA(hContact, szSetting)); + ptrW jid(getWStringA(hContact, szSetting)); if (jid != NULL) { delSetting(hContact, szSetting); - setTString(hContact, szSetting, jid); + setWString(hContact, szSetting, jid); setByte(hContact, "ChatRoom", !bIsChatRoom); } return 0; @@ -491,13 +491,13 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) if (!hContact) return 0; // we do not add ourself to the roster. (buggy situation - should not happen) - ptrW roomID(getTStringA(hContact, "ChatRoomID")); + ptrW roomID(getWStringA(hContact, "ChatRoomID")); if (roomID == NULL) return 0; if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) { - ptrW group(db_get_tsa(hContact, "CList", "Group")); - ptrW nick(getTStringA(hContact, "Nick")); + ptrW group(db_get_wsa(hContact, "CList", "Group")); + ptrW nick(getWStringA(hContact, "Nick")); AddContactToRoster(roomID, nick, group); if (m_options.AddRoster2Bookmarks == TRUE) { @@ -506,7 +506,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) item = new JABBER_LIST_ITEM(); item->jid = mir_wstrdup(roomID); item->name = mir_wstrdup(nick); - item->nick = getTStringA(hContact, "MyNick"); + item->nick = getWStringA(hContact, "MyNick"); AddEditBookmark(item); delete item; } @@ -518,7 +518,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM hContact, LPARAM) { if (hContact != NULL && m_bJabberOnline) { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"subscribe")); } @@ -528,7 +528,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM hContact, LPARAM) { if (hContact != NULL && m_bJabberOnline) { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"subscribed")); } @@ -538,7 +538,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM hContact, LPARAM) { if (hContact != NULL && m_bJabberOnline) { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"unsubscribed")); } @@ -550,7 +550,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransport", 0)) return 0; - JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid"))); + JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getWStringA(hContact, "jid"))); if (item != NULL) { XmlNode p(L"presence"); XmlAddAttr(p, L"to", item->jid); if (item->getTemp()->m_iStatus == ID_STATUS_ONLINE) @@ -565,7 +565,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransport", 0)) return 0; - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) ResolveTransportNicks(jid); return 0; @@ -576,7 +576,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) if (!hContact) return 0; // we do not add ourself to the roster. (buggy situation - should not happen) - ptrW roomID(getTStringA(hContact, "ChatRoomID")); + ptrW roomID(getWStringA(hContact, "ChatRoomID")); if (roomID == NULL) return 0; @@ -585,7 +585,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) item->jid = mir_wstrdup(roomID); item->name = pcli->pfnGetContactDisplayName(hContact, 0); item->type = L"conference"; - item->nick = getTStringA(hContact, "MyNick"); + item->nick = getWStringA(hContact, "MyNick"); AddEditBookmark(item); delete item; } @@ -706,7 +706,7 @@ void CJabberProto::MenuInit() mi.pszService = srvFce; mi.name.w = szName; mi.position = 2000040000; - mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_UNMOVABLE | CMIF_UNICODE | CMIF_KEEPUNTRANSLATED; mi.root = m_hMenuPriorityRoot; mir_snprintf(srvFce, "/menuSetPriority/%d", 0); @@ -786,7 +786,7 @@ void CJabberProto::GlobalMenuInit() // Account chooser menu CMenuItem mi; - mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_UNMOVABLE | CMIF_UNICODE | CMIF_KEEPUNTRANSLATED; mi.position = iChooserMenuPos++; mi.name.w = m_tszUserName; m_hChooseMenuItem = Menu_AddItem(hChooserMenu, &mi, this); @@ -801,23 +801,23 @@ void CJabberProto::GlobalMenuInit() HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = text; hkd.pszService = text; - hkd.ptszSection = m_tszUserName; - hkd.dwFlags = HKD_TCHAR; + hkd.pwszSection = m_tszUserName; + hkd.dwFlags = HKD_UNICODE; mir_strcpy(tDest, "/Groupchat"); - hkd.ptszDescription = LPGENW("Join conference"); + hkd.pwszDescription = LPGENW("Join conference"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/Bookmarks"); - hkd.ptszDescription = LPGENW("Open bookmarks"); + hkd.pwszDescription = LPGENW("Open bookmarks"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/PrivacyLists"); - hkd.ptszDescription = LPGENW("Privacy lists"); + hkd.pwszDescription = LPGENW("Privacy lists"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/ServiceDiscovery"); - hkd.ptszDescription = LPGENW("Service discovery"); + hkd.pwszDescription = LPGENW("Service discovery"); Hotkey_Register(&hkd); } @@ -941,7 +941,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) hDialogsList = WindowList_Create(); WindowList_Add(hDialogsList, event->hwndWindow, event->hContact); - ptrW jid(getTStringA(event->hContact, "jid")); + ptrW jid(getWStringA(event->hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, jid); if (pItem && m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO) && m_options.EnableMsgArchive) @@ -991,7 +991,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) if (!hContact) return 0; - JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid"))); + JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrW(getWStringA(hContact, "jid"))); if (LI == NULL) return 0; @@ -1041,7 +1041,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM hContact, LPARAM, LPAR if (!m_bJabberOnline || !hContact) return 0; - ptrW tszJid(getTStringA(hContact, "jid")); + ptrW tszJid(getWStringA(hContact, "jid")); if (tszJid == NULL) return 0; @@ -1073,9 +1073,9 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM return 0; wchar_t *jid, text[1024]; - ptrW tszJid(getTStringA(hContact, "jid")); + ptrW tszJid(getWStringA(hContact, "jid")); if (tszJid == NULL) { - ptrW roomid(getTStringA(hContact, "ChatRoomID")); + ptrW roomid(getWStringA(hContact, "ChatRoomID")); if (roomid == NULL) return 0; @@ -1088,7 +1088,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM } else jid = tszJid; - CMString szValue; + CMStringW szValue; if (EnterString(szValue, TranslateT("Status Message"), ESF_MULTILINE)) SendPresenceTo(res, jid, NULL, szValue); return 0; diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index 99b853bca9..e443c6ce73 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -100,7 +100,7 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea messageInfo.m_hContact = ppro->HContactFromJID(messageInfo.m_szFrom); if (messageInfo.m_szFrom) - ppro->debugLog(L"Handling message from %s", messageInfo.m_szFrom); + ppro->debugLogW(L"Handling message from %s", messageInfo.m_szFrom); if ((ppro->*(pInfo.m_pHandler))(node, pThreadData, &messageInfo)) return true; } diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index ac90da7561..0a4600cecb 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -103,9 +103,9 @@ MCONTACT CJabberProto::DBCreateContact(const wchar_t *jid, const wchar_t *nick, MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); Proto_AddToContact(hNewContact, m_szModuleName); - setTString(hNewContact, "jid", szJid); + setWString(hNewContact, "jid", szJid); if (nick != NULL && *nick != '\0') - setTString(hNewContact, "Nick", nick); + setWString(hNewContact, "Nick", nick); if (temporary) db_set_b(hNewContact, "CList", "NotOnList", 1); else @@ -114,7 +114,7 @@ MCONTACT CJabberProto::DBCreateContact(const wchar_t *jid, const wchar_t *nick, if (JABBER_LIST_ITEM *pItem = ListAdd(LIST_ROSTER, jid, hNewContact)) pItem->bUseResource = wcschr(szJid, '/') != 0; - debugLog(L"Create Jabber contact jid=%s, nick=%s", szJid, nick); + debugLogW(L"Create Jabber contact jid=%s, nick=%s", szJid, nick); DBCheckIsTransportedContact(szJid, hNewContact); return hNewContact; } @@ -156,11 +156,11 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CreateDirectoryTreeT(pszDest); + CreateDirectoryTreeW(pszDest); pszDest[tPathLen++] = '\\'; @@ -203,8 +203,8 @@ void CJabberProto::ResolveTransportNicks(const wchar_t *jid) if (!getByte(hContact, "IsTransported", 0)) continue; - ptrW dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue; - ptrW dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue; + ptrW dbJid(getWStringA(hContact, "jid")); if (dbJid == NULL) continue; + ptrW dbNick(getWStringA(hContact, "Nick")); if (dbNick == NULL) continue; wchar_t *p = wcschr(dbJid, '@'); if (p == NULL) @@ -300,7 +300,7 @@ void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item) if (!hContact) return; - debugLog(L"JabberUpdateMirVer: for jid %s", item->jid); + debugLogW(L"JabberUpdateMirVer: for jid %s", item->jid); pResourceStatus p(NULL); if (item->resourceMode == RSMODE_LASTSEEN) @@ -312,7 +312,7 @@ void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item) UpdateMirVer(hContact, p); } -void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) +void CJabberProto::FormatMirVer(pResourceStatus &resource, CMStringW &res) { res.Empty(); if (resource == NULL) @@ -320,7 +320,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) // jabber:iq:version info requested and exists? if (resource->m_dwVersionRequestTime && resource->m_tszSoftware) { - debugLog(L"JabberUpdateMirVer: for iq:version rc %s: %s", resource->m_tszResourceName, resource->m_tszSoftware); + debugLogW(L"JabberUpdateMirVer: for iq:version rc %s: %s", resource->m_tszResourceName, resource->m_tszSoftware); if (!resource->m_tszSoftwareVersion || wcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion)) res = resource->m_tszSoftware; else @@ -328,13 +328,13 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) } // no version info and no caps info? set MirVer = resource name else if (!resource->m_tszCapsNode || !resource->m_tszCapsVer) { - debugLog(L"JabberUpdateMirVer: for rc %s: %s", resource->m_tszResourceName, resource->m_tszResourceName); + debugLogW(L"JabberUpdateMirVer: for rc %s: %s", resource->m_tszResourceName, resource->m_tszResourceName); if (resource->m_tszResourceName) res = resource->m_tszResourceName; } // XEP-0115 caps mode else { - debugLog(L"JabberUpdateMirVer: for rc %s: %s#%s", resource->m_tszResourceName, resource->m_tszCapsNode, resource->m_tszCapsVer); + debugLogW(L"JabberUpdateMirVer: for rc %s: %s#%s", resource->m_tszResourceName, resource->m_tszCapsNode, resource->m_tszCapsVer); int i; @@ -374,12 +374,12 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) { - CMString tszMirVer; + CMStringW tszMirVer; FormatMirVer(resource, tszMirVer); if (!tszMirVer.IsEmpty()) - setTString(hContact, "MirVer", tszMirVer); + setWString(hContact, "MirVer", tszMirVer); - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid == NULL) return; @@ -388,32 +388,32 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) mir_snwprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName); else mir_wstrncpy(szFullJid, jid, _countof(szFullJid)); - setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid); + setWString(hContact, DBSETTING_DISPLAY_UID, szFullJid); } void CJabberProto::UpdateSubscriptionInfo(MCONTACT hContact, JABBER_LIST_ITEM *item) { switch (item->subscription) { case SUB_TO: - setTString(hContact, "SubscriptionText", TranslateT("To")); + setWString(hContact, "SubscriptionText", TranslateT("To")); setString(hContact, "Subscription", "to"); setByte(hContact, "Auth", 0); setByte(hContact, "Grant", 1); break; case SUB_FROM: - setTString(hContact, "SubscriptionText", TranslateT("From")); + setWString(hContact, "SubscriptionText", TranslateT("From")); setString(hContact, "Subscription", "from"); setByte(hContact, "Auth", 1); setByte(hContact, "Grant", 0); break; case SUB_BOTH: - setTString(hContact, "SubscriptionText", TranslateT("Both")); + setWString(hContact, "SubscriptionText", TranslateT("Both")); setString(hContact, "Subscription", "both"); setByte(hContact, "Auth", 0); setByte(hContact, "Grant", 0); break; case SUB_NONE: - setTString(hContact, "SubscriptionText", TranslateT("None")); + setWString(hContact, "SubscriptionText", TranslateT("None")); setString(hContact, "Subscription", "none"); setByte(hContact, "Auth", 1); setByte(hContact, "Grant", 1); @@ -445,7 +445,7 @@ void CJabberProto::InitPopups(void) POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = LoadIconEx("main"); ppc.colorBack = RGB(191, 0, 0); //Red @@ -476,25 +476,25 @@ void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar } } -CMString CJabberProto::ExtractImage(HXML node) +CMStringW CJabberProto::ExtractImage(HXML node) { HXML nHtml, nBody, nImg; LPCTSTR src; - CMString link; + CMStringW link; if ((nHtml = XmlGetChild(node, "html")) != NULL && (nBody = XmlGetChild(nHtml, "body")) != NULL && (nImg = XmlGetChild(nBody, "img")) != NULL && (src = XmlGetAttrValue(nImg, L"src")) != NULL) { - CMString strSrc(src); + CMStringW strSrc(src); if (strSrc.Left(11).Compare(L"data:image/") == 0) { int end = strSrc.Find(L';'); if (end != -1) { - CMString ext(strSrc.c_str() + 11, end - 11); + CMStringW ext(strSrc.c_str() + 11, end - 11); int comma = strSrc.Find(L',', end); if (comma != -1) { - CMString image(strSrc.c_str() + comma + 1, strSrc.GetLength() - comma - 1); + CMStringW image(strSrc.c_str() + comma + 1, strSrc.GetLength() - comma - 1); image.Replace(L"%2B", L"+"); image.Replace(L"%2F", L"/"); image.Replace(L"%3D", L"="); diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 66f16d6f1a..36f780f87e 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -240,7 +240,7 @@ void CJabberDlgNoteItem::OnInitDialog() Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_NOTES)); if (m_fnProcess) { - CMString buf; + CMStringW buf; if (m_fnProcess == &CJabberProto::ProcessIncomingNote) buf.Format(TranslateT("Incoming note from %s"), m_pNote->GetFrom()); else @@ -815,7 +815,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleNotes(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM wParam, LPARAM) { if (wParam) { - CNoteItem *pItem = new CNoteItem(NULL, ptrW(getTStringA(wParam, "jid"))); + CNoteItem *pItem = new CNoteItem(NULL, ptrW(getWStringA(wParam, "jid"))); CJabberDlgBase *pDlg = new CJabberDlgNoteItem(this, pItem, &CJabberProto::ProcessOutgoingNote); pDlg->Show(); } diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 66fb8e5e49..c1a9ab062b 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -331,7 +331,7 @@ CCtrlEditJid::CCtrlEditJid(CDlgBase* dlg, int ctrlId): static void sttStoreJidFromUI(CJabberProto *ppro, CCtrlEdit &txtUsername, CCtrlCombo &cbServer) { - ppro->setTString("jid", CMString(FORMAT, L"%s@%s", ptrW(txtUsername.GetText()), ptrW(cbServer.GetText()))); + ppro->setWString("jid", CMStringW(FORMAT, L"%s@%s", ptrW(txtUsername.GetText()), ptrW(cbServer.GetText()))); } class CDlgOptAccount : public CJabberDlgBase @@ -425,7 +425,7 @@ protected: SendDlgItemMessage(m_hwnd, IDC_PRIORITY_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(127, -128)); - wchar_t *passw = m_proto->getTStringA(NULL, "Password"); + wchar_t *passw = m_proto->getWStringA(NULL, "Password"); if (passw) { m_txtPassword.SetText(passw); mir_free(passw); @@ -444,7 +444,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength)) m_cbResource.AddString(szCompName); - ptrW tszResource(m_proto->getTStringA("Resource")); + ptrW tszResource(m_proto->getWStringA("Resource")); if (tszResource != NULL) { if (CB_ERR == m_cbResource.FindString(tszResource, -1, true)) m_cbResource.AddString(tszResource); @@ -453,7 +453,7 @@ protected: else m_cbResource.SetText(L"Miranda"); for (int i = 0; g_LanguageCodes[i].szCode; i++) { - int iItem = m_cbLocale.AddString(TranslateTS(g_LanguageCodes[i].szDescription), (LPARAM)g_LanguageCodes[i].szCode); + int iItem = m_cbLocale.AddString(TranslateW(g_LanguageCodes[i].szDescription), (LPARAM)g_LanguageCodes[i].szCode); if (!mir_wstrcmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode)) m_cbLocale.SetCurSel(iItem); } @@ -483,7 +483,7 @@ protected: m_proto->m_savedPassword = NULL; if (m_chkSavePassword.GetState() == BST_CHECKED) - m_proto->setTString("Password", ptrW(m_txtPassword.GetText())); + m_proto->setWString("Password", ptrW(m_txtPassword.GetText())); else m_proto->delSetting("Password"); @@ -491,7 +491,7 @@ protected: if (index >= 0) { wchar_t *szLanguageCode = (wchar_t *)m_cbLocale.GetItemData(index); if (szLanguageCode) { - m_proto->setTString("XmlLang", szLanguageCode); + m_proto->setWString("XmlLang", szLanguageCode); mir_free(m_proto->m_tszSelectedLang); m_proto->m_tszSelectedLang = mir_wstrdup(szLanguageCode); @@ -897,8 +897,8 @@ public: m_otvOptions(this, IDC_OPTTREE) { CreateLink(m_txtAltNick, "GcAltNick", L""); - CreateLink(m_txtSlap, "GcMsgSlap", TranslateTS(JABBER_GC_MSG_SLAP)); - CreateLink(m_txtQuit, "GcMsgQuit", TranslateTS(JABBER_GC_MSG_QUIT)); + CreateLink(m_txtSlap, "GcMsgSlap", TranslateW(JABBER_GC_MSG_SLAP)); + CreateLink(m_txtQuit, "GcMsgQuit", TranslateW(JABBER_GC_MSG_QUIT)); m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Autoaccept multiuser chat invitations"), m_proto->m_options.AutoAcceptMUC); m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join bookmarks on login"), m_proto->m_options.AutoJoinBookmarks); @@ -952,7 +952,7 @@ static int _RosterInsertListItem(HWND hList, const wchar_t * jid, const wchar_t ListView_SetItemText(hList, index, 0, (wchar_t*)jid); ListView_SetItemText(hList, index, 1, (wchar_t*)nick); ListView_SetItemText(hList, index, 2, (wchar_t*)group); - ListView_SetItemText(hList, index, 3, TranslateTS(subscr)); + ListView_SetItemText(hList, index, 3, TranslateW(subscr)); return index; } @@ -1016,7 +1016,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) // now it is require to process whole contact list to add not in roster contacts for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - ptrW tszJid(getTStringA(hContact, "jid")); + ptrW tszJid(getWStringA(hContact, "jid")); if (tszJid == NULL) continue; @@ -1029,8 +1029,8 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) if (p) *p = 0; } if (ListView_FindItem(hList, -1, &lvfi) == -1) { - ptrW tszName(db_get_tsa(hContact, "CList", "MyHandle")); - ptrW tszGroup(db_get_tsa(hContact, "CList", "Group")); + ptrW tszName(db_get_wsa(hContact, "CList", "MyHandle")); + ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); _RosterInsertListItem(hList, tszJid, tszName, tszGroup, NULL, FALSE); } } @@ -1492,7 +1492,7 @@ int CJabberProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.pwszGroup = LPGENW("Network"); odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszTab = LPGENW("Account"); odp.pDialog = new CDlgOptAccount(this); @@ -1569,7 +1569,7 @@ protected: m_gotservers = false; - wchar_t *passw = m_proto->getTStringA(NULL, "Password"); + wchar_t *passw = m_proto->getWStringA(NULL, "Password"); if (passw) { m_txtPassword.SetText(passw); mir_free(passw); @@ -1588,7 +1588,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength)) m_cbResource.AddString(szCompName); - ptrW tszResource(m_proto->getTStringA("Resource")); + ptrW tszResource(m_proto->getWStringA("Resource")); if (tszResource != NULL) { if (CB_ERR == m_cbResource.FindString(tszResource, -1, true)) m_cbResource.AddString(tszResource); @@ -1666,7 +1666,7 @@ protected: m_txtManualHost.Enable(); m_txtPort.Enable(); - ptrW dbManualHost(m_proto->getTStringA("ManualHost")); + ptrW dbManualHost(m_proto->getWStringA("ManualHost")); if (dbManualHost != NULL) m_txtManualHost.SetText(dbManualHost); @@ -1715,7 +1715,7 @@ protected: if (m_chkSavePassword.GetState() == BST_CHECKED) { wchar_t *text = m_txtPassword.GetText(); - m_proto->setTString("Password", text); + m_proto->setWString("Password", text); mir_free(text); } else m_proto->delSetting("Password"); diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 8e9e009d1d..545c1cc81a 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -183,7 +183,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo if (type == NULL) return; - CMString szText; + CMStringW szText; if (!mir_wstrcmp(type, L"result")) { mir_cslock lck(m_privacyListManager.m_cs); @@ -370,7 +370,7 @@ public: wchar_t *szTypes[] = { L"JID", L"Group", L"Subscription", L"Any" }; int i, nTypes[] = { Jid, Group, Subscription, Else }; for (i=0; i < _countof(szTypes); i++) { - LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTypes[i])); + LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(szTypes[i])); SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_SETITEMDATA, nItem, nTypes[i]); if (m_pRule->GetType() == nTypes[i]) SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_SETCURSEL, nItem, 0); @@ -379,7 +379,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0); wchar_t *szSubscriptions[] = { L"none", L"from", L"to", L"both" }; for (i=0; i < _countof(szSubscriptions); i++) { - LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i])); + LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateW(szSubscriptions[i])); SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]); } @@ -423,7 +423,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0); { for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { - ptrW jid( m_proto->getTStringA(hContact, "jid")); + ptrW jid( m_proto->getWStringA(hContact, "jid")); if (jid != NULL) SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, jid); } @@ -471,7 +471,7 @@ public: ShowWindow(GetDlgItem(m_hwnd, IDC_COMBO_VALUE), SW_SHOW); if (m_pRule->GetValue()) { - LRESULT nSelected = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SELECTSTRING, -1, (LPARAM)TranslateTS(m_pRule->GetValue())); + LRESULT nSelected = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SELECTSTRING, -1, (LPARAM)TranslateW(m_pRule->GetValue())); if (nSelected == CB_ERR) SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETCURSEL, 0, 0); } @@ -948,7 +948,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) int i, totalWidth = -5; // spacing for last item for (i=0; i < _countof(drawItems); i++) { SIZE sz = {0}; - drawItems[i].text = TranslateTS(drawItems[i].textEng); + drawItems[i].text = TranslateW(drawItems[i].textEng); GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_wstrlen(drawItems[i].text), &sz); totalWidth += sz.cx + 18 + 5; // 18 pixels for icon, 5 pixel spacing } @@ -1462,9 +1462,9 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { hItem = m_clcClist.FindContact(hContact); - ptrW jid( m_proto->getTStringA(hContact, "jid")); + ptrW jid( m_proto->getWStringA(hContact, "jid")); if (jid == NULL) - if ((jid = m_proto->getTStringA(hContact, "ChatRoomID")) == NULL) + if ((jid = m_proto->getWStringA(hContact, "ChatRoomID")) == NULL) continue; if (dwPackets = CListGetPackets(hwndList, hItem, true)) @@ -1663,7 +1663,7 @@ void CJabberDlgPrivacyLists::btnActivate_OnClick(CCtrlButton *) active << XATTR(L"name", pList->GetListName()); lck.unlock(); - SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG)); + SetStatusText(TranslateW(JABBER_PL_BUSY_MSG)); m_proto->m_ThreadInfo->send(iq); } @@ -1690,7 +1690,7 @@ void CJabberDlgPrivacyLists::btnSetDefault_OnClick(CCtrlButton *) XmlAddAttr(defaultTag, L"name", pList->GetListName()); lck.unlock(); - SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG)); + SetStatusText(TranslateW(JABBER_PL_BUSY_MSG)); m_proto->m_ThreadInfo->send(iq); } @@ -1958,7 +1958,7 @@ void CJabberDlgPrivacyLists::btnApply_OnClick(CCtrlButton *) pList = pList->GetNext(); } } - SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG)); + SetStatusText(TranslateW(JABBER_PL_BUSY_MSG)); PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); } @@ -2101,7 +2101,7 @@ void CJabberProto::BuildPrivacyMenu() mi.pszService = "/PrivacyLists"; CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandlePrivacyLists); mi.position = 3000040000; - mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR; + mi.flags = CMIF_UNMOVABLE | CMIF_UNICODE; mi.hIcolibItem = GetIconHandle(IDI_PRIVACY_LISTS); mi.name.w = LPGENW("List Editor..."); mi.root = m_hPrivacyMenuRoot; @@ -2122,7 +2122,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) CMenuItem mi; mi.position = 2000040000; - mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR; + mi.flags = CMIF_UNMOVABLE | CMIF_UNICODE; mi.root = m_hPrivacyMenuRoot; mi.pszService = srvFce; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 198a8231d0..f66f63f151 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -146,7 +146,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : db_set_resident(m_szModuleName, "Auth"); db_set_resident(m_szModuleName, "Grant"); - if ((m_tszSelectedLang = getTStringA("XmlLang")) == NULL) + if ((m_tszSelectedLang = getWStringA("XmlLang")) == NULL) m_tszSelectedLang = mir_wstrdup(L"en"); } @@ -242,7 +242,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) SetContactOfflineStatus(hContact); if (getByte(hContact, "IsTransport", 0)) { - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid == NULL) continue; @@ -297,7 +297,7 @@ int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM) MCONTACT CJabberProto::AddToListByJID(const wchar_t *newJid, DWORD flags) { - debugLog(L"AddToListByJID jid = %s", newJid); + debugLogW(L"AddToListByJID jid = %s", newJid); MCONTACT hContact = DBCreateContact(newJid, NULL, true, false); if (flags & PALF_TEMPORARY) @@ -371,7 +371,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) char *lastName = firstName + mir_strlen(firstName) + 1; char *jid = lastName + mir_strlen(lastName) + 1; - debugLog(L"Send 'authorization allowed' to %s", jid); + debugLogW(L"Send 'authorization allowed' to %s", jid); wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(jid); @@ -382,7 +382,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) JABBER_LIST_ITEM *item; if ((item = ListGetItemPtr(LIST_ROSTER, newJid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) { - debugLog(L"Try adding contact automatically jid = %s", jid); + debugLogW(L"Try adding contact automatically jid = %s", jid); if (MCONTACT hContact = AddToListByJID(newJid, 0)) { // Trigger actual add by removing the "NotOnList" added by AddToListByJID() // See AddToListByJID() and JabberDbSettingChanged(). @@ -659,7 +659,7 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = jsb->jid; psr.firstName.w = L""; psr.lastName.w = L""; @@ -672,7 +672,7 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) { - debugLog(L"JabberBasicSearch called with lParam = '%s'", szJid); + debugLogW(L"JabberBasicSearch called with lParam = '%s'", szJid); JABBER_SEARCH_BASIC *jsb; if (!m_bJabberOnline || (jsb = (JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL) @@ -687,7 +687,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) numericjid = (*i >= '0') && (*i <= '9'); mir_free(szServer); - szServer = getTStringA(NULL, "LoginServer"); + szServer = getWStringA(NULL, "LoginServer"); if (szServer == NULL) szServer = mir_wstrdup(L"jabber.org"); else if (numericjid && !mir_wstrcmpi(szServer, L"S.ms")) { @@ -701,7 +701,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) } else wcsncpy_s(jsb->jid, szJid, _TRUNCATE); - debugLog(L"Adding '%s' without validation", jsb->jid); + debugLogW(L"Adding '%s' without validation", jsb->jid); jsb->hSearch = SerialNext(); ForkThread((MyThreadFunc)&CJabberProto::BasicSearchThread, jsb); return (HANDLE)jsb->hSearch; @@ -802,7 +802,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC HXML x = m << XCHILDNS(L"x", JABBER_FEAT_ROSTER_EXCHANGE); for (int i = 0; i < nContacts; i++) { - ptrW jid(getTStringA(hContactsList[i], "jid")); + ptrW jid(getWStringA(hContactsList[i], "jid")); if (jid != NULL) x << XCHILD(L"item") << XATTR(L"action", L"add") << XATTR(L"jid", jid); } @@ -822,7 +822,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0; - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid == NULL) return 0; @@ -873,7 +873,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri int i, j; for (i = j = 0; i < ft->std.totalFiles; i++) { if (_wstat64(ppszFiles[i], &statbuf)) - debugLog(L"'%s' is an invalid filename", ppszFiles[i]); + debugLogW(L"'%s' is an invalid filename", ppszFiles[i]); else { ft->std.ptszFiles[j] = mir_wstrdup(ppszFiles[i]); ft->fileSize[j] = statbuf.st_size; @@ -1031,7 +1031,7 @@ int __cdecl CJabberProto::SetApparentMode(MCONTACT hContact, int mode) if (!m_bJabberOnline) return 0; - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid == NULL) return 0; @@ -1103,7 +1103,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) MCONTACT hContact = (DWORD_PTR)param; - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid); if (item != NULL) { @@ -1162,7 +1162,7 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(MCONTACT hContact) int __cdecl CJabberProto::SetAwayMsg(int status, const wchar_t *msg) { - debugLog(L"SetAwayMsg called, wParam=%d lParam=%s", status, msg); + debugLogW(L"SetAwayMsg called, wParam=%d lParam=%s", status, msg); wchar_t **szMsg; mir_cslockfull lck(m_csModeMsgMutex); diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index f0e36b64ff..dbdc84bab3 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -582,14 +582,14 @@ struct CJabberProto : public PROTO, public IJabberInterface void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen); void ResolveTransportNicks(const wchar_t *jid); void SetServerStatus(int iNewStatus); - void FormatMirVer(pResourceStatus &resource, CMString&); + void FormatMirVer(pResourceStatus &resource, CMStringW&); void UpdateMirVer(JABBER_LIST_ITEM *item); void UpdateMirVer(MCONTACT hContact, pResourceStatus &resource); void UpdateSubscriptionInfo(MCONTACT hContact, JABBER_LIST_ITEM *item); void SetContactOfflineStatus(MCONTACT hContact); void InitPopups(void); void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle); - CMString ExtractImage(HXML node); + CMStringW ExtractImage(HXML node); //---- jabber_opt.cpp ---------------------------------------------------------------- INT_PTR __cdecl OnMenuHandleRosterControl(WPARAM wParam, LPARAM lParam); @@ -746,7 +746,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount=JABBER_DEFAULT_RECENT_COUNT); void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT); - BOOL EnterString(CMString &result, LPCTSTR caption, int type, char *windowName=NULL, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0); + BOOL EnterString(CMStringW &result, LPCTSTR caption, int type, char *windowName=NULL, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0); bool IsMyOwnJID(LPCTSTR szJID); void __cdecl LoadHttpAvatars(void* param); diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 6cfb672dd0..7255b5cc63 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -322,7 +322,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Change global status")) << XATTR(L"type", L"boolean") << XATTR(L"var", L"status-global"); - ptrW tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0)); + ptrW tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, 0)); if (tszStatusMsg) fieldNode << XCHILD(L"value", tszStatusMsg); @@ -375,7 +375,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc int nNoDlg = db_get_b(NULL, "SRAway", StatusModeToDbSetting(status, "NoDlg"), 0); db_set_b(NULL, "SRAway", StatusModeToDbSetting(status, "NoDlg"), 1); - db_set_ts(NULL, "SRAway", StatusModeToDbSetting(status, "Msg"), szStatusMessage ? szStatusMessage : L""); + db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status, "Msg"), szStatusMessage ? szStatusMessage : L""); fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-global"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) { @@ -465,7 +465,7 @@ int CJabberProto::RcGetUnreadEventsCount() { int nEventsSent = 0; for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - ptrW jid( getTStringA(hContact, "jid")); + ptrW jid( getWStringA(hContact, "jid")); if (jid == NULL) continue; for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { @@ -477,7 +477,7 @@ int CJabberProto::RcGetUnreadEventsCount() dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1); int nGetTextResult = db_event_get(hDbEvent, &dbei); if (!nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) { - wchar_t *szEventText = DbGetEventTextT(&dbei, CP_ACP); + wchar_t *szEventText = DbGetEventTextW(&dbei, CP_ACP); if (szEventText) { nEventsSent++; mir_free(szEventText); @@ -551,7 +551,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe int nEventsSent = 0; for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - ptrW tszJid( getTStringA(hContact, "jid")); + ptrW tszJid( getWStringA(hContact, "jid")); if (tszJid == NULL) continue; @@ -569,7 +569,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (dbei.eventType != EVENTTYPE_MESSAGE || (dbei.flags & (DBEF_READ | DBEF_SENT))) continue; - ptrW szEventText( DbGetEventTextT(&dbei, CP_ACP)); + ptrW szEventText( DbGetEventTextW(&dbei, CP_ACP)); if (szEventText == NULL) continue; diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index fd4a6664d9..cd85c98039 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -42,7 +42,7 @@ typedef int (CJabberProto::*JABBER_ADHOC_HANDLER)(HXML iqNode, CJabberIqInfo *pI class CJabberAdhocSession { protected: - CMString m_szSessionId; + CMStringW m_szSessionId; CJabberAdhocSession* m_pNext; DWORD m_dwStartTime; diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 69f3c6f3ee..2e950a0b26 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -105,7 +105,7 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) int Order = (FieldDat->bHidden) ? -1 : FieldDat->Order; - HWND hwndLabel = CreateWindowEx(0, L"STATIC", (LPCTSTR)TranslateTS(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, NULL, hInst, 0); + HWND hwndLabel = CreateWindowEx(0, L"STATIC", (LPCTSTR)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, NULL, hInst, 0); HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (LPCTSTR)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, NULL, hInst, 0); SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont, 0); SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont, 0); @@ -161,7 +161,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) break; if (!mir_wstrcmpi(XmlGetName(chNode), L"instructions") && XmlGetText(chNode)) - SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateTS(XmlGetText(chNode))); + SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateW(XmlGetText(chNode))); else if (XmlGetName(chNode)) { Data *MyData = (Data*)malloc(sizeof(Data)); memset(MyData, 0, sizeof(Data)); @@ -278,7 +278,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M nick = buff; } Results.psr.nick.w = nick; - Results.psr.flags = PSR_TCHAR; + Results.psr.flags = PSR_UNICODE; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results); Results.psr.nick.w = NULL; @@ -494,16 +494,16 @@ void CJabberProto::SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLast for (int i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); - ptrW szValue(getTStringA(key)); + ptrW szValue(getWStringA(key)); if (szValue == NULL || mir_wstrcmpi(szAddr, szValue)) continue; for (int j = i; j < 10; j++) { mir_snprintf(key, "RecentlySearched_%d", j + 1); - szValue = getTStringA(key); + szValue = getWStringA(key); if (szValue != NULL) { mir_snprintf(key, "RecentlySearched_%d", j); - setTString(NULL, key, szValue); + setWString(NULL, key, szValue); } else { if (deleteLastFromDB) { @@ -524,15 +524,15 @@ void CJabberProto::SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog) for (int j = 9; j > 0; j--) { mir_snprintf(key, "RecentlySearched_%d", j - 1); - ptrW szValue(getTStringA(key)); + ptrW szValue(getWStringA(key)); if (szValue != NULL) { mir_snprintf(key, "RecentlySearched_%d", j); - setTString(NULL, key, szValue); + setWString(NULL, key, szValue); } } mir_snprintf(key, "RecentlySearched_%d", 0); - setTString(key, szAddr); + setWString(key, szAddr); if (hwndDialog) JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr); } @@ -564,7 +564,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR for (i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); - ptrW szValue(dat->ppro->getTStringA(key)); + ptrW szValue(dat->ppro->getWStringA(key)); if (szValue != NULL) JabberSearchAddUrlToRecentCombo(hwndDlg, szValue); } @@ -714,7 +714,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent) { if (parent && hInst) { - ptrW szServer(getTStringA("LoginServer")); + ptrW szServer(getWStringA("LoginServer")); if (szServer == NULL || mir_wstrcmpi(szServer, L"S.ms")) return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this); } diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 9d5553db8f..29b2cef6b5 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -144,7 +144,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) } if ((wParam & GAIF_FORCE) != 0 && pai->hContact != NULL && m_bJabberOnline) { - ptrW tszJid( getTStringA(pai->hContact, "jid")); + ptrW tszJid( getWStringA(pai->hContact, "jid")); if (tszJid != NULL) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, tszJid); if (item != NULL) { @@ -158,7 +158,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (szJid[0] == 0) wcsncpy_s(szJid, tszJid, _TRUNCATE); - debugLog(L"Rereading %s for %s", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid); + debugLogW(L"Rereading %s for %s", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid); m_ThreadInfo->send((isXVcard) ? XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetVCardAvatar, JABBER_IQ_TYPE_GET, szJid)) << XCHILDNS(L"vCard", JABBER_FEAT_VCARD_TEMP) : @@ -319,7 +319,7 @@ INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam) { wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_wstrdup((WCHAR*)lParam) : mir_a2u((char*)lParam); - setTString("Nick", nickname); + setWString("Nick", nickname); SetServerVcard(FALSE, L""); return 0; } @@ -338,15 +338,15 @@ INT_PTR __cdecl CJabberProto::ServiceSendXML(WPARAM, LPARAM lParam) static const wchar_t *JabberEnum2AffilationStr[] = { LPGENW("None"), LPGENW("Outcast"), LPGENW("Member"), LPGENW("Admin"), LPGENW("Owner") }, *JabberEnum2RoleStr[] = { LPGENW("None"), LPGENW("Visitor"), LPGENW("Participant"), LPGENW("Moderator") }; -static void appendString(bool bIsTipper, const wchar_t *tszTitle, const wchar_t *tszValue, CMString &out) +static void appendString(bool bIsTipper, const wchar_t *tszTitle, const wchar_t *tszValue, CMStringW &out) { if (!out.IsEmpty()) out.Append(bIsTipper ? L"\n" : L"\r\n"); if (bIsTipper) - out.AppendFormat(L"%s\t%s", TranslateTS(tszTitle), tszValue); + out.AppendFormat(L"%s\t%s", TranslateW(tszTitle), tszValue); else { - wchar_t *p = TranslateTS(tszTitle); + wchar_t *p = TranslateW(tszTitle); out.AppendFormat(L"%s%s\t%s", p, mir_wstrlen(p) <= 7 ? L"\t" : L"", tszValue); } } @@ -374,7 +374,7 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara bool bIsTipper = db_get_b(NULL, "Tab_SRMsg", "adv_TipperTooltip", 0) && ServiceExists("mToolTip/HideTip"); //JID: - CMString outBuf; + CMStringW outBuf; if (wcschr(info->m_tszResourceName, '@') != NULL) appendString(bIsTipper, LPGENW("JID:"), info->m_tszResourceName, outBuf); else if (lParam) //or simple nick @@ -389,10 +389,10 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara appendString(bIsTipper, LPGENW("Status message:"), info->m_tszStatusMessage, outBuf); // Role - appendString(bIsTipper, LPGENW("Role:"), TranslateTS(JabberEnum2RoleStr[info->m_role]), outBuf); + appendString(bIsTipper, LPGENW("Role:"), TranslateW(JabberEnum2RoleStr[info->m_role]), outBuf); // Affiliation - appendString(bIsTipper, LPGENW("Affiliation:"), TranslateTS(JabberEnum2AffilationStr[info->m_affiliation]), outBuf); + appendString(bIsTipper, LPGENW("Affiliation:"), TranslateW(JabberEnum2AffilationStr[info->m_affiliation]), outBuf); // real jid if (info->m_tszRealJid) @@ -465,7 +465,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) if (!HContactFromJID(szJid)) { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = szJid; psr.id.w = szJid; @@ -525,7 +525,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) if (!m_bJabberOnline) return 0; - ptrW jid( getTStringA(hContact, "jid")); + ptrW jid( getWStringA(hContact, "jid")); if (jid == NULL) return 0; diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index bc3486fdf5..407def3d3d 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -97,7 +97,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa BOOL savePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVE_PERM); param->pro->setByte("SavePassword", savePassword); if (savePassword) { - param->pro->setTString("Password", param->onlinePassword); + param->pro->setWString("Password", param->onlinePassword); param->saveOnlinePassword = TRUE; } } @@ -245,13 +245,13 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) m_ThreadInfo = &info; - if ((tszValue = getTStringA("LoginName")) != NULL) + if ((tszValue = getWStringA("LoginName")) != NULL) wcsncpy_s(info.conn.username, tszValue, _TRUNCATE); if (*rtrimw(info.conn.username) == '\0') { DWORD dwSize = _countof(info.conn.username); if (GetUserName(info.conn.username, &dwSize)) - setTString("LoginName", info.conn.username); + setWString("LoginName", info.conn.username); else info.conn.username[0] = 0; } @@ -282,7 +282,7 @@ LBL_FatalError: mir_wstrcpy(info.resource, L"Miranda"); } else { - if ((tszValue = getTStringA("Resource")) != NULL) + if ((tszValue = getWStringA("Resource")) != NULL) wcsncpy_s(info.resource, tszValue, _TRUNCATE); else mir_wstrcpy(info.resource, L"Miranda"); @@ -319,7 +319,7 @@ LBL_FatalError: } } else { - ptrW tszPassw(getTStringA(NULL, "Password")); + ptrW tszPassw(getWStringA(NULL, "Password")); if (tszPassw == NULL) { JLoginFailed(LOGINERR_BADUSERID); debugLogA("Thread ended, password is not configured"); @@ -394,7 +394,7 @@ LBL_FatalError: m_szJabberJID = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1)); mir_snwprintf(m_szJabberJID, len + 1, L"%s@%S", info.conn.username, info.conn.server); m_bSendKeepAlive = m_options.KeepAlive != 0; - setTString("jid", m_szJabberJID); // store jid in database + setWString("jid", m_szJabberJID); // store jid in database ListInit(); } @@ -830,13 +830,13 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData *info) } debugLogA("Success: Logged-in."); - ptrW tszNick(getTStringA("Nick")); + ptrW tszNick(getWStringA("Nick")); if (tszNick == NULL) - setTString("Nick", info->conn.username); + setWString("Nick", info->conn.username); xmlStreamInitialize("after successful sasl"); } - else debugLog(L"Success: unknown action %s.", type); + else debugLogW(L"Success: unknown action %s.", type); } void CJabberProto::OnProcessChallenge(HXML node, ThreadData *info) @@ -1321,7 +1321,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (!mir_wstrcmp(action, L"add")) { MCONTACT cc = DBCreateContact(jid, nick, false, false); if (group) - db_set_ts(cc, "CList", "Group", group); + db_set_ws(cc, "CList", "Group", group); } else if (!mir_wstrcmp(action, L"delete")) { MCONTACT cc = HContactFromJID(jid); @@ -1365,7 +1365,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (szMessage == NULL) return; - CMString tmp(szMessage); + CMStringW tmp(szMessage); tmp += ExtractImage(node); tmp.Replace(L"\n", L"\r\n"); ptrA buf(mir_utf8encodeW(tmp)); @@ -1407,7 +1407,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) if (from == NULL) return; - debugLog(L"presence: for jid %s", from); + debugLogW(L"presence: for jid %s", from); pResourceStatus r(ResourceInfoFromJID(from)); if (r == NULL) @@ -1449,7 +1449,7 @@ void CJabberProto::UpdateJidDbSettings(const wchar_t *jid) if (wcschr(jid, '/') == NULL) status = item->getTemp()->m_iStatus; if (item->getTemp()->m_tszStatusMessage) - db_set_ts(hContact, "CList", "StatusMsg", item->getTemp()->m_tszStatusMessage); + db_set_ws(hContact, "CList", "StatusMsg", item->getTemp()->m_tszStatusMessage); else db_unset(hContact, "CList", "StatusMsg"); } @@ -1472,9 +1472,9 @@ void CJabberProto::UpdateJidDbSettings(const wchar_t *jid) item->getTemp()->m_iStatus = status; if (nSelectedResource != -1) { pResourceStatus r(item->arResources[nSelectedResource]); - debugLog(L"JabberUpdateJidDbSettings: updating jid %s to rc %s", item->jid, r->m_tszResourceName); + debugLogW(L"JabberUpdateJidDbSettings: updating jid %s to rc %s", item->jid, r->m_tszResourceName); if (r->m_tszStatusMessage) - db_set_ts(hContact, "CList", "StatusMsg", r->m_tszStatusMessage); + db_set_ws(hContact, "CList", "StatusMsg", r->m_tszStatusMessage); else db_unset(hContact, "CList", "StatusMsg"); UpdateMirVer(hContact, r); @@ -1530,13 +1530,13 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if ((hContact = HContactFromJID(from)) == NULL) { if (!mir_wstrcmpi(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) { - debugLog(L"SKIP Receive presence online from %s (who is not in my roster and not in list - skiping)", from); + debugLogW(L"SKIP Receive presence online from %s (who is not in my roster and not in list - skiping)", from); return; } hContact = DBCreateContact(from, nick, true, true); } if (!ListGetItemPtr(LIST_ROSTER, from)) { - debugLog(L"Receive presence online from %s (who is not in my roster)", from); + debugLogW(L"Receive presence online from %s (who is not in my roster)", from); ListAdd(LIST_ROSTER, from, hContact); } DBCheckIsTransportedContact(from, hContact); @@ -1564,7 +1564,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (wcschr(from, '@') == NULL) { UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); } - debugLog(L"%s (%s) online, set contact status to %s", nick, from, pcli->pfnGetStatusModeDescription(status, 0)); + debugLogW(L"%s (%s) online, set contact status to %s", nick, from, pcli->pfnGetStatusModeDescription(status, 0)); HXML xNode; if (m_options.EnableAvatars) { @@ -1577,9 +1577,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (ptszHash != NULL) { delSetting(hContact, "AvatarXVcard"); debugLogA("AvatarXVcard deleted"); - setTString(hContact, "AvatarHash", ptszHash); + setWString(hContact, "AvatarHash", ptszHash); bHasAvatar = true; - ptrW saved(getTStringA(hContact, "AvatarSaved")); + ptrW saved(getWStringA(hContact, "AvatarSaved")); if (saved == NULL || mir_wstrcmp(saved, ptszHash)) { debugLogA("Avatar was changed"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL); @@ -1597,9 +1597,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (txt != NULL && txt[0] != 0) { setByte(hContact, "AvatarXVcard", 1); debugLogA("AvatarXVcard set"); - setTString(hContact, "AvatarHash", txt); + setWString(hContact, "AvatarHash", txt); bHasAvatar = true; - ptrW saved(getTStringA(hContact, "AvatarSaved")); + ptrW saved(getWStringA(hContact, "AvatarSaved")); if (saved == NULL || mir_wstrcmp(saved, txt)) { debugLogA("Avatar was changed. Using vcard-temp:x:update"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL); @@ -1612,7 +1612,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("Has no avatar"); delSetting(hContact, "AvatarHash"); - if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) { + if (ptrW(getWStringA(hContact, "AvatarSaved")) != NULL) { delSetting(hContact, "AvatarSaved"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL); } } } @@ -1639,7 +1639,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) item->getTemp()->m_tszStatusMessage = mir_wstrdup(XmlGetText(XmlGetChild(node, "status"))); } } - else debugLog(L"SKIP Receive presence offline from %s (who is not in my roster)", from); + else debugLogW(L"SKIP Receive presence offline from %s (who is not in my roster)", from); UpdateJidDbSettings(from); @@ -1659,7 +1659,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (xNick != NULL) { LPCTSTR xszNick = XmlGetText(xNick); if (xszNick != NULL && *xszNick) { - debugLog(L"Grabbed nick from presence: %s", xszNick); + debugLogW(L"Grabbed nick from presence: %s", xszNick); tszNick = mir_wstrdup(xszNick); } } @@ -1672,11 +1672,11 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (m_options.AutoAdd == TRUE) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, from); if (item == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) { - debugLog(L"Try adding contact automatically jid = %s", from); + debugLogW(L"Try adding contact automatically jid = %s", from); if ((hContact = AddToListByJID(from, 0)) != NULL) { if (item) item->hContact = hContact; - setTString(hContact, "Nick", tszNick); + setWString(hContact, "Nick", tszNick); db_unset(hContact, "CList", "NotOnList"); } } @@ -1684,7 +1684,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) RebuildInfoFrame(); } else { - debugLog(L"%s (%s) requests authorization", tszNick, from); + debugLogW(L"%s (%s) requests authorization", tszNick, from); DBAddAuthRequest(from, tszNick); } return; diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 4a0f6e0046..bd464df117 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & g_JabberFeatCapPairs[i].jcbCap) { wchar_t szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) - mir_snwprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); + mir_snwprintf(szDescription, L"%s (%s)", TranslateW(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else wcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { wchar_t szDescription[ 1024 ]; if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) - mir_snwprintf(szDescription, L"%s (%s)", TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); + mir_snwprintf(szDescription, L"%s (%s)", TranslateW(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else wcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -320,9 +320,9 @@ static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM ht if (szAdvStatusIcon && szAdvStatusTitle && *szAdvStatusTitle) { wchar_t szText[2048]; if (szAdvStatusText && *szAdvStatusText) - mir_snwprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); + mir_snwprintf(szText, L"%s (%s)", TranslateW(szAdvStatusTitle), szAdvStatusText); else - wcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); + wcsncpy_s(szText, TranslateW(szAdvStatusTitle), _TRUNCATE); sttFillInfoLine(hwndTree, htiRoot, IcoLib_GetIcon(szAdvStatusIcon), szTitle, szText, dwInfoLine); } @@ -470,7 +470,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (dat == NULL) break; if (dat->item == NULL) { - ptrW jid(dat->ppro->getTStringA(dat->hContact, "jid")); + ptrW jid(dat->ppro->getWStringA(dat->hContact, "jid")); if (jid == NULL) break; @@ -560,7 +560,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa case PSN_PARAMCHANGED: dat->ppro = (CJabberProto*)((PSHNOTIFY*)lParam)->lParam; if (dat->hContact != NULL) { - ptrW jid(dat->ppro->getTStringA(dat->hContact, "jid")); + ptrW jid(dat->ppro->getWStringA(dat->hContact, "jid")); if (jid != NULL) if (!(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid))) dat->item = dat->ppro->ListGetItemPtr(LIST_ROSTER, jid); @@ -642,14 +642,14 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE); { - ptrW jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); + ptrW jid(photoInfo->ppro->getWStringA(photoInfo->hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *item = photoInfo->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid); if (item == NULL) item = photoInfo->ppro->ListGetItemPtr(LIST_ROSTER, jid); if (item != NULL) { if (item->photoFileName) { - photoInfo->ppro->debugLog(L"Showing picture from %s", item->photoFileName); + photoInfo->ppro->debugLogW(L"Showing picture from %s", item->photoFileName); photoInfo->hBitmap = Bitmap_Load(item->photoFileName); FIP->FI_Premultiply(photoInfo->hBitmap); ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_SHOW); @@ -666,7 +666,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP case IDC_SAVE: static wchar_t szFilter[512]; - ptrW jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); + ptrW jid(photoInfo->ppro->getWStringA(photoInfo->hContact, "jid")); if (jid == NULL) break; @@ -701,7 +701,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP ofn.nMaxFile = _MAX_PATH; ofn.Flags = OFN_OVERWRITEPROMPT; if (GetSaveFileName(&ofn)) { - photoInfo->ppro->debugLog(L"File selected is %s", szFileName); + photoInfo->ppro->debugLogW(L"File selected is %s", szFileName); CopyFile(item->photoFileName, szFileName, FALSE); } } diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index c607e10c26..c2083fb050 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -283,9 +283,9 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) } if (str != NULL) - mir_snwprintf(errorStr, 256, L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)), str); + mir_snwprintf(errorStr, 256, L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateW(JabberErrorStr(errorCode)), str); else - mir_snwprintf(errorStr, 256, L"%s %d: %s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode))); + mir_snwprintf(errorStr, 256, L"%s %d: %s", TranslateT("Error"), errorCode, TranslateW(JabberErrorStr(errorCode))); if (pErrorCode) *pErrorCode = errorCode; @@ -425,7 +425,7 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con arrExtCaps.insert(m_lstJabberFeatCapPairsDynamic[i]->szExt); if (arrExtCaps.getCount()) { - CMString szExtCaps = arrExtCaps[0]; + CMStringW szExtCaps = arrExtCaps[0]; for (int i = 1; i < arrExtCaps.getCount(); i++) { szExtCaps.AppendChar(' '); szExtCaps += arrExtCaps[i]; @@ -528,7 +528,7 @@ wchar_t* CJabberProto::GetClientJID(MCONTACT hContact, wchar_t *dest, size_t des if (hContact == NULL) return NULL; - ptrW jid(getTStringA(hContact, "jid")); + ptrW jid(getWStringA(hContact, "jid")); return GetClientJID(jid, dest, destLen); } @@ -658,7 +658,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par for (int i = 0; i < recentCount; i++) { char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, "%s%d", param, i); - ptrW tszRecent(getTStringA(setting)); + ptrW tszRecent(getWStringA(setting)); if (tszRecent != NULL) SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, tszRecent); } @@ -682,7 +682,7 @@ void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param id = getByte(param, 0); char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, "%s%d", param, id); - setTString(setting, string); + setWString(setting, string); setByte(param, (id + 1) % recentCount); } @@ -809,7 +809,7 @@ void JabberCopyText(HWND hwnd, const wchar_t *text) } } -BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout) +BOOL CJabberProto::EnterString(CMStringW &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout) { if (caption == NULL) { caption = NEWWSTR_ALLOCA(result.GetString()); @@ -933,7 +933,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) fclose(out); setString(ai.hContact, "AvatarSaved", buffer); ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0); - debugLog(L"Broadcast new avatar: %s", ai.filename); + debugLogW(L"Broadcast new avatar: %s", ai.filename); } else ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0); } diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index f48503739d..e4a6b04931 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -46,9 +46,9 @@ int CJabberProto::SendGetVcard(const wchar_t *jid) static void SetDialogField(CJabberProto *ppro, HWND hwndDlg, int nDlgItem, char* key, bool bTranslate = false) { - ptrW tszValue(ppro->getTStringA(key)); + ptrW tszValue(ppro->getWStringA(key)); if (tszValue != NULL) - SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(tszValue) : tszValue); + SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateW(tszValue) : tszValue); else SetDlgItemTextA(hwndDlg, nDlgItem, ""); } @@ -127,7 +127,7 @@ static INT_PTR CALLBACK HomeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (int i = 0; i < g_cbCountries; i++) { if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) { wchar_t *country = mir_a2u(g_countries[i].szName); - SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country)); + SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateW(country)); mir_free(country); } } @@ -191,7 +191,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (int i = 0; i < g_cbCountries; i++) { if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) { wchar_t *country = mir_a2u(g_countries[i].szName); - SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country)); + SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateW(country)); mir_free(country); } } @@ -293,7 +293,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (GetTempPath(_countof(szTempPath), szTempPath) <= 0) mir_wstrcpy(szTempPath, L".\\"); if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) { - dat->ppro->debugLog(L"Temp file = %s", szTempFileName); + dat->ppro->debugLogW(L"Temp file = %s", szTempFileName); if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) { if ((dat->hBitmap = Bitmap_Load(szTempFileName)) != NULL) { FIP->FI_Premultiply(dat->hBitmap); @@ -349,7 +349,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR struct _stat st; HBITMAP hNewBitmap; - dat->ppro->debugLog(L"File selected is %s", szFileName); + dat->ppro->debugLogW(L"File selected is %s", szFileName); if (_wstat(szFileName, &st) < 0 || st.st_size > 40 * 1024) { MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK | MB_SETFOREGROUND); break; @@ -358,7 +358,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mir_wstrcpy(szTempPath, L".\\"); if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) { - dat->ppro->debugLog(L"Temp file = %s", szTempFileName); + dat->ppro->debugLogW(L"Temp file = %s", szTempFileName); if (CopyFile(szFileName, szTempFileName, FALSE) == TRUE) { if ((hNewBitmap = Bitmap_Load(szTempFileName)) != NULL) { if (dat->hBitmap) { @@ -581,7 +581,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t text[128]; GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text)); mir_snprintf(idstr, "e-mail%d", dat->id); - dat->ppro->setTString(idstr, text); + dat->ppro->setWString(idstr, text); { WORD nFlag = 0; if (IsDlgButtonChecked(hwndDlg, IDC_HOME)) nFlag |= JABBER_VCEMAIL_HOME; @@ -730,7 +730,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0; for (i=0;;i++) { mir_snprintf(idstr, "e-mail%d", i); - ptrW email( ppro->getTStringA(idstr)); + ptrW email( ppro->getWStringA(idstr)); if (email == NULL) break; mir_snwprintf(number, L"%d", i+1); @@ -751,7 +751,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0; for (i=0;;i++) { mir_snprintf(idstr, "Phone%d", i); - ptrW phone( ppro->getTStringA(idstr)); + ptrW phone( ppro->getWStringA(idstr)); if (phone == NULL) break; mir_snwprintf(number, L"%d", i+1); @@ -922,44 +922,44 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) switch (iPage) { case 0: GetDlgItemText(hwndPage, IDC_FULLNAME, text, _countof(text)); - setTString("FullName", text); + setWString("FullName", text); GetDlgItemText(hwndPage, IDC_NICKNAME, text, _countof(text)); - setTString("Nick", text); + setWString("Nick", text); GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, _countof(text)); - setTString("FirstName", text); + setWString("FirstName", text); GetDlgItemText(hwndPage, IDC_MIDDLE, text, _countof(text)); - setTString("MiddleName", text); + setWString("MiddleName", text); GetDlgItemText(hwndPage, IDC_LASTNAME, text, _countof(text)); - setTString("LastName", text); + setWString("LastName", text); GetDlgItemText(hwndPage, IDC_BIRTH, text, _countof(text)); - setTString("BirthDate", text); + setWString("BirthDate", text); switch (SendDlgItemMessage(hwndPage, IDC_GENDER, CB_GETCURSEL, 0, 0)) { case 0: setString("GenderString", "Male"); break; case 1: setString("GenderString", "Female"); break; default: setString("GenderString", ""); break; } GetDlgItemText(hwndPage, IDC_OCCUPATION, text, _countof(text)); - setTString("Role", text); + setWString("Role", text); GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, _countof(text)); - setTString("Homepage", text); + setWString("Homepage", text); break; // Page 1: Home case 1: GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text)); - setTString("Street", text); + setWString("Street", text); GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text)); - setTString("Street2", text); + setWString("Street2", text); GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text)); - setTString("City", text); + setWString("City", text); GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text)); - setTString("State", text); + setWString("State", text); GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text)); - setTString("ZIP", text); + setWString("ZIP", text); { int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0); wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName); - setTString("Country", country); + setWString("Country", country); mir_free(country); } break; @@ -967,25 +967,25 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 2: Work case 2: GetDlgItemText(hwndPage, IDC_COMPANY, text, _countof(text)); - setTString("Company", text); + setWString("Company", text); GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, _countof(text)); - setTString("CompanyDepartment", text); + setWString("CompanyDepartment", text); GetDlgItemText(hwndPage, IDC_TITLE, text, _countof(text)); - setTString("CompanyPosition", text); + setWString("CompanyPosition", text); GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text)); - setTString("CompanyStreet", text); + setWString("CompanyStreet", text); GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text)); - setTString("CompanyStreet2", text); + setWString("CompanyStreet2", text); GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text)); - setTString("CompanyCity", text); + setWString("CompanyCity", text); GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text)); - setTString("CompanyState", text); + setWString("CompanyState", text); GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text)); - setTString("CompanyZIP", text); + setWString("CompanyZIP", text); { int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0); wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName); - setTString("CompanyCountry", country); + setWString("CompanyCountry", country); mir_free(country); } break; @@ -996,7 +996,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 4: Note case 4: GetDlgItemText(hwndPage, IDC_DESC, text, _countof(text)); - setTString("About", text); + setWString("About", text); break; } } @@ -1006,7 +1006,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key) if (n == NULL || tag == NULL || key == NULL) return; - ptrW tszValue(getTStringA(key)); + ptrW tszValue(getWStringA(key)); n << XCHILD(_A2T(tag), tszValue); } @@ -1033,7 +1033,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) for (i = 0;; i++) { mir_snprintf(idstr, "e-mail%d", i); - ptrW email(getTStringA(idstr)); + ptrW email(getWStringA(idstr)); if (email == NULL) break; @@ -1081,7 +1081,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) for (i = 0;; i++) { mir_snprintf(idstr, "Phone%d", i); - ptrW phone(getTStringA(idstr)); + ptrW phone(getWStringA(idstr)); if (phone == NULL) break; @@ -1112,7 +1112,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) szFileName = szAvatarName; // Set photo element, also update the global jabberVcardPhotoFileName to reflect the update - debugLog(L"Before update, file name = %s", szFileName); + debugLogW(L"Before update, file name = %s", szFileName); if (szFileName == NULL || szFileName[0] == 0) { v << XCHILD(L"PHOTO"); DeleteFile(szAvatarName); @@ -1120,7 +1120,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) delSetting("AvatarHash"); } else { - debugLog(L"Saving picture from %s", szFileName); + debugLogW(L"Saving picture from %s", szFileName); struct _stat st; if (_wstat(szFileName, &st) >= 0) { @@ -1187,7 +1187,7 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; odp.dwInitParam = (LPARAM)this; - odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; + odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; odp.pwszTitle = m_tszUserName; odp.pfnDlgProc = PersonalDlgProc; diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 739fd07362..b3db55eb4d 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -32,7 +32,7 @@ BOOL CJabberProto::WsInit(void) mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; nlu.ptszDescriptiveName = name; nlu.szSettingsModule = m_szModuleName; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 7a0c229662..8f88666661 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -277,7 +277,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) { wchar_t *txt = m_txtDescription.GetText(); mir_snprintf(szSetting, "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name); - m_proto->setTString(szSetting, txt); + m_proto->setWString(szSetting, txt); mir_free(txt); } @@ -285,7 +285,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) { mir_snprintf(szSetting, "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name); - ptrW szDescr( m_proto->getTStringA(szSetting)); + ptrW szDescr( m_proto->getWStringA(szSetting)); m_txtDescription.SetText((szDescr != NULL) ? szDescr : L""); m_txtDescription.Enable(true); } @@ -469,7 +469,7 @@ void CPepGuiService::RebuildMenu() mi.root = hJabberRoot; mi.pszService = szService; mi.position = 200010; - mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_HIDDEN; + mi.flags = CMIF_UNMOVABLE | CMIF_UNICODE | CMIF_HIDDEN; mi.hIcolibItem = m_hIcolibItem; mi.name.w = m_szText ? m_szText : LPGENW(""); m_hMenuItem = Menu_AddProtoMenuItem(&mi, m_proto->m_szModuleName); @@ -693,7 +693,7 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t * HANDLE hIcon; wchar_t title[128]; if (mood >= 0) { - mir_snwprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName)); + mir_snwprintf(title, TranslateT("Mood: %s"), TranslateW(g_arrMoods[mood].szName)); hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag); } else { @@ -709,13 +709,13 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t * if (szMood) { m_proto->setByte(hContact, DBSETTING_XSTATUSID, mood); - m_proto->setTString(hContact, DBSETTING_XSTATUSNAME, TranslateTS(g_arrMoods[mood].szName)); + m_proto->setWString(hContact, DBSETTING_XSTATUSNAME, TranslateW(g_arrMoods[mood].szName)); if (szText) - m_proto->setTString(hContact, DBSETTING_XSTATUSMSG, szText); + m_proto->setWString(hContact, DBSETTING_XSTATUSMSG, szText); else m_proto->delSetting(hContact, DBSETTING_XSTATUSMSG); - m_proto->WriteAdvStatus(hContact, ADVSTATUS_MOOD, szMood, g_MoodIcons.GetIcolibName(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName), szText); + m_proto->WriteAdvStatus(hContact, ADVSTATUS_MOOD, szMood, g_MoodIcons.GetIcolibName(g_arrMoods[mood].szTag), TranslateW(g_arrMoods[mood].szName), szText); } else { m_proto->delSetting(hContact, DBSETTING_XSTATUSID); @@ -733,7 +733,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) if (!bQuiet) { CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood")); for (int i = 1; i < _countof(g_arrMoods); i++) - dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateTS(g_arrMoods[i].szName)); + dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateW(g_arrMoods[i].szName)); dlg.SetActiveStatus(m_mode, m_text); dlg.DoModal(); @@ -748,7 +748,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) wchar_t *ptszTitle; if (m_mode >= 0) { Publish(); - hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[m_mode].szTag); ptszTitle = TranslateTS(g_arrMoods[m_mode].szName); + hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[m_mode].szTag); ptszTitle = TranslateW(g_arrMoods[m_mode].szName); } else { Retract(); @@ -971,9 +971,9 @@ void ActivityBuildTitle(int id, wchar_t *buf, int size) if (szFirst) { if (szSecond) - mir_snwprintf(buf, size, L"%s [%s]", TranslateTS(szFirst), TranslateTS(szSecond)); + mir_snwprintf(buf, size, L"%s [%s]", TranslateW(szFirst), TranslateW(szSecond)); else - mir_wstrncpy(buf, TranslateTS(szFirst), size); + mir_wstrncpy(buf, TranslateW(szFirst), size); } else *buf = 0; } @@ -1109,7 +1109,7 @@ void CPepActivity::ShowSetDialog(BYTE) CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Activity")); for (int i=0; i < _countof(g_arrActivities); i++) if (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond) - dlg.AddStatusMode(i, ActivityGetId(i), g_ActivityIcons.GetIcon(returnActivity(i)), TranslateTS(g_arrActivities[i].szTitle), (g_arrActivities[i].szSecond != NULL)); + dlg.AddStatusMode(i, ActivityGetId(i), g_ActivityIcons.GetIcon(returnActivity(i)), TranslateW(g_arrActivities[i].szTitle), (g_arrActivities[i].szSecond != NULL)); dlg.SetActiveStatus(m_mode, m_text); dlg.DoModal(); @@ -1123,7 +1123,7 @@ void CPepActivity::ShowSetDialog(BYTE) UpdateMenuItem(g_ActivityIcons.GetIcolibHandle(returnActivity(m_mode)), g_arrActivities[m_mode].szTitle); if (m_proto->m_pInfoFrame) - m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(m_mode)), TranslateTS(g_arrActivities[m_mode].szTitle)); + m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(m_mode)), TranslateW(g_arrActivities[m_mode].szTitle)); } else { Retract(); @@ -1218,7 +1218,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s mir_snwprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L""); } - setTString(hContact, "ListeningTo", szListeningTo); + setWString(hContact, "ListeningTo", szListeningTo); char tuneIcon[128]; mir_snprintf(tuneIcon, "%s_%s", m_szModuleName, "main"); @@ -1468,17 +1468,17 @@ void CJabberProto::WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const char szSetting[128]; mir_snprintf(szSetting, "%s/%s/id", m_szModuleName, pszSlot); - db_set_ts(hContact, "AdvStatus", szSetting, pszMode); + db_set_ws(hContact, "AdvStatus", szSetting, pszMode); mir_snprintf(szSetting, "%s/%s/icon", m_szModuleName, pszSlot); db_set_s(hContact, "AdvStatus", szSetting, pszIcon); mir_snprintf(szSetting, "%s/%s/title", m_szModuleName, pszSlot); - db_set_ts(hContact, "AdvStatus", szSetting, pszTitle); + db_set_ws(hContact, "AdvStatus", szSetting, pszTitle); mir_snprintf(szSetting, "%s/%s/text", m_szModuleName, pszSlot); if (pszText) - db_set_ts(hContact, "AdvStatus", szSetting, pszText); + db_set_ws(hContact, "AdvStatus", szSetting, pszText); else db_unset(hContact, "AdvStatus", szSetting); } @@ -1494,7 +1494,7 @@ wchar_t* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, co { char szSetting[128]; mir_snprintf(szSetting, "%s/%s/%s", m_szModuleName, pszSlot, pszValue); - return db_get_tsa(hContact, "AdvStatus", szSetting); + return db_get_wsa(hContact, "AdvStatus", szSetting); } /////////////////////////////////////////////////////////////////////////////// @@ -1511,13 +1511,13 @@ void g_XstatusIconsInit() mir_wstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods")); for (int i = 1; i < _countof(g_arrMoods); i++) - g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName)); + g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateW(g_arrMoods[i].szName)); mir_wstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Activities")); for (int k = 0; k < _countof(g_arrActivities); k++) { if (g_arrActivities[k].szFirst) - g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle)); + g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateW(g_arrActivities[k].szTitle)); if (g_arrActivities[k].szSecond) - g_ActivityIcons.RegisterIcon(g_arrActivities[k].szSecond, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle)); + g_ActivityIcons.RegisterIcon(g_arrActivities[k].szSecond, szFile, g_arrActivities[k].iconid, szSection, TranslateW(g_arrActivities[k].szTitle)); } } diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index 5ea4500c69..cfcda90d31 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -65,7 +65,7 @@ void InitComboBox(HWND hWndCombo, FieldNames *lpNames) ResetComboBox(hWndCombo); for (size_t i = 0; lpNames[i].lpszText; i++) { - DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(lpNames[i].lpszText)); + DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(lpNames[i].lpszText)); SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, lpNames[i].dwCode); } } diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index ca412ee5dc..8986f6e781 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -59,7 +59,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) mir_snwprintf(szBuffer, L"%s %s", m_tszUserName, TranslateT("Avatars' plugin connections")); NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = MRA_AVT_SECT_NAME; nlu.ptszDescriptiveName = szBuffer; pmraaqAvatarsQueue->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); @@ -476,11 +476,11 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hQueue, MCONTACT hContact, DWORD d return ERROR_NOT_SUPPORTED; wchar_t tszBase[MAX_PATH]; - mir_snwprintf(tszBase, L"%s\\%s\\", VARST(L"%miranda_avatarcache%"), m_tszUserName); + mir_snwprintf(tszBase, L"%s\\%s\\", VARSW(L"%miranda_avatarcache%"), m_tszUserName); res = tszBase; // some path in buff and free space for file name is avaible - CreateDirectoryTreeT(res); + CreateDirectoryTreeW(res); if (dwFormat != PA_FORMAT_DEFAULT) { CMStringW szEmail; @@ -633,7 +633,7 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara wchar_t szServer[MAX_PATH]; GetDlgItemText(hWndDlg, IDC_SERVER, szServer, _countof(szServer)); - db_set_ts(NULL, MRA_AVT_SECT_NAME, "Server", szServer); + db_set_ws(NULL, MRA_AVT_SECT_NAME, "Server", szServer); return TRUE; } break; diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 58b17b39f8..9033968d25 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -45,7 +45,7 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact) GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP }; GCEVENT gce = { sizeof(gce), &gcd }; for (int i = 0; i < _countof(lpwszStatuses); i++) { - gce.ptszStatus = TranslateTS(lpwszStatuses[i]); + gce.ptszStatus = TranslateW(lpwszStatuses[i]); CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); } diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index 8b2c83a35d..ee5a2f35f5 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -103,7 +103,7 @@ void InitXStatusIcons() SKINICONDESC sid = { 0 }; sid.section.w = LPGENW("Protocols")L"/" LPGENW("MRA") L"/" LPGENW("Custom Status"); sid.defaultFile.w = szBuff; - sid.flags = SIDF_ALL_TCHAR; + sid.flags = SIDF_ALL_UNICODE; hXStatusAdvancedStatusIcons[0] = NULL; for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) { diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index 2f5bc21800..14b780924c 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -28,7 +28,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR SendMessage(hWndCombo, CB_RESETCONTENT, 0, 0); for (size_t i = 0; i < POPUPS_TYPES_COUNT; i++) { - DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(lpcwszPopupsTypes[i])); + DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(lpcwszPopupsTypes[i])); SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i); } SendMessage(hWndCombo, CB_SETCURSEL, 0, 0); @@ -68,7 +68,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR case IDC_PREVIEW: for (int i = 0; i < POPUPS_TYPES_COUNT; i++) - ppro->MraPopupShowFromAgentW(i, 0, TranslateTS(lpcwszPopupsTypes[i])); + ppro->MraPopupShowFromAgentW(i, 0, TranslateW(lpcwszPopupsTypes[i])); break; case IDC_CHK_ENABLE: @@ -134,7 +134,7 @@ int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM) odp.pwszTitle = m_tszUserName; odp.pwszGroup = LPGENW("Popups"); odp.groupPosition = 900000000; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.pfnDlgProc = MraPopupDlgProcOpts; Options_AddPage(wParam, &odp); } diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 5ba003938d..a8daef4625 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -39,7 +39,7 @@ CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) : mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 0cb54e6522..f5c9849e9f 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -184,7 +184,7 @@ DWORD CMraProto::MraMessageRecv(const CMStringA &szFrom, DWORD dwMsgID) } // Adds new contact -DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones, const CMString* wszAuthMessage) +DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones, const CMStringW* wszAuthMessage) { if (szEmail.GetLength() <= 4 && !(dwContactFlag & CONTACT_FLAG_GROUP)) return 0; diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 60d4784a14..92a44be899 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -458,9 +458,9 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D MraGroupItem *grp = m_groups.find((MraGroupItem*)&dwGroupID); if (grp) { - ptrW tszGroup(db_get_tsa(hContact, "CList", "Group")); + ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); if (mir_wstrcmp(tszGroup, grp->m_name)) - db_set_ts(hContact, "CList", "Group", grp->m_name); + db_set_ws(hContact, "CList", "Group", grp->m_name); } } @@ -874,11 +874,11 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode size_t dwErrDescriptionSize; if (dwErrorCode == NO_ERROR) - wcsncpy_s(szErrorText, TranslateTS(lpwszErrText), _TRUNCATE); + wcsncpy_s(szErrorText, TranslateW(lpwszErrText), _TRUNCATE); else { dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2); szErrDescription[dwErrDescriptionSize] = 0; - mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateTS(lpwszErrText), dwErrorCode, szErrDescription); + mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateW(lpwszErrText), dwErrorCode, szErrDescription); } MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, szErrorText); } @@ -997,13 +997,13 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP SendDlgItemMessage(hWndDlg, IDC_XTITLE, EM_LIMITTEXT, STATUS_TITLE_MAX, 0); SendDlgItemMessage(hWndDlg, IDC_XMSG, EM_LIMITTEXT, STATUS_DESC_MAX, 0); SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->hDlgIcon); - SetWindowText(hWndDlg, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus])); + SetWindowText(hWndDlg, TranslateW(lpcszXStatusNameDef[dat->dwXStatus])); mir_snprintf(szValueName, "XStatus%ldName", dat->dwXStatus); if (dat->ppro->mraGetStringW(NULL, szValueName, szBuff)) SetDlgItemText(hWndDlg, IDC_XTITLE, szBuff.c_str()); // custom xstatus name else // default xstatus name - SetDlgItemText(hWndDlg, IDC_XTITLE, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus])); + SetDlgItemText(hWndDlg, IDC_XTITLE, TranslateW(lpcszXStatusNameDef[dat->dwXStatus])); mir_snprintf(szValueName, "XStatus%ldMsg", dat->dwXStatus); if (dat->ppro->mraGetStringW(NULL, szValueName, szBuff)) @@ -1056,7 +1056,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dwBuffSize = GetDlgItemText(hWndDlg, IDC_XTITLE, szBuff, (STATUS_TITLE_MAX + 1)); if (dwBuffSize == 0) { // user delete all text - mir_wstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1); + mir_wstrncpy(szBuff, TranslateW(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1); dwBuffSize = (DWORD)mir_wstrlen(szBuff); } mir_snprintf(szValueName, "XStatus%dName", dat->dwXStatus); diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index f54ecfb595..e31dc66345 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -341,7 +341,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI hRootMenu = Menu_GetProtocolRoot(this); if (hRootMenu == NULL) { mi.name.w = m_tszUserName; - mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_UNICODE | CMIF_KEEPUNTRANSLATED; mi.hIcolibItem = g_hMainIcon; hRootMenu = Menu_AddProtoMenuItem(&mi); } diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 1bd1a5694f..ac742a9f29 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -38,10 +38,10 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA case PSN_APPLY: wchar_t szBuff[MAX_EMAIL_LEN]; GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff)); - ppro->setTString(NULL, "e-mail", szBuff); + ppro->setWString(NULL, "e-mail", szBuff); if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, _countof(szBuff))) { - ppro->setTString("Password", szBuff); + ppro->setWString("Password", szBuff); SecureZeroMemory(szBuff, sizeof(szBuff)); } return TRUE; @@ -91,7 +91,7 @@ INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lP ppro->mraSetStringW(NULL, "e-mail", szBuff); if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, _countof(szBuff))) { - ppro->setTString("Password", szBuff); + ppro->setWString("Password", szBuff); SecureZeroMemory(szBuff, sizeof(szBuff)); } return TRUE; @@ -218,7 +218,7 @@ int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.hInstance = g_hInstance; odp.pwszTitle = m_tszUserName; odp.pwszGroup = LPGENW("Network"); - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.pwszTab = LPGENW("Account"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ACCOUNT); diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 19d568e54c..6dbe4220c4 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -357,7 +357,7 @@ bool CMraProto::CmdHelloAck(BinBuffer &buf) if (IsXStatusValid(dwXStatusMir)) {// xstatuses mir_snprintf(szValueName, "XStatus%ldName", dwXStatusMir); if (!mraGetStringW(NULL, szValueName, wszStatusTitle)) - wszStatusTitle = TranslateTS(lpcszXStatusNameDef[dwXStatusMir]); + wszStatusTitle = TranslateW(lpcszXStatusNameDef[dwXStatusMir]); mir_snprintf(szValueName, "XStatus%ldMsg", dwXStatusMir); mraGetStringW(NULL, szValueName, wszStatusDesc); @@ -721,7 +721,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) case CONTACT_OPER_SUCCESS:// ## äîáàâëåíèå ïðîèçâåäåíî óñïåøíî if (cmd == MRIM_CS_ADD_CONTACT_ACK) { DWORD dwFlags = SCBIF_ID | SCBIF_SERVER_FLAG, dwGroupID = 0; - ptrW grpName(db_get_tsa(hContact, "CList", "Group")); + ptrW grpName(db_get_wsa(hContact, "CList", "Group")); if (grpName) { dwFlags |= SCBIF_GROUP_ID; dwGroupID = MraMoveContactToGroup(hContact, -1, grpName); @@ -1259,7 +1259,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) } else { if (iGroupMode == 100) { // first start - ptrW tszGroup(db_get_tsa(hContact, "CList", "Group")); + ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); if (tszGroup) dwGroupID = MraMoveContactToGroup(hContact, dwGroupID, tszGroup); } @@ -1788,7 +1788,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & if (m_heNudgeReceived) NotifyEventHooks(m_heNudgeReceived, hContact, NULL); else { - T2Utf szMsg(TranslateTS(MRA_ALARM_MESSAGE)); + T2Utf szMsg(TranslateW(MRA_ALARM_MESSAGE)); pre.szMessage = szMsg; ProtoChainRecvMsg(hContact, &pre); } diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index c957ad89d5..67f0969a99 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -531,7 +531,7 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C mir_snprintf(szValueName, "XStatus%ldName", dwXStatusMir); // custom xstatus name if (!mraGetStringW(NULL, szValueName, wszStatusTitle)) - wszStatusTitle = TranslateTS(lpcszXStatusNameDef[dwXStatusMir]); + wszStatusTitle = TranslateW(lpcszXStatusNameDef[dwXStatusMir]); } else wszStatusTitle = pwszStatusTitle; diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 539280f125..0c87d43f5b 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -506,7 +506,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0); DBVARIANT dbv; - int bError = getTString("Nick", &dbv); + int bError = getWString("Nick", &dbv); GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 2a37ab21e1..190fb1e704 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -273,7 +273,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para case 'p': psr[cnt] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT)); psr[cnt]->cbSize = sizeof(psr); - psr[cnt]->flags = PSR_TCHAR; + psr[cnt]->flags = PSR_UNICODE; psr[cnt]->id.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2u(wlid); cnt++; } @@ -523,7 +523,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment; @@ -573,7 +573,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = szEmailT; psr.nick.w = szEmailT; psr.email.w = szEmailT; @@ -849,7 +849,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) else lti.ptszType = mir_utf8decodeW(parts[1]); wchar_t *cm = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i); - setTString(hContact, "ListeningTo", cm); + setWString(hContact, "ListeningTo", cm); mir_free(cm); @@ -1473,7 +1473,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = tComment; diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index a46e26e1a6..35ab65cfa3 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -95,7 +95,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) /* does not yet check if email is current user */ if (hContact == NULL) { PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = email; psr.email.w = email; diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 2016dfc9b9..9ca0aa8942 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -391,6 +391,6 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) mir_snwprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails); nickChg = true; - setTString(hContact, "Nick", szNick); + setWString(hContact, "Nick", szNick); nickChg = false; } diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index ef12418621..5a7e2418a8 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -198,7 +198,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, 129, 0); DBVARIANT dbv; - if (!proto->getTString("Nick", &dbv)) { + if (!proto->getWString("Nick", &dbv)) { SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 5b6b1b1ec7..7fa82d51e8 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -170,10 +170,10 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) // MSN_GetAvatarFileName - gets a file name for an contact's avatar void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext) { - size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); if (_waccess(pszDest, 0)) - CreateDirectoryTreeT(pszDest); + CreateDirectoryTreeW(pszDest); size_t tPathLen2 = tPathLen; if (hContact != NULL) { @@ -331,7 +331,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, if (hContact != NULL) { DBVARIANT dbv = { 0 }; - if (getTString(hContact, "e-mail", &dbv)) { + if (getWString(hContact, "e-mail", &dbv)) { dbv.type = DBVT_ASCIIZ; dbv.ptszVal = (wchar_t*)mir_alloc(11*sizeof(wchar_t)); _ui64tow((UINT_PTR)hContact, dbv.ptszVal, 10); @@ -354,7 +354,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, } if (!exist) - CreateDirectoryTreeT(pszDest); + CreateDirectoryTreeW(pszDest); wchar_t *sztSmileyName = mir_a2u(SmileyName); mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName, @@ -397,7 +397,7 @@ void CMsnProto::MSN_GoOffline(void) { if (isChatRoom(hContact) != 0) { DBVARIANT dbv; - if (getTString(hContact, "ChatRoomID", &dbv) == 0) { + if (getWString(hContact, "ChatRoomID", &dbv) == 0) { GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce); @@ -990,7 +990,7 @@ void CMsnProto::InitPopups(void) ppc.flags = PCF_TCHAR; ppc.PluginWindowProc = NullWindowProc; ppc.hIcon = LoadIconEx("main"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.colorBack = RGB(173, 206, 247); @@ -1087,7 +1087,7 @@ filetransfer::filetransfer(CMsnProto* prt) memset(this, 0, sizeof(filetransfer)); fileId = -1; std.cbSize = sizeof(std); - std.flags = PFTS_TCHAR; + std.flags = PFTS_UNICODE; proto = prt; hLockHandle = CreateMutex(NULL, FALSE, NULL); diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 38b32891a8..be5634e4aa 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -98,7 +98,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND wnd = GetDlgItem(hwndDlg, IDC_HANDLE2); DBVARIANT dbv; - if (!proto->getTString("Nick", &dbv)) { + if (!proto->getWString("Nick", &dbv)) { SetWindowText(wnd, dbv.ptszVal); db_free(&dbv); } @@ -249,7 +249,7 @@ LBL_Continue: #ifdef OBSOLETE GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr)); - if (!proto->getTString("Nick", &dbv)) { + if (!proto->getWString("Nick", &dbv)) { if (mir_wstrcmp(dbv.ptszVal, screenStr)) proto->MSN_SendNickname(screenStr); db_free(&dbv); @@ -276,7 +276,7 @@ LBL_Continue: proto->setByte("ManageServer", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS)); GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, _countof(screenStr)); - proto->setTString("MailerPath", screenStr); + proto->setWString("MailerPath", screenStr); if (reconnectRequired && proto->msnLoggedIn) MessageBox(hwndDlg, @@ -522,7 +522,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETLIMITTEXT, 16, 0); DBVARIANT dbv; - if (!proto->getTString("Place", &dbv)) { + if (!proto->getWString("Place", &dbv)) { SetDlgItemText(hwndDlg, IDC_PLACE, dbv.ptszVal); db_free(&dbv); } @@ -570,7 +570,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t szPlace[64]; GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace)); if (szPlace[0]) - proto->setTString("Place", szPlace); + proto->setWString("Place", szPlace); else proto->delSetting("Place"); @@ -630,7 +630,7 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pwszTitle = m_tszUserName; odp.pwszGroup = LPGENW("Network"); odp.pwszTab = LPGENW("Account"); - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pfnDlgProc = DlgProcMsnOpts; odp.dwInitParam = (LPARAM)this; Options_AddPage(wParam, &odp); diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 5bb5a9b610..c4698514ad 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -1227,7 +1227,7 @@ void CMsnProto::p2p_InitFileTransfer( mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = tComment; diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index e9e6950beb..41e853830d 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -125,11 +125,11 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : mailsoundname = (char*)mir_alloc(64); mir_snprintf(mailsoundname, 64, "%s:Hotmail", m_szModuleName); - SkinAddNewSoundExT(mailsoundname, m_tszUserName, LPGENW("Live Mail")); + SkinAddNewSoundExW(mailsoundname, m_tszUserName, LPGENW("Live Mail")); alertsoundname = (char*)mir_alloc(64); mir_snprintf(alertsoundname, 64, "%s:Alerts", m_szModuleName); - SkinAddNewSoundExT(alertsoundname, m_tszUserName, LPGENW("Live Alert")); + SkinAddNewSoundExW(alertsoundname, m_tszUserName, LPGENW("Live Alert")); AvatarQueue_Init(); InitCustomFolders(); @@ -139,7 +139,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : NETLIBUSER nlu1 = { 0 }; nlu1.cbSize = sizeof(nlu1); - nlu1.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu1.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu1.szSettingsModule = szDbsettings; nlu1.ptszDescriptiveName = szBuffer; @@ -149,7 +149,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = szBuffer; @@ -417,7 +417,7 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = (wchar_t*)emailT; psr.nick.w = (wchar_t*)emailT; psr.email.w = (wchar_t*)emailT; @@ -736,7 +736,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg) AwayMsgInfo *inf = (AwayMsgInfo*)arg; DBVARIANT dbv; - if (!db_get_ts(inf->hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_ws(inf->hContact, "CList", "StatusMsg", &dbv)) { ProtoBroadcastAck(inf->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)inf->id, (LPARAM)dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index a0cd9ca76d..e27727c1da 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -144,12 +144,12 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false); if (hContact) { - if (value = get_json_str(item, "firstname")) setTString(hContact, "FirstName", value); - if (value = get_json_str(item, "lastname")) setTString(hContact, "LastName", value); - if (value = get_json_str(item, "displayname")) setTString(hContact, "Nick", value); + if (value = get_json_str(item, "firstname")) setWString(hContact, "FirstName", value); + if (value = get_json_str(item, "lastname")) setWString(hContact, "LastName", value); + if (value = get_json_str(item, "displayname")) setWString(hContact, "Nick", value); if (value = get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0)); - if (value = get_json_str(item, "city")) setTString(hContact, "City", value); - if (value = get_json_str(item, "mood")) db_set_ts(hContact, "CList", "StatusMsg", value); + if (value = get_json_str(item, "city")) setWString(hContact, "City", value); + if (value = get_json_str(item, "mood")) db_set_ws(hContact, "CList", "StatusMsg", value); } } json_delete(items); @@ -191,9 +191,9 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false); if (hContact) { - if (value = get_json_str(item, "firstname")) setTString(hContact, "FirstName", value); - if (value = get_json_str(item, "lastname")) setTString(hContact, "LastName", value); - if (value = get_json_str(item, "displayname")) setTString(hContact, "Nick", value); + if (value = get_json_str(item, "firstname")) setWString(hContact, "FirstName", value); + if (value = get_json_str(item, "lastname")) setWString(hContact, "LastName", value); + if (value = get_json_str(item, "displayname")) setWString(hContact, "Nick", value); if (value = get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_wtoi(value) == 1 ? 'M' : 'F')); if (value = get_json_str(item, "birthday")) { int d, m, y; @@ -203,10 +203,10 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) setByte(hContact, "BirthMonth", m); } if (value = get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0)); - if (value = get_json_str(item, "province")) setTString(hContact, "State", value); - if (value = get_json_str(item, "city")) setTString(hContact, "City", value); - if (value = get_json_str(item, "homepage")) setTString(hContact, "Homepage", value); - if (value = get_json_str(item, "about")) setTString(hContact, "About", value); + if (value = get_json_str(item, "province")) setWString(hContact, "State", value); + if (value = get_json_str(item, "city")) setWString(hContact, "City", value); + if (value = get_json_str(item, "homepage")) setWString(hContact, "Homepage", value); + if (value = get_json_str(item, "about")) setWString(hContact, "About", value); JSONNode *node = json_get(item, "emails"); if (node && !node->empty()) { @@ -220,10 +220,10 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) setStringUtf(hContact, szName, (*it).as_string().c_str()); } } - if (value = get_json_str(item, "phoneMobile")) setTString(hContact, "Cellular", value); - if (value = get_json_str(item, "phone")) setTString(hContact, "Phone", value); - if (value = get_json_str(item, "phoneOffice")) setTString(hContact, "CompanyPhone", value); - if (value = get_json_str(item, "mood")) db_set_ts(hContact, "CList", "StatusMsg", value); + if (value = get_json_str(item, "phoneMobile")) setWString(hContact, "Cellular", value); + if (value = get_json_str(item, "phone")) setWString(hContact, "Phone", value); + if (value = get_json_str(item, "phoneOffice")) setWString(hContact, "CompanyPhone", value); + if (value = get_json_str(item, "mood")) db_set_ws(hContact, "CList", "StatusMsg", value); } bRet = true; } @@ -391,7 +391,7 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) wchar_t *sSkypeName = json_as_string(json_get(Skype, "SkypeName")); PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = sSkypeName; psr.nick.w = sDisplayName; ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, hSearch, (LPARAM)&psr); diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 4746906aca..0b466b67ba 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -363,7 +363,7 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM, LPARAM lParam) mir_snwprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""), (msnCurrentMedia.ptszArtist ? msnCurrentMedia.ptszArtist : L"")); } - setTString("ListeningTo", text); + setWString("ListeningTo", text); mir_free(text); } @@ -385,7 +385,7 @@ int CMsnProto::OnContactDeleted(WPARAM hContact, LPARAM) if (isChatRoom(hContact)) { DBVARIANT dbv; - if (!getTString(hContact, "ChatRoomID", &dbv)) { + if (!getWString(hContact, "ChatRoomID", &dbv)) { MSN_KillChatSession(dbv.ptszVal); db_free(&dbv); } @@ -595,7 +595,7 @@ INT_PTR CMsnProto::OnLeaveChat(WPARAM hContact, LPARAM) { if (isChatRoom(hContact) != 0) { DBVARIANT dbv; - if (getTString(hContact, "ChatRoomID", &dbv) == 0) { + if (getWString(hContact, "ChatRoomID", &dbv) == 0) { MSN_KillChatSession(dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp index 4e24ddafa4..612369dad7 100644 --- a/protocols/MinecraftDynmap/src/communication.cpp +++ b/protocols/MinecraftDynmap/src/communication.cpp @@ -281,7 +281,7 @@ bool MinecraftDynmapProto::doEvents() // TODO: there are also "channel" and "account" elements if (!time_ || !playerName_ || !message_) { - debugLog(L"Error: No player name, time or text for message"); + debugLogW(L"Error: No player name, time or text for message"); continue; } @@ -289,7 +289,7 @@ bool MinecraftDynmapProto::doEvents() std::string name = playerName_.as_string(); std::string message = message_.as_string(); - debugLog(L"Received message: [%d] %s -> %s", timestamp, name.c_str(), message.c_str()); + debugLogW(L"Received message: [%d] %s -> %s", timestamp, name.c_str(), message.c_str()); UpdateChat(name.c_str(), message.c_str(), timestamp); } } diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index 3f8c6fc4c9..3a32f77553 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -64,7 +64,7 @@ static BOOL StoreDBCheckState(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, static void LoadDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { - ptrW tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting)); + ptrW tstr(db_get_wsa(NULL, ppro->m_szModuleName, szSetting)); if (tstr) SetDlgItemText(hwnd, idCtrl, tstr); } @@ -75,7 +75,7 @@ static void StoreDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr)); if (tstr[0] != '\0') { - db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr); + db_set_ws(NULL, ppro->m_szModuleName, szSetting, tstr); } else { db_unset(NULL, ppro->m_szModuleName, szSetting); } diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 7d2c845e55..147d9924a0 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -44,7 +44,7 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t // Create standard network connection wchar_t descr[512]; NETLIBUSER nlu = {sizeof(nlu)}; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; @@ -178,7 +178,7 @@ int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM) odp.hInstance = g_hInstance; 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.position = 271828; odp.pwszGroup = LPGENW("Network"); diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 73fc40ea11..3cc30faaaf 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -331,10 +331,10 @@ void OmegleProto::SetChatStatus(int status) if (status == ID_STATUS_ONLINE) { // Load actual name from database - facy.nick_ = db_get_tsa(NULL, m_szModuleName, OMEGLE_KEY_NAME); + facy.nick_ = db_get_wsa(NULL, m_szModuleName, OMEGLE_KEY_NAME); if (facy.nick_ == NULL) { facy.nick_ = mir_wstrdup(TranslateT("You")); - db_set_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_); + db_set_ws(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_); } // Add self contact diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 0e3abe9354..390de4c4cc 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -513,7 +513,7 @@ bool Omegle_client::events() } else if (name == "serverMessage") { ptrW message(json_as_string(json_at(item, 1))); - parent->UpdateChat(NULL, TranslateTS(message)); + parent->UpdateChat(NULL, TranslateW(message)); } else if (name == "connected") { // Stranger connected @@ -541,7 +541,7 @@ bool Omegle_client::events() likes += L", "; } - parent->debugLog(L"Got common likes: '%s'", likes.c_str()); + parent->debugLogW(L"Got common likes: '%s'", likes.c_str()); parent->SetTopic(likes.c_str()); } else if (name == "question") { @@ -557,7 +557,7 @@ bool Omegle_client::events() st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger")); - mir_snwprintf(st.tszText, TranslateT("%s is typing."), TranslateTS(who)); + mir_snwprintf(st.tszText, TranslateT("%s is typing."), TranslateW(who)); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } @@ -570,7 +570,7 @@ bool Omegle_client::events() st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger")); - mir_snwprintf(st.tszText, TranslateT("%s stopped typing."), TranslateTS(who)); + mir_snwprintf(st.tszText, TranslateT("%s stopped typing."), TranslateW(who)); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } @@ -615,7 +615,7 @@ bool Omegle_client::events() ptrW stranger(json_as_string(json_at(item, 1))); wchar_t strT[255]; - mir_snwprintf(strT, TranslateT("%s disconnected."), TranslateTS(stranger)); + mir_snwprintf(strT, TranslateT("%s disconnected."), TranslateW(stranger)); parent->UpdateChat(NULL, strT); // Stranger disconnected @@ -640,7 +640,7 @@ bool Omegle_client::events() ptrW error(json_as_string(json_at(item, 1))); wchar_t strT[255]; - mir_snwprintf(strT, TranslateT("Error: %s"), TranslateTS(error)); + mir_snwprintf(strT, TranslateT("Error: %s"), TranslateW(error)); parent->UpdateChat(NULL, strT); } } diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index 206f3af30e..259e34d2e8 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -38,7 +38,7 @@ static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const ch static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { - ptrW tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting)); + ptrW tstr(db_get_wsa(NULL, ppro->m_szModuleName, szSetting)); if (tstr) SetDlgItemText(hwnd, idCtrl, tstr); } @@ -49,7 +49,7 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr)); if (tstr[0] != '\0') { - db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr); + db_set_ws(NULL, ppro->m_szModuleName, szSetting, tstr); } else { db_unset(NULL, ppro->m_szModuleName, szSetting); diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index ee0b34a616..91d79f0d5f 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -44,7 +44,7 @@ PROTO(proto_name, username) // Create standard network connection wchar_t descr[512]; NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; @@ -57,10 +57,10 @@ PROTO(proto_name, username) facy.set_handle(m_hNetlibUser); - SkinAddNewSoundExT("StrangerTyp", m_tszUserName, LPGENW("Stranger is typing")); - SkinAddNewSoundExT("StrangerTypStop", m_tszUserName, LPGENW("Stranger stopped typing")); - SkinAddNewSoundExT("StrangerChange", m_tszUserName, LPGENW("Changing stranger")); - SkinAddNewSoundExT("StrangerMessage", m_tszUserName, LPGENW("Receive message")); + SkinAddNewSoundExW("StrangerTyp", m_tszUserName, LPGENW("Stranger is typing")); + SkinAddNewSoundExW("StrangerTypStop", m_tszUserName, LPGENW("Stranger stopped typing")); + SkinAddNewSoundExW("StrangerChange", m_tszUserName, LPGENW("Changing stranger")); + SkinAddNewSoundExW("StrangerMessage", m_tszUserName, LPGENW("Receive message")); } OmegleProto::~OmegleProto() @@ -183,7 +183,7 @@ int OmegleProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.hInstance = g_hInstance; 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.position = 271828; odp.pwszGroup = LPGENW("Network"); diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index dcf7aa0b27..585e74108e 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -27,12 +27,12 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch { GList *members, *mem; CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_on_invited() start"); + proto->debugLogW(L"mwServiceConf_on_invited() start"); members = mem = mwConference_getMembers(conf); for (;mem;mem=mem->next) { if (proto->my_login_info && strcmp(proto->my_login_info->login_id, ((mwLoginInfo*)mem->data)->login_id) == 0) { - proto->debugLog(L"mwServiceConf_on_invited() already present"); + proto->debugLogW(L"mwServiceConf_on_invited() already present"); mwConference_reject(conf, 0, T2Utf(TranslateT("Invitation rejected - already present."))); return; } @@ -46,11 +46,11 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch MultiByteToWideChar(CP_UTF8, 0, (const char*)invite, -1, ws_invite, 128); if (MessageBoxW(0, ws_invite, ws_username, MB_OKCANCEL) == IDOK) { - proto->debugLog(L"mwServiceConf_on_invited() mwConference_accept"); + proto->debugLogW(L"mwServiceConf_on_invited() mwConference_accept"); mwConference_accept(conf); } else { - proto->debugLog(L"mwServiceConf_on_invited() mwConference_reject"); + proto->debugLogW(L"mwServiceConf_on_invited() mwConference_reject"); char* temp = mir_utf8encodeW(TranslateT("Your invitation has been rejected.")); mwConference_reject(conf, 0, temp); mir_free(temp); @@ -59,7 +59,7 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch void CSametimeProto::ClearInviteQueue() { - debugLog(L"CSametimeProto::ClearInviteQueue() start"); + debugLogW(L"CSametimeProto::ClearInviteQueue() start"); if (!my_conference) return; @@ -106,7 +106,7 @@ void CSametimeProto::ClearInviteQueue() void mwServiceConf_conf_opened(mwConference* conf, GList* members) { CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_conf_opened() start"); + proto->debugLogW(L"mwServiceConf_conf_opened() start"); wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf)); wchar_t* tszConfTitle = mir_utf8decodeW(mwConference_getTitle(conf)); @@ -139,7 +139,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) GList *user = members; for (;user; user=user->next) { - proto->debugLog(L"mwServiceConf_conf_opened() add user"); + proto->debugLogW(L"mwServiceConf_conf_opened() add user"); wchar_t* tszUserName = mir_utf8decodeW(((mwLoginInfo*)user->data)->user_name); wchar_t* tszUserId = mir_utf8decodeW(((mwLoginInfo*)user->data)->login_id); @@ -171,7 +171,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) void mwServiceConf_conf_closed(mwConference* conf, guint32 reason) { CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_conf_closed() start"); + proto->debugLogW(L"mwServiceConf_conf_closed() start"); wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf)); @@ -191,7 +191,7 @@ void mwServiceConf_conf_closed(mwConference* conf, guint32 reason) void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user) { CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_on_peer_joined() start"); + proto->debugLogW(L"mwServiceConf_on_peer_joined() start"); MCONTACT hContact = proto->FindContactByUserId(user->user_id); if (!hContact) { @@ -235,7 +235,7 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user) void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user) { CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_on_peer_parted() start"); + proto->debugLogW(L"mwServiceConf_on_peer_parted() start"); ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf))); ptrW tszUserName(mir_utf8decodeW(user->user_name)); @@ -259,7 +259,7 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user) void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* what) { CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_on_text() start"); + proto->debugLogW(L"mwServiceConf_on_text() start"); wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf)); @@ -290,7 +290,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh void mwServiceConf_on_typing(mwConference* conf, mwLoginInfo* who, gboolean typing) { CSametimeProto* proto = getProtoFromMwConference(conf); - proto->debugLog(L"mwServiceConf_on_typing() start"); + proto->debugLogW(L"mwServiceConf_on_typing() start"); ///TODO unimplemented } @@ -312,7 +312,7 @@ mwConferenceHandler mwConference_handler = { void CSametimeProto::TerminateConference(char* name) { - debugLog(L"CSametimeProto::TerminateConference() start"); + debugLogW(L"CSametimeProto::TerminateConference() start"); GList *conferences, *conf; conferences = conf = mwServiceConference_getConferences(service_conference); @@ -346,17 +346,17 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { switch(gch->pDest->iType) { case GC_USER_MESSAGE: { - debugLog(L"CSametimeProto::GcEventHook() GC_USER_MESSAGE"); + debugLogW(L"CSametimeProto::GcEventHook() GC_USER_MESSAGE"); mwConference_sendText((mwConference*)conf->data, T2Utf(gch->ptszText)); } break; case GC_SESSION_TERMINATE: { if (my_conference == conf->data){ - debugLog(L"CSametimeProto::GcEventHook() GC_SESSION_TERMINATE CloseMyConference"); + debugLogW(L"CSametimeProto::GcEventHook() GC_SESSION_TERMINATE CloseMyConference"); CloseMyConference(this); } else { - debugLog(L"CSametimeProto::GcEventHook() GC_SESSION_TERMINATE mwConference_destroy"); + debugLogW(L"CSametimeProto::GcEventHook() GC_SESSION_TERMINATE mwConference_destroy"); mwConference_destroy((mwConference*)conf->data, 0, T2Utf(TranslateT("I'm outa here."))); } } @@ -378,7 +378,7 @@ int CSametimeProto::ChatDeleted(MCONTACT hContact) { if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0) return 0; - debugLog(L"CSametimeProto::ChatDeleted() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::ChatDeleted() hContact=[%x]", hContact); DBVARIANT dbv; if (!db_get_s(hContact, m_szModuleName, "ChatRoomID", &dbv)) { TerminateConference(dbv.pszVal); @@ -392,7 +392,7 @@ int CSametimeProto::ChatDeleted(MCONTACT hContact) { INT_PTR CSametimeProto::onMenuLeaveChat(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = (MCONTACT)wParam; - debugLog(L"CSametimeProto::onMenuLeaveChat() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::onMenuLeaveChat() hContact=[%x]", hContact); ChatDeleted(hContact); return 0; } @@ -401,7 +401,7 @@ INT_PTR CSametimeProto::onMenuLeaveChat(WPARAM wParam, LPARAM lParam) INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = (MCONTACT)wParam; - debugLog(L"CSametimeProto::onMenuCreateChat() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::onMenuCreateChat() hContact=[%x]", hContact); mwAwareIdBlock id_block; mwIdBlock idb; if (my_login_info && GetAwareIdFromContact(hContact, &id_block)) { @@ -416,12 +416,12 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) invite_queue.push(idb.user); if (!my_conference) { - debugLog(L"CSametimeProto::onMenuCreateChat() mwConference_open"); + debugLogW(L"CSametimeProto::onMenuCreateChat() mwConference_open"); my_conference = mwConference_new(service_conference, T2Utf(title)); mwConference_open(my_conference); } else { - debugLog(L"CSametimeProto::onMenuCreateChat() ClearInviteQueue"); + debugLogW(L"CSametimeProto::onMenuCreateChat() ClearInviteQueue"); ClearInviteQueue(); } @@ -434,7 +434,7 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = (MCONTACT)wParam; - debugLog(L"CSametimeProto::PrebuildContactMenu() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::PrebuildContactMenu() hContact=[%x]", hContact); Menu_ShowItem(hLeaveChatMenuItem, db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 1); @@ -463,7 +463,7 @@ int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) void CSametimeProto::InitConference() { - debugLog(L"CSametimeProto::InitConference()"); + debugLogW(L"CSametimeProto::InitConference()"); my_login_info = mwSession_getLoginInfo(session); @@ -476,7 +476,7 @@ void CSametimeProto::InitConference() void CSametimeProto::DeinitConference() { GList *conferences, *conf; - debugLog(L"CSametimeProto::DeinitConference()"); + debugLogW(L"CSametimeProto::DeinitConference()"); if (service_conference){ conferences = conf = mwServiceConference_getConferences(service_conference); @@ -500,13 +500,13 @@ void CSametimeProto::DeinitConference() void CSametimeProto::InitConferenceMenu() { - debugLog(L"CSametimeProto::InitConferenceMenu()"); + debugLogW(L"CSametimeProto::InitConferenceMenu()"); CreateProtoService(MS_SAMETIME_MENULEAVECHAT, &CSametimeProto::onMenuLeaveChat); CreateProtoService(MS_SAMETIME_MENUCREATECHAT, &CSametimeProto::onMenuCreateChat); CMenuItem mi; - mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; + mi.flags = CMIF_UNICODE | CMIF_NOTOFFLINE; SET_UID(mi, 0x98cf8a8c, 0x75ba, 0x46f2, 0xa3, 0x35, 0x65, 0x46, 0x4a, 0x38, 0x20, 0x7d); mi.name.w = LPGENW("Leave conference"); diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index c606e0587e..9f035200e4 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -13,11 +13,11 @@ CSametimeProto* getProtoFromMwFileTransfer(mwFileTransfer* ft) void mwFileTransfer_offered(mwFileTransfer* ft) { CSametimeProto* proto = getProtoFromMwFileTransfer(ft); - proto->debugLog(L"mwFileTransfer_offered() start"); + proto->debugLogW(L"mwFileTransfer_offered() start"); const mwIdBlock* idb = mwFileTransfer_getUser(ft); MCONTACT hContact = proto->FindContactByUserId(idb->user); - proto->debugLog(L"Sametime mwFileTransfer_offered hContact=[%x]", hContact); + proto->debugLogW(L"Sametime mwFileTransfer_offered hContact=[%x]", hContact); if (!hContact) { mwSametimeList* user_list = mwSametimeList_new(); @@ -39,7 +39,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft) wcsncpy_s(descriptionT, filenameT, _TRUNCATE); PROTORECVFILET pre = {0}; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = descriptionT; @@ -59,7 +59,7 @@ int SendFileChunk(CSametimeProto* proto, mwFileTransfer* ft, FileTransferClientD return 0; if (!ReadFile(ftcd->hFile, ftcd->buffer, FILE_BUFF_SIZE, &bytes_read, 0)) { - proto->debugLog(L"Sametime closing file transfer (SendFileChunk)"); + proto->debugLogW(L"Sametime closing file transfer (SendFileChunk)"); mwFileTransfer_close(ft, mwFileTransfer_SUCCESS); return 0; } @@ -79,7 +79,7 @@ void __cdecl SendThread(LPVOID param) { CSametimeProto* proto = getProtoFromMwFileTransfer(ft); FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); - proto->debugLog(L"SendThread() start"); + proto->debugLogW(L"SendThread() start"); PROTOFILETRANSFERSTATUS pfts = {0}; @@ -114,7 +114,7 @@ void __cdecl SendThread(LPVOID param) { if (ftcd->buffer) delete[] ftcd->buffer; delete ftcd; - proto->debugLog(L"SendThread() end"); + proto->debugLogW(L"SendThread() end"); return; } @@ -124,7 +124,7 @@ void mwFileTransfer_opened(mwFileTransfer* ft) CSametimeProto* proto = getProtoFromMwFileTransfer(ft); FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); - proto->debugLog(L"Sametime mwFileTransfer_opened start"); + proto->debugLogW(L"Sametime mwFileTransfer_opened start"); if (ftcd->sending) { // create a thread to send chunks - since it seems not all clients send acks for each of our chunks! @@ -139,7 +139,7 @@ void mwFileTransfer_closed(mwFileTransfer* ft, guint32 code) { CSametimeProto* proto = getProtoFromMwFileTransfer(ft); FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); - proto->debugLog(L"mwFileTransfer_closed() start"); + proto->debugLogW(L"mwFileTransfer_closed() start"); if (ftcd) { if (ftcd->hFile != INVALID_HANDLE_VALUE) @@ -217,14 +217,14 @@ void mwFileTransfer_recv(mwFileTransfer* ft, struct mwOpaque* data) { CSametimeProto* proto = getProtoFromMwFileTransfer(ft); FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); - proto->debugLog(L"mwFileTransfer_recv() start"); + proto->debugLogW(L"mwFileTransfer_recv() start"); DWORD bytes_written; if (!WriteFile(ftcd->hFile, data->data, data->len, &bytes_written, 0)) { - proto->debugLog(L"mwFileTransfer_recv() !WriteFile"); + proto->debugLogW(L"mwFileTransfer_recv() !WriteFile"); mwFileTransfer_cancel(ft); proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ftcd->hFt, 0); - proto->debugLog(L"mwFileTransfer_recv() ACKRESULT_FAILED"); + proto->debugLogW(L"mwFileTransfer_recv() ACKRESULT_FAILED"); } else { mwFileTransfer_ack(ft); // acknowledge chunk @@ -248,11 +248,11 @@ void mwFileTransfer_recv(mwFileTransfer* ft, struct mwOpaque* data) pfts.currentFileTime = 0; //? proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftcd->hFt, (LPARAM)&pfts); - proto->debugLog(L"mwFileTransfer_recv() ACKRESULT_DATA"); + proto->debugLogW(L"mwFileTransfer_recv() ACKRESULT_DATA"); if (mwFileTransfer_isDone(ft)) { proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ftcd->hFt, 0); - proto->debugLog(L"mwFileTransfer_recv() ACKRESULT_SUCCESS"); + proto->debugLogW(L"mwFileTransfer_recv() ACKRESULT_SUCCESS"); } } } @@ -265,7 +265,7 @@ void mwFileTransfer_handle_ack(mwFileTransfer* ft) // see SendThread above - not all clients send us acks CSametimeProto* proto = getProtoFromMwFileTransfer(ft); //FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); - proto->debugLog(L"mwFileTransfer_handle_ack()"); + proto->debugLogW(L"mwFileTransfer_handle_ack()"); } /** optional. called from mwService_free */ @@ -284,7 +284,7 @@ mwFileTransferHandler mwFileTransfer_handler = { HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const wchar_t* ptszDesc) { - debugLog(L"CSametimeProto::SendFilesToUser() start"); + debugLogW(L"CSametimeProto::SendFilesToUser() start"); mwAwareIdBlock id_block; if (GetAwareIdFromContact(hContact, &id_block)) { @@ -359,7 +359,7 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s mwFileTransfer* ft = (mwFileTransfer*)hFt; CSametimeProto* proto = getProtoFromMwFileTransfer(ft); - debugLog(L"CSametimeProto::AcceptFileTransfer() start"); + debugLogW(L"CSametimeProto::AcceptFileTransfer() start"); FileTransferClientData* ftcd = new FileTransferClientData; memset(ftcd, 0, sizeof(FileTransferClientData)); @@ -388,7 +388,7 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s ftcd->hFile = CreateFileA(fp, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, 0, 0); if (ftcd->hFile == INVALID_HANDLE_VALUE) { - debugLog(L"CSametimeProto::AcceptFileTransfer() INVALID_HANDLE_VALUE"); + debugLogW(L"CSametimeProto::AcceptFileTransfer() INVALID_HANDLE_VALUE"); mwFileTransfer_close(ft, mwFileTransfer_ERROR); return 0; } @@ -405,7 +405,7 @@ void CSametimeProto::RejectFileTransfer(HANDLE hFt) { mwFileTransfer* ft = (mwFileTransfer*)hFt; CSametimeProto* proto = getProtoFromMwFileTransfer(ft); - debugLog(L"CSametimeProto::RejectFileTransfer() start"); + debugLogW(L"CSametimeProto::RejectFileTransfer() start"); mwFileTransfer_reject(ft); } @@ -414,7 +414,7 @@ void CSametimeProto::CancelFileTransfer(HANDLE hFt) { mwFileTransfer* ft = (mwFileTransfer*)hFt; CSametimeProto* proto = getProtoFromMwFileTransfer(ft); - debugLog(L"CSametimeProto::CancelFileTransfer() start"); + debugLogW(L"CSametimeProto::CancelFileTransfer() start"); FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); @@ -429,13 +429,13 @@ void CSametimeProto::CancelFileTransfer(HANDLE hFt) void CSametimeProto::InitFiles() { - debugLog(L"CSametimeProto::InitFiles()"); + debugLogW(L"CSametimeProto::InitFiles()"); mwSession_addService(session, (mwService*)(service_files = mwServiceFileTransfer_new(session, &mwFileTransfer_handler))); } void CSametimeProto::DeinitFiles() { - debugLog(L"CSametimeProto::DeinitFiles()"); + debugLogW(L"CSametimeProto::DeinitFiles()"); mwSession_removeService(session, mwService_FILE_TRANSFER); mwService_free((mwService*)service_files); service_files = 0; diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index ee7cc4d659..039aac3cb5 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -12,13 +12,13 @@ CSametimeProto* getProtoFromMwConversation(mwConversation* conv) void mwIm_conversation_opened(mwConversation* conv) { CSametimeProto* proto = getProtoFromMwConversation(conv); - proto->debugLog(L"mwIm_conversation_opened() start"); + proto->debugLogW(L"mwIm_conversation_opened() start"); mwIdBlock* idb = mwConversation_getTarget(conv); MCONTACT hContact = proto->FindContactByUserId(idb->user); if (!hContact) { - proto->debugLog(L"mwIm_conversation_opened() !hContact"); + proto->debugLogW(L"mwIm_conversation_opened() !hContact"); mwSametimeList* user_list = mwSametimeList_new(); mwSametimeGroup* stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_NORMAL, Translate("None")); mwSametimeUser* stuser = mwSametimeUser_new(stgroup, mwSametimeUser_NORMAL, idb); @@ -45,7 +45,7 @@ void mwIm_conversation_opened(mwConversation* conv) void mwIm_conversation_closed(mwConversation* conv, guint32 err) { CSametimeProto* proto = getProtoFromMwConversation(conv); - proto->debugLog(L"mwIm_conversation_closed() start err=[%d]", err); + proto->debugLogW(L"mwIm_conversation_closed() start err=[%d]", err); if (err & ERR_FAILURE && err != CONNECTION_RESET) { proto->showPopup(err); @@ -67,11 +67,11 @@ void mwIm_conversation_closed(mwConversation* conv, guint32 err) void mwIm_conversation_recv(mwConversation* conv, mwImSendType type, gconstpointer msg) { CSametimeProto* proto = getProtoFromMwConversation(conv); - proto->debugLog(L"mwIm_conversation_recv() start"); + proto->debugLogW(L"mwIm_conversation_recv() start"); mwIdBlock* idb = mwConversation_getTarget(conv); MCONTACT hContact = proto->FindContactByUserId(idb->user); - proto->debugLog(L"mwIm_conversation_recv() type=[%d] hContact=[%x]", type, hContact); + proto->debugLogW(L"mwIm_conversation_recv() type=[%d] hContact=[%x]", type, hContact); if (type == mwImSend_TYPING) { CallService(MS_PROTO_CONTACTISTYPING, hContact, (GPOINTER_TO_UINT(msg) == 0 ? 0 : 2)); @@ -91,7 +91,7 @@ void mwIm_conversation_recv(mwConversation* conv, mwImSendType type, gconstpoint void mwIm_place_invite(struct mwConversation* conv, const char* message, const char* title, const char* name) { CSametimeProto* proto = getProtoFromMwConversation(conv); - proto->debugLog(L"mwIm_place_invite() start"); + proto->debugLogW(L"mwIm_place_invite() start"); ///TODO unimplemented @@ -114,7 +114,7 @@ mwImHandler mwIm_handler = { HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, const char *szMsg) { - debugLog(L"CSametimeProto::SendMessageToUser() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::SendMessageToUser() hContact=[%x]", hContact); mwAwareIdBlock id_block; if (GetAwareIdFromContact(hContact, &id_block)) { @@ -125,13 +125,13 @@ HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, const char *szMsg) mwConversation* conv = mwServiceIm_getConversation(service_im, &idb); if (conv) { if (!mwConversation_isOpen(conv)) { - debugLog(L"CSametimeProto::SendMessageToUser() mwConversation_isOpen"); + debugLogW(L"CSametimeProto::SendMessageToUser() mwConversation_isOpen"); mir_cslock lck(q_cs); contact_message_queue[hContact].push(szMsg); mwConversation_open(conv); } else { - debugLog(L"CSametimeProto::SendMessageToUser() !mwConversation_isOpen"); + debugLogW(L"CSametimeProto::SendMessageToUser() !mwConversation_isOpen"); mwConversation_send(conv, mwImSend_PLAIN, szMsg); } @@ -147,7 +147,7 @@ HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, const char *szMsg) void CSametimeProto::SendTyping(MCONTACT hContact, bool typing) { - debugLog(L"CSametimeProto::SendTyping() hContact=[%x] type=[%d]", hContact, typing); + debugLogW(L"CSametimeProto::SendTyping() hContact=[%x] type=[%d]", hContact, typing); mwAwareIdBlock id_block; if (GetAwareIdFromContact(hContact, &id_block)) { @@ -158,7 +158,7 @@ void CSametimeProto::SendTyping(MCONTACT hContact, bool typing) mwConversation* conv = mwServiceIm_getConversation(service_im, &idb); if (conv) { if (mwConversation_isOpen(conv)) { - debugLog(L"CSametimeProto::SendTyping() send"); + debugLogW(L"CSametimeProto::SendTyping() send"); mwConversation_send(conv, mwImSend_TYPING, (gconstpointer)GUINT_TO_POINTER(typing ? 1 : 0)); } } @@ -169,7 +169,7 @@ void CSametimeProto::SendTyping(MCONTACT hContact, bool typing) void CSametimeProto::CloseIm(MCONTACT hContact) { - debugLog(L"CSametimeProto::CloseIm() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::CloseIm() hContact=[%x]", hContact); mwAwareIdBlock id_block; if (GetAwareIdFromContact(hContact, &id_block)) { @@ -180,7 +180,7 @@ void CSametimeProto::CloseIm(MCONTACT hContact) mwConversation* conv = mwServiceIm_getConversation(service_im, &idb); if (conv) { if (mwConversation_isOpen(conv)) { - debugLog(L"CSametimeProto::CloseIm() mwConversation_close"); + debugLogW(L"CSametimeProto::CloseIm() mwConversation_close"); mwConversation_close(conv, 0); } } @@ -190,14 +190,14 @@ void CSametimeProto::CloseIm(MCONTACT hContact) void CSametimeProto::InitMessaging() { - debugLog(L"CSametimeProto::InitMessaging()"); + debugLogW(L"CSametimeProto::InitMessaging()"); mwSession_addService(session, (mwService*)(service_im = mwServiceIm_new(session, &mwIm_handler))); mwServiceIm_setClientType(service_im, mwImClient_PLAIN); } void CSametimeProto::DeinitMessaging() { - debugLog(L"CSametimeProto::DeinitMessaging()"); + debugLogW(L"CSametimeProto::DeinitMessaging()"); mwSession_removeService(session, mwService_IM); mwService_free((mwService*)service_im); service_im = 0; diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index c848ee911b..672b7e3d11 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -347,7 +347,7 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA int CSametimeProto::OptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTNET); odp.pwszTitle = m_tszUserName; @@ -410,9 +410,9 @@ void CSametimeProto::LoadOptions() if (options.err_method == ED_POP && !ServiceExists(MS_POPUP_SHOWMESSAGE)) options.err_method = ED_BAL; if (options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_MB; - debugLog(L"LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]", options.server_name == NULL ? -1 : mir_strlen(options.server_name), options.id == NULL ? -1 : mir_strlen(options.id), options.pword == NULL ? -1 : mir_strlen(options.pword)); - debugLog(L"LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]", options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor); - debugLog(L"LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]", options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method); + debugLogW(L"LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]", options.server_name == NULL ? -1 : mir_strlen(options.server_name), options.id == NULL ? -1 : mir_strlen(options.id), options.pword == NULL ? -1 : mir_strlen(options.pword)); + debugLogW(L"LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]", options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor); + debugLogW(L"LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]", options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method); } diff --git a/protocols/Sametime/src/places.cpp b/protocols/Sametime/src/places.cpp index 9bffaa9ac3..3a45fa6f67 100644 --- a/protocols/Sametime/src/places.cpp +++ b/protocols/Sametime/src/places.cpp @@ -54,13 +54,13 @@ mwPlaceHandler mwPlace_handler = { void CSametimeProto::InitPlaces(mwSession* session) { - debugLog(L"CSametimeProto::InitPlaces()"); + debugLogW(L"CSametimeProto::InitPlaces()"); mwSession_addService(session, (mwService*)(service_places = mwServicePlace_new(session, &mwPlace_handler))); } void CSametimeProto::DeinitPlaces(mwSession* session) { - debugLog(L"CSametimeProto::DeinitPlaces()"); + debugLogW(L"CSametimeProto::DeinitPlaces()"); mwSession_removeService(session, mwService_PLACE); mwService_free((mwService*)service_places); service_places = 0; diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 0a950bc123..f6baf48502 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -124,12 +124,12 @@ void __cdecl sttFakeAckInfoSuccessThread(void *param) { TFakeAckParams* tParam = (TFakeAckParams*)param; CSametimeProto* proto = tParam->proto; - proto->debugLog(L"sttFakeAckInfoSuccessThread() start"); + proto->debugLogW(L"sttFakeAckInfoSuccessThread() start"); Sleep(100); proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); - proto->debugLog(L"sttFakeAckInfoSuccessThread() end"); + proto->debugLogW(L"sttFakeAckInfoSuccessThread() end"); mir_free(tParam); } @@ -137,12 +137,12 @@ void __cdecl sttFakeAckMessageSuccessThread(void *param) { TFakeAckParams* tParam = (TFakeAckParams*)param; CSametimeProto* proto = tParam->proto; - proto->debugLog(L"sttFakeAckMessageSuccessThread() start"); + proto->debugLogW(L"sttFakeAckMessageSuccessThread() start"); Sleep(100); proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->lParam, 0); - proto->debugLog(L"sttFakeAckMessageSuccessThread() end"); + proto->debugLogW(L"sttFakeAckMessageSuccessThread() end"); mir_free(tParam); } @@ -150,12 +150,12 @@ void __cdecl sttFakeAckMessageFailedThread(void *param) { TFakeAckParams* tParam = (TFakeAckParams*)param; CSametimeProto* proto = tParam->proto; - proto->debugLog(L"sttFakeAckMessageFailedThread() start"); + proto->debugLogW(L"sttFakeAckMessageFailedThread() start"); Sleep(100); proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, tParam->lParam); ///TODO tParam->lParam: add error message - proto->debugLog(L"sttFakeAckMessageFailedThread() end"); + proto->debugLogW(L"sttFakeAckMessageFailedThread() end"); mir_free(tParam); } @@ -163,12 +163,12 @@ void __cdecl sttRecvAwayThread(void *param) { TFakeAckParams* tParam = (TFakeAckParams*)param; CSametimeProto* proto = tParam->proto; - proto->debugLog(L"sttRecvAwayThread() start"); + proto->debugLogW(L"sttRecvAwayThread() start"); Sleep(100); proto->UserRecvAwayMessage(tParam->hContact); - proto->debugLog(L"sttRecvAwayThread() end"); + proto->debugLogW(L"sttRecvAwayThread() end"); free(tParam); } @@ -223,7 +223,7 @@ int CSametimeProto::OnSametimeContactDeleted(WPARAM hContact, LPARAM) void CSametimeProto::SetAllOffline() { - debugLog(L"SetAllOffline() start"); + debugLogW(L"SetAllOffline() start"); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) { @@ -241,7 +241,7 @@ void CSametimeProto::BroadcastNewStatus(int iNewStatus) if (m_iStatus == iNewStatus) return; - debugLog(L"BroadcastNewStatus() m_iStatus=[%d], iNewStatus=[%d]", m_iStatus, iNewStatus); + debugLogW(L"BroadcastNewStatus() m_iStatus=[%d], iNewStatus=[%d]", m_iStatus, iNewStatus); previous_status = m_iStatus; m_iStatus = iNewStatus; diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index aa3981f62b..690636b4dd 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -18,13 +18,13 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS; + nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); RegisterGLibLogger(); - debugLog(L"CSametimeProto::CSametimeProto() start m_szModuleName=[%s], m_tszUserName=[%s]", _A2T(m_szModuleName), m_tszUserName); + debugLogW(L"CSametimeProto::CSametimeProto() start m_szModuleName=[%s], m_tszUserName=[%s]", _A2T(m_szModuleName), m_tszUserName); SametimeInitIcons(); @@ -58,17 +58,17 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN LoadOptions(); - debugLog(L"CSametimeProto::CSametimeProto() end"); + debugLogW(L"CSametimeProto::CSametimeProto() end"); } CSametimeProto::~CSametimeProto() { - debugLog(L"CSametimeProto::~CSametimeProto() start"); + debugLogW(L"CSametimeProto::~CSametimeProto() start"); DeinitAwayMsg(); UnregisterPopups(); - debugLog(L"CSametimeProto::~CSametimeProto() end"); + debugLogW(L"CSametimeProto::~CSametimeProto() end"); UnRegisterGLibLogger(); Netlib_CloseHandle(m_hNetlibUser); @@ -79,13 +79,13 @@ CSametimeProto::~CSametimeProto() MCONTACT CSametimeProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { MYPROTOSEARCHRESULT* sr = (MYPROTOSEARCHRESULT*)psr; - debugLog(L"CSametimeProto::AddToList() flags=[%d]", flags); + debugLogW(L"CSametimeProto::AddToList() flags=[%d]", flags); return AddSearchedUser(sr, flags & PALF_TEMPORARY); } HANDLE CSametimeProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath) { - debugLog(L"CSametimeProto::FileAllow() hContact=[%x], szPath=[%s]", hContact, szPath); + debugLogW(L"CSametimeProto::FileAllow() hContact=[%x], szPath=[%s]", hContact, szPath); char* szPathA = mir_u2a(szPath); HANDLE res = AcceptFileTransfer(hContact, hTransfer, szPathA); mir_free(szPathA); @@ -94,21 +94,21 @@ HANDLE CSametimeProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const wcha int CSametimeProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) { - debugLog(L"CSametimeProto::FileCancel() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::FileCancel() hContact=[%x]", hContact); CancelFileTransfer(hTransfer); return 0; } int CSametimeProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason) { - debugLog(L"CSametimeProto::FileDeny() hContact=[%x], szReason=[%s]", hContact, szReason); + debugLogW(L"CSametimeProto::FileDeny() hContact=[%x], szReason=[%s]", hContact, szReason); RejectFileTransfer(hTransfer); return 0; } int CSametimeProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename) { - debugLog(L"CSametimeProto::FileResume() action=[%d]", &action); + debugLogW(L"CSametimeProto::FileResume() action=[%d]", &action); return 0; } @@ -138,7 +138,7 @@ DWORD_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact) int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) { // GetInfo - retrieves a contact info - debugLog(L"CSametimeProto::GetInfo() hContact=[%x], infoType=[%d]", hContact, infoType); + debugLogW(L"CSametimeProto::GetInfo() hContact=[%x], infoType=[%d]", hContact, infoType); if (getByte(hContact, "ChatRoom", 0)) return 1; @@ -159,7 +159,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) HANDLE CSametimeProto::SearchBasic(const wchar_t* id) { - debugLog(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_wstrlen(id)); + debugLogW(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_wstrlen(id)); return (HANDLE)SearchForUser(T2Utf(id), FALSE); ///TODO - add timeout (like at GGPROTO::searchthread) } @@ -168,7 +168,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) { wchar_t buf[512]; if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) { - debugLog(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_wstrlen(buf)); + debugLogW(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_wstrlen(buf)); return (HWND)SearchForUser(T2Utf(buf), TRUE); } return NULL; @@ -176,14 +176,14 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) HWND CSametimeProto::CreateExtendedSearchUI(HWND owner) { - debugLog(L"CSametimeProto::CreateExtendedSearchUI() start"); + debugLogW(L"CSametimeProto::CreateExtendedSearchUI() start"); return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this); } int CSametimeProto::RecvFile(MCONTACT hContact, PROTORECVFILET* pre) { - debugLog(L"CSametimeProto::RecvFile() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::RecvFile() hContact=[%x]", hContact); db_unset(hContact, "CList", "Hidden"); db_unset(hContact, "CList", "NotOnList"); @@ -193,7 +193,7 @@ int CSametimeProto::RecvFile(MCONTACT hContact, PROTORECVFILET* pre) int CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) { - debugLog(L"CSametimeProto::RecvMsg() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::RecvMsg() hContact=[%x]", hContact); db_unset(hContact, "CList", "Hidden"); db_unset(hContact, "CList", "NotOnList"); @@ -203,7 +203,7 @@ int CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) HANDLE CSametimeProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles) { - debugLog(L"CSametimeProto::SendFile() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::SendFile() hContact=[%x]", hContact); if (m_iStatus != ID_STATUS_OFFLINE) { if (hContact && ppszFiles && szDescription) { if (db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { @@ -216,7 +216,7 @@ HANDLE CSametimeProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) { - debugLog(L"CSametimeProto::SendMsg() hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::SendMsg() hContact=[%x]", hContact); char *proto = GetContactProto(hContact); if (!proto || mir_strcmp(proto, m_szModuleName) != 0 || db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) { @@ -244,7 +244,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) int CSametimeProto::SetStatus(int iNewStatus) { - debugLog(L"CSametimeProto::SetStatus() m_iStatus=[%d], m_iDesiredStatus=[%d], iNewStatus=[%d]", m_iStatus, m_iDesiredStatus, iNewStatus); + debugLogW(L"CSametimeProto::SetStatus() m_iStatus=[%d], m_iDesiredStatus=[%d], iNewStatus=[%d]", m_iStatus, m_iDesiredStatus, iNewStatus); m_iDesiredStatus = iNewStatus; if (iNewStatus != ID_STATUS_OFFLINE) { if (m_iStatus == ID_STATUS_OFFLINE) @@ -261,7 +261,7 @@ int CSametimeProto::SetStatus(int iNewStatus) HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact) { - debugLog(L"CSametimeProto::GetInfo() hContact=[%x], m_iStatus=[%d]", hContact, m_iStatus); + debugLogW(L"CSametimeProto::GetInfo() hContact=[%x], m_iStatus=[%d]", hContact, m_iStatus); if (hContact && m_iStatus != ID_STATUS_OFFLINE) { TFakeAckParams* tfap; tfap = (TFakeAckParams*)malloc(sizeof(TFakeAckParams)); @@ -275,7 +275,7 @@ HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact) int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt) { - debugLog(L"CSametimeProto::RecvAwayMsg() hContact=[%x], mode=[%d]", hContact, mode); + debugLogW(L"CSametimeProto::RecvAwayMsg() hContact=[%x], mode=[%d]", hContact, mode); ptrW pszMsg(mir_utf8decodeW(evt->szMessage)); ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, pszMsg); @@ -284,14 +284,14 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt int CSametimeProto::SetAwayMsg(int iStatus, const wchar_t* msg) { - debugLog(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_wstrlen(msg)); + debugLogW(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_wstrlen(msg)); SetSessionAwayMessage(iStatus, msg); return 0; } int CSametimeProto::UserIsTyping(MCONTACT hContact, int type) { - debugLog(L"CSametimeProto::UserIsTyping() hContact=[%x], type=[%d]", hContact, type); + debugLogW(L"CSametimeProto::UserIsTyping() hContact=[%x], type=[%d]", hContact, type); SendTyping(hContact, type == PROTOTYPE_SELFTYPING_ON); return 0; } @@ -300,7 +300,7 @@ int CSametimeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lPa { switch (iEventType) { case EV_PROTO_ONOPTIONS: - debugLog(L"CSametimeProto::OnEvent() EV_PROTO_ONOPTIONS"); + debugLogW(L"CSametimeProto::OnEvent() EV_PROTO_ONOPTIONS"); OptInit(wParam, lParam); break; } diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index d9b8234596..f1f595d8a7 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -17,13 +17,13 @@ struct { void __cdecl SessionClear(mwSession* session) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionClear()"); + proto->debugLogW(L"SessionClear()"); } int __cdecl SessionWrite(mwSession* session, const unsigned char* buf, gsize len) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionWrite() server_connection=[%d], len=[%d]", proto->server_connection, len); + proto->debugLogW(L"SessionWrite() server_connection=[%d], len=[%d]", proto->server_connection, len); if (!proto->server_connection) return 1; if (Netlib_Send(proto->server_connection, (const char*)buf, len, 0) == SOCKET_ERROR) return 1; @@ -33,7 +33,7 @@ int __cdecl SessionWrite(mwSession* session, const unsigned char* buf, gsize len void __cdecl SessionClose(mwSession* session) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionClose() server_connection=[%d]", proto->server_connection); + proto->debugLogW(L"SessionClose() server_connection=[%d]", proto->server_connection); Netlib_CloseHandle(proto->server_connection); proto->server_connection = 0; } @@ -52,7 +52,7 @@ void CSametimeProto::SessionStopping() void CSametimeProto::InitMeanwhileServices() { - debugLog(L"InitMeanwhileServices() start"); + debugLogW(L"InitMeanwhileServices() start"); if (options.encrypt_session) { mwSession_addCipher(session, mwCipher_new_RC2_128(session)); @@ -77,7 +77,7 @@ void CSametimeProto::InitMeanwhileServices() void CSametimeProto::DeinitMeanwhileServices() { - debugLog(L"DeinitMeanwhileServices() start"); + debugLogW(L"DeinitMeanwhileServices() start"); DeinitConference(); DeinitFiles(); DeinitMessaging(); @@ -89,7 +89,7 @@ void CSametimeProto::DeinitMeanwhileServices() void __cdecl SessionStateChange(mwSession* session, mwSessionState state, gpointer info) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionStateChange() state=[%d]", state); + proto->debugLogW(L"SessionStateChange() state=[%d]", state); switch (state) { case mwSession_STARTING: @@ -136,7 +136,7 @@ void __cdecl SessionStateChange(mwSession* session, mwSessionState state, gpoint void __cdecl SessionAdmin(struct mwSession* session, const char* text) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionAdmin()"); + proto->debugLogW(L"SessionAdmin()"); wchar_t* tt = mir_utf8decodeW(text); MessageBox(0, tt, TranslateT("Sametime administrator message"), MB_OK); mir_free(tt); @@ -145,14 +145,14 @@ void __cdecl SessionAdmin(struct mwSession* session, const char* text) void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from, gboolean may_reply, const char* text) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionAnnounce()"); + proto->debugLogW(L"SessionAnnounce()"); wchar_t* stzFrom; wchar_t* stzText; wchar_t stzFromBuff[256]; stzFrom = mir_utf8decodeW(from->user_name); stzText = mir_utf8decodeW(text); mir_snwprintf(stzFromBuff, TranslateT("Session announcement - from '%s'"), stzFrom); - MessageBox(0, TranslateTS(stzText), stzFromBuff, MB_OK); + MessageBox(0, TranslateW(stzText), stzFromBuff, MB_OK); mir_free(stzText); mir_free(stzFrom); } @@ -160,7 +160,7 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from void __cdecl SessionSetPrivacyInfo(struct mwSession* session) { CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR"); - proto->debugLog(L"SessionSetPrivacyInfo()"); + proto->debugLogW(L"SessionSetPrivacyInfo()"); } void __cdecl SessionSetUserStatus(struct mwSession* session) @@ -171,7 +171,7 @@ void __cdecl SessionSetUserStatus(struct mwSession* session) struct mwUserStatus us; mwUserStatus_clone(&us, mwSession_getUserStatus(session)); - proto->debugLog(L"SessionSetUserStatus() us.status=[%d]", us.status); + proto->debugLogW(L"SessionSetUserStatus() us.status=[%d]", us.status); switch (us.status) { case mwStatus_ACTIVE: @@ -211,7 +211,7 @@ void __cdecl SessionSetUserStatus(struct mwSession* session) wchar_t buff[512]; mir_snwprintf(buff, TranslateT("Unknown user status: %d"), us.status); proto->showPopup(buff, SAMETIME_POPUP_ERROR); - proto->debugLog(buff); + proto->debugLogW(buff); mwUserStatus_clear(&us); // just go online...to prevent us getting stuck 'connecting' @@ -224,7 +224,7 @@ void __cdecl SessionSetUserStatus(struct mwSession* session) if (proto->first_online) { proto->first_online = false; //proto->showPopup(TranslateT("Setting login status"), SAMETIME_POPUP_INFO); - proto->debugLog(L"Setting login status"); + proto->debugLogW(L"Setting login status"); proto->SetSessionStatus(proto->login_status); } else proto->BroadcastNewStatus(new_status); @@ -241,7 +241,7 @@ void CSametimeProto::UpdateSelfStatus() int CSametimeProto::SetSessionStatus(int status) { struct mwUserStatus us; - debugLog(L"SetSessionStatus() start status=[%d]", status); + debugLogW(L"SetSessionStatus() start status=[%d]", status); if (idle_timerid) KillTimer(0, idle_timerid); @@ -271,7 +271,7 @@ int CSametimeProto::SetSessionStatus(int status) us.desc = AwayMessages.szOnline; us.status = mwStatus_ACTIVE; break; } - debugLog(L"SetSessionStatus() mwSession_setUserStatus us.status=[%d], us.desc:len=[%d]", us.status, us.desc == NULL ? -1 : mir_strlen(us.desc)); + debugLogW(L"SetSessionStatus() mwSession_setUserStatus us.status=[%d], us.desc:len=[%d]", us.status, us.desc == NULL ? -1 : mir_strlen(us.desc)); mwSession_setUserStatus(session, &us); return 0; @@ -297,7 +297,7 @@ VOID CALLBACK IdleTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime int CSametimeProto::SetIdle(bool idle) { // set a timer, to wait for any autoaway module which might set our status - debugLog(L"CSametimeProto::SetIdle() idle=[%d], idle_status=[%d], idle_timerid=[%d]", idle, idle_status, idle_timerid); + debugLogW(L"CSametimeProto::SetIdle() idle=[%d], idle_status=[%d], idle_timerid=[%d]", idle, idle_status, idle_timerid); if (idle && !idle_status) { idle_status = true; if (!idle_timerid) @@ -313,7 +313,7 @@ int CSametimeProto::SetIdle(bool idle) void CSametimeProto::SetSessionAwayMessage(int status, const wchar_t* msgT) { - debugLog(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_wstrlen(msgT)); + debugLogW(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_wstrlen(msgT)); T2Utf msg(msgT); if (status == ID_STATUS_ONLINE) @@ -345,7 +345,7 @@ void __cdecl KeepAliveThread(LPVOID param) { CSametimeProto* proto = (CSametimeProto*)param; int i = 120; - proto->debugLog(L"KeepAliveThread() start"); + proto->debugLogW(L"KeepAliveThread() start"); while (1) { @@ -363,7 +363,7 @@ void __cdecl KeepAliveThread(LPVOID param) mir_cslock lck(proto->session_cs); if (Miranda_Terminated() || !proto->session) { - proto->debugLog(L"KeepAliveThread() end"); + proto->debugLogW(L"KeepAliveThread() end"); break; } } @@ -380,7 +380,7 @@ void __cdecl SessionThread(LPVOID param) { CSametimeProto* proto = (CSametimeProto*)param; HANDLE hNetlibUser = proto->m_hNetlibUser; - proto->debugLog(L"SessionThread() start"); + proto->debugLogW(L"SessionThread() start"); continue_connect = true; @@ -406,7 +406,7 @@ void __cdecl SessionThread(LPVOID param) proto->showPopup(TranslateT("No server connection!"), SAMETIME_POPUP_ERROR); } - proto->debugLog(L"SessionThread() end, no server_connection, continue_connect=[%d]", continue_connect); + proto->debugLogW(L"SessionThread() end, no server_connection, continue_connect=[%d]", continue_connect); return; } @@ -436,7 +436,7 @@ void __cdecl SessionThread(LPVOID param) //while(session && server_connection && mwSession_getState(session) != mwSession_STOPPED) { while (proto->server_connection) {// && session) {// && !mwSession_isStopped(session)) { // break on error bytes = Netlib_Recv(proto->server_connection, (char *)recv_buffer, 1024 * 32, 0); - proto->debugLog(L"SessionThread() Netlib_Recv'ed bytes=[%d]", bytes); + proto->debugLogW(L"SessionThread() Netlib_Recv'ed bytes=[%d]", bytes); if (bytes == 0) { break; @@ -462,7 +462,7 @@ void __cdecl SessionThread(LPVOID param) proto->SetAllOffline(); proto->first_online = true; - proto->debugLog(L"SessionThread() end"); + proto->debugLogW(L"SessionThread() end"); return; } @@ -488,11 +488,11 @@ WORD CSametimeProto::GetServerVersion() int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser) { - debugLog(L"LogIn() start"); + debugLogW(L"LogIn() start"); mir_cslock lck(session_cs); if (session) { - debugLog(L"LogIn() end, currently in session"); + debugLogW(L"LogIn() end, currently in session"); return 0; } @@ -505,12 +505,12 @@ int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser) int CSametimeProto::LogOut() { - debugLog(L"LogOut() start"); + debugLogW(L"LogOut() start"); continue_connect = false; mir_cslock lck(session_cs); if (session && server_connection && m_iStatus != ID_STATUS_OFFLINE && !mwSession_isStopped(session) && !mwSession_isStopping(session)) { - debugLog(L"LogOut() mwSession_stop"); + debugLogW(L"LogOut() mwSession_stop"); mwSession_stop(session, 0); } @@ -519,15 +519,15 @@ int CSametimeProto::LogOut() int CSametimeProto::OnLogInRedirect(char* newHost) { - debugLog(L"OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]", newHost ? _A2T(newHost) : "(null)"); + debugLogW(L"OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]", newHost ? _A2T(newHost) : "(null)"); if (!newHost || !mir_strcmp(newHost, options.server_name) || db_get_b(0, m_szModuleName, "ForceLogin", 0) == 1) { - debugLog(L"OnLogInRedirect() forceLogin"); + debugLogW(L"OnLogInRedirect() forceLogin"); mwSession_forceLogin(session); return 0; } - debugLog(L"OnLogInRedirect() redirect"); + debugLogW(L"OnLogInRedirect() redirect"); mir_strcpy(options.server_name, newHost); LogOut(); Sleep(50); //wait for SessionThread end @@ -561,7 +561,7 @@ void SendAnnouncement(SendAnnouncementFunc_arg* arg) INT_PTR CSametimeProto::SessionAnnounce(WPARAM wParam, LPARAM lParam) { - debugLog(L"CSametimeProto::SessionAnnounce() start"); + debugLogW(L"CSametimeProto::SessionAnnounce() start"); SessionAnnounceDialogProc_arg* sadpArg = (SessionAnnounceDialogProc_arg*)mir_calloc(sizeof(SessionAnnounceDialogProc_arg)); sadpArg->proto = this; sadpArg->sendAnnouncementFunc = SendAnnouncement; @@ -571,12 +571,12 @@ INT_PTR CSametimeProto::SessionAnnounce(WPARAM wParam, LPARAM lParam) void CSametimeProto::InitSessionMenu() { - debugLog(L"CSametimeProto::InitSessionMenu()"); + debugLogW(L"CSametimeProto::InitSessionMenu()"); CreateProtoService(MS_SAMETIME_MENUANNOUNCESESSION, &CSametimeProto::SessionAnnounce); CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.position = 2000060000; mi.name.w = LPGENW("Send announcement..."); mi.pszService = MS_SAMETIME_MENUANNOUNCESESSION; diff --git a/protocols/Sametime/src/session_announce_win.cpp b/protocols/Sametime/src/session_announce_win.cpp index 03081b51c5..99b85c6bb3 100644 --- a/protocols/Sametime/src/session_announce_win.cpp +++ b/protocols/Sametime/src/session_announce_win.cpp @@ -14,7 +14,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); arg = (SessionAnnounceDialogProc_arg*)lParam; proto = arg->proto; - proto->debugLog(L"SessionAnnounceDialogProc WM_INITDIALOG"); + proto->debugLogW(L"SessionAnnounceDialogProc WM_INITDIALOG"); SendDlgItemMessage(hwndDlg, IDC_LST_ANTO, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); { @@ -55,7 +55,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara case WM_CLOSE: proto = arg->proto; - proto->debugLog(L"SessionAnnounceDialogProc WM_CLOSE"); + proto->debugLogW(L"SessionAnnounceDialogProc WM_CLOSE"); mir_free(arg); DestroyWindow(hwndDlg); break; @@ -79,7 +79,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara return 0; case IDOK: - proto->debugLog(L"SessionAnnounceDialogProc IDOK BN_CLICKED"); + proto->debugLogW(L"SessionAnnounceDialogProc IDOK BN_CLICKED"); { // build SendAnnouncementFunc_arg SendAnnouncementFunc_arg* safArg = (SendAnnouncementFunc_arg*)mir_calloc(sizeof(SendAnnouncementFunc_arg)); diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 4d65b377da..cb91800016 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -54,7 +54,7 @@ void CSametimeProto::AddGroup(const char* name, bool expanded) MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) { - debugLog(L"CSametimeProto::AddContact() start"); + debugLogW(L"CSametimeProto::AddContact() start"); const char* id = mwSametimeUser_getUser(user); const char* name = mwSametimeUser_getShortName(user); const char* nick = mwSametimeUser_getAlias(user); @@ -66,12 +66,12 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) if (!hContact) { hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (!hContact) { - debugLog(L"AddContact(): Failed to create Sametime contact"); + debugLogW(L"AddContact(): Failed to create Sametime contact"); return NULL; ///TODO error handling } if (Proto_AddToContact(hContact, m_szModuleName) != 0) { CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); - debugLog(L"AddContact(): Failed to register Sametime contact"); + debugLogW(L"AddContact(): Failed to register Sametime contact"); return NULL; ///TODO error handling } new_contact = true; @@ -125,7 +125,7 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) void CSametimeProto::ImportContactsFromList(mwSametimeList* user_list, bool temporary) { - debugLog(L"CSametimeProto::ImportContactsFromList() start"); + debugLogW(L"CSametimeProto::ImportContactsFromList() start"); // add contacts mwSametimeGroup* stgroup; mwSametimeUser* stuser; @@ -187,7 +187,7 @@ void CSametimeProto::ImportContactsFromList(mwSametimeList* user_list, bool temp void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) { - debugLog(L"CSametimeProto::ExportContactsToList() start"); + debugLogW(L"CSametimeProto::ExportContactsToList() start"); mwSametimeGroup* stgroup = 0; char* group_name; char* group_alias; @@ -300,7 +300,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) void CSametimeProto::ImportContactsFromFile(wchar_t* filename) { - debugLog(L"CSametimeProto::ImportContactsFromFile() start"); + debugLogW(L"CSametimeProto::ImportContactsFromFile() start"); std::ifstream in(filename); std::string text; std::string line; @@ -326,9 +326,9 @@ void CSametimeProto::ExportContactsToServer() mwPutBuffer* buff; mwOpaque* op; - debugLog(L"CSametimeProto::ExportContactsToServer() start"); + debugLogW(L"CSametimeProto::ExportContactsToServer() start"); if (MW_SERVICE_IS_DEAD(service_storage)) { - debugLog(L"CSametimeProto::ExportContactsToServer() Failed"); + debugLogW(L"CSametimeProto::ExportContactsToServer() Failed"); showPopup(TranslateT("Failed to upload contacts - storage service unavailable."), SAMETIME_POPUP_ERROR); return; } @@ -386,7 +386,7 @@ int CSametimeProto::ContactDeleted(MCONTACT hContact) if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) return 0; - debugLog(L"CSametimeProto::ContactDeleted()"); + debugLogW(L"CSametimeProto::ContactDeleted()"); if (GetAwareIdFromContact(hContact, &id_block)) { GList* gl = g_list_prepend(NULL, &id_block); @@ -580,7 +580,7 @@ mwAwareListHandler mwAwareList_handler = void CSametimeProto::UserListCreate() { - debugLog(L"CSametimeProto::UserListCreate() start"); + debugLogW(L"CSametimeProto::UserListCreate() start"); mwServiceAware_unsetAttribute(service_aware, mwAttribute_SPEAKERS); mwServiceAware_unsetAttribute(service_aware, mwAttribute_MICROPHONE); mwServiceAware_unsetAttribute(service_aware, mwAttribute_VIDEO_CAMERA); @@ -634,9 +634,9 @@ void CSametimeProto::UserListDestroy() void CSametimeProto::UserRecvAwayMessage(MCONTACT hContact) { - debugLog(L"CSametimeProto::UserRecvAwayMessage() start hContact=[%x]", hContact); + debugLogW(L"CSametimeProto::UserRecvAwayMessage() start hContact=[%x]", hContact); DBVARIANT dbv; - if (!db_get_s((MCONTACT)hContact, "CList", "StatusMsg", &dbv, DBVT_TCHAR)) { + if (!db_get_s((MCONTACT)hContact, "CList", "StatusMsg", &dbv, DBVT_WCHAR)) { ProtoBroadcastAck((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); db_free(&dbv); } @@ -765,7 +765,7 @@ INT_PTR CALLBACK CALLBACK SearchDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam MCONTACT CSametimeProto::AddSearchedUser(MYPROTOSEARCHRESULT* mpsr, bool temporary) { MCONTACT hContact = 0; - debugLog(L"CSametimeProto::AddSearchedUser() start"); + debugLogW(L"CSametimeProto::AddSearchedUser() start"); mwSametimeList* user_list = mwSametimeList_new(); mwSametimeGroup* stgroup = 0; if (mpsr->group) { @@ -799,7 +799,7 @@ void mwServiceAware_clear_callback(mwServiceAware* srvc) void CSametimeProto::InitUserList() { - debugLog(L"CSametimeProto::InitUserList()"); + debugLogW(L"CSametimeProto::InitUserList()"); mwSession_addService(session, (mwService*)(service_storage = mwServiceStorage_new(session))); mwSession_addService(session, (mwService*)(service_resolve = mwServiceResolve_new(session))); @@ -813,7 +813,7 @@ void CSametimeProto::InitUserList() void CSametimeProto::DeinitUserList() { - debugLog(L"CSametimeProto::DeinitUserList()"); + debugLogW(L"CSametimeProto::DeinitUserList()"); mwSession_removeService(session, mwService_AWARE); mwService_free((mwService*)service_aware); diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index f876860fc0..7bbc3ff804 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -32,12 +32,12 @@ void CSametimeProto::RegisterPopups() wchar_t szDescr[256]; char szName[256]; - debugLog(L"CSametimeProto::RegisterPopups()"); + debugLogW(L"CSametimeProto::RegisterPopups()"); POPUPCLASS puc = { sizeof(puc) }; puc.PluginWindowProc = PopupWindowProc; puc.flags = PCF_TCHAR; - puc.ptszDescription = szDescr; + puc.pwszDescription = szDescr; puc.pszName = szName; mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify"); @@ -62,7 +62,7 @@ void CSametimeProto::RegisterPopups() void CSametimeProto::UnregisterPopups() { - debugLog(L"CSametimeProto::RegisterPopups()"); + debugLogW(L"CSametimeProto::RegisterPopups()"); Popup_UnregisterClass(hPopupError); Popup_UnregisterClass(hPopupNotify); } @@ -144,10 +144,10 @@ void CSametimeProto::showPopup(guint32 code) SametimePopupEnum flag = (rcDesc->type == mwReturnCodeError ? SAMETIME_POPUP_ERROR : SAMETIME_POPUP_INFO); wchar_t buff[512]; - mir_snwprintf(buff, TranslateT("%s\n\nSametime error %S\n%s"), TranslateTS(_A2T(rcDesc->name)), rcDesc->codeString, TranslateTS(_A2T(rcDesc->description))); + mir_snwprintf(buff, TranslateT("%s\n\nSametime error %S\n%s"), TranslateW(_A2T(rcDesc->name)), rcDesc->codeString, TranslateW(_A2T(rcDesc->description))); showPopup(buff, flag); - debugLog(buff); + debugLogW(buff); g_free(rcDesc->codeString); g_free(rcDesc->name); @@ -158,17 +158,17 @@ void CSametimeProto::showPopup(guint32 code) void LogFromGLib(const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer user_data) { CSametimeProto* proto = (CSametimeProto*)user_data; - proto->debugLog(_A2T(message)); + proto->debugLogW(_A2T(message)); } void CSametimeProto::RegisterGLibLogger() { - debugLog(L"CSametimeProto::RegisterGLibLogger"); + debugLogW(L"CSametimeProto::RegisterGLibLogger"); gLogHandler = g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_MASK, LogFromGLib, this); } void CSametimeProto::UnRegisterGLibLogger() { - debugLog(L"CSametimeProto::UnRegisterGLibLogger"); + debugLogW(L"CSametimeProto::UnRegisterGLibLogger"); if (gLogHandler) g_log_remove_handler(G_LOG_DOMAIN, gLogHandler); } diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 0c780094ff..361f145e11 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -127,11 +127,11 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARSW(L"%miranda_avatarcache%"), m_tszUserName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CreateDirectoryTreeT(pszDest); + CreateDirectoryTreeW(pszDest); pszDest[tPathLen++] = '\\'; @@ -142,9 +142,9 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", username.c_str(), szFileType); } -void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) +void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMStringW &tszUrl) { - ptrW oldUrl(getTStringA(hContact, "AvatarUrl")); + ptrW oldUrl(getWStringA(hContact, "AvatarUrl")); if (oldUrl != NULL) if (tszUrl == oldUrl) return; @@ -154,7 +154,7 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0); } else { - setTString(hContact, "AvatarUrl", tszUrl.GetBuffer()); + setWString(hContact, "AvatarUrl", tszUrl.GetBuffer()); setByte(hContact, "NeedNewAvatar", 1); PROTO_AVATAR_INFORMATION ai = { 0 }; ai.hContact = hContact; diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 6916ad1c35..35e40e9045 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -116,7 +116,7 @@ void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response) if (!conversation["lastMessage"]) continue; - CMString topic(threadProperties["topic"].as_mstring()); + CMStringW topic(threadProperties["topic"].as_mstring()); SendRequest(new GetChatInfoRequest(id.as_string().c_str(), li), &CSkypeProto::OnGetChatInfo, topic.Detach()); } } @@ -153,10 +153,10 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) hContact = AddContact(_T2A(gch->ptszUID), true); setWord(hContact, "Status", ID_STATUS_ONLINE); db_set_b(hContact, "CList", "Hidden", 1); - setTString(hContact, "Nick", gch->ptszUID); + setWString(hContact, "Nick", gch->ptszUID); db_set_dw(hContact, "Ignore", "Mask1", 0); } - CallService(MS_MSG_SENDMESSAGET, hContact, 0); + CallService(MS_MSG_SENDMESSAGEW, hContact, 0); break; } @@ -184,7 +184,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) OnLeaveChatRoom(FindChatRoom(chat_id), NULL); break; case 30: - CMString newTopic = ChangeTopicForm(); + CMStringW newTopic = ChangeTopicForm(); if (!newTopic.IsEmpty()) SendRequest(new SetChatPropertiesRequest(chat_id, "topic", T2Utf(newTopic.GetBuffer()), li)); break; @@ -232,7 +232,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) gce.time = time(NULL); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); - db_set_ts(FindChatRoom(chat_id), "UsersNicks", _T2A(gch->ptszUID), pForm.ptszResult); + db_set_ws(FindChatRoom(chat_id), "UsersNicks", _T2A(gch->ptszUID), pForm.ptszResult); break; @@ -248,8 +248,8 @@ INT_PTR CSkypeProto::OnJoinChatRoom(WPARAM hContact, LPARAM) { if (hContact) { - ptrW idT(getTStringA(hContact, "ChatRoomID")); - ptrW nameT(getTStringA(hContact, "Nick")); + ptrW idT(getWStringA(hContact, "ChatRoomID")); + ptrW nameT(getWStringA(hContact, "Nick")); StartChatRoom(idT, nameT != NULL ? nameT : idT); } return 0; @@ -261,7 +261,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) return 1; if (hContact && IDYES == MessageBox(NULL, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION)) { - ptrW idT(getTStringA(hContact, "ChatRoomID")); + ptrW idT(getWStringA(hContact, "ChatRoomID")); GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL }; gcd.ptszID = idT; @@ -287,7 +287,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) CMStringA szConversationName(UrlToSkypename(node["conversationLink"].as_string().c_str())); CMStringA szFromSkypename(UrlToSkypename(node["from"].as_string().c_str())); - CMString szTopic(node["threadtopic"].as_mstring()); + CMStringW szTopic(node["threadtopic"].as_mstring()); time_t timestamp = IsoToUnixTime(node["composetime"].as_string().c_str()); @@ -448,7 +448,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, gce.time = timestamp; gce.ptszUID = from; - CMString tszText(ptrW(mir_utf8decodeW(content))); + CMStringW tszText(ptrW(mir_utf8decodeW(content))); tszText.Replace(L"%", L"%%"); if (!isAction) @@ -542,7 +542,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const return; ptrW tnick(mir_a2u_cp(name, CP_UTF8)); - if (wchar_t *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id)) + if (wchar_t *tmp = db_get_wsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id)) tnick = tmp; ptrW tid(mir_a2u(id)); @@ -555,7 +555,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const gce.ptszUID = tid; gce.time = !isChange ? time(NULL) : NULL; gce.bIsMe = IsMe(id); - gce.ptszStatus = TranslateTS(role); + gce.ptszStatus = TranslateW(role); CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); } @@ -653,13 +653,13 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) return 0; } -CMString CSkypeProto::ChangeTopicForm() +CMStringW CSkypeProto::ChangeTopicForm() { - CMString caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName), TranslateT("Enter new chatroom topic")); + CMStringW caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName), TranslateT("Enter new chatroom topic")); ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; pForm.caption = caption; pForm.ptszInitVal = NULL; pForm.szModuleName = m_szModuleName; - return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult)); + return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult)); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index bbe4765ca7..38bc23ecc5 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -46,7 +46,7 @@ void CSkypeProto::SetAllContactsStatus(WORD status) void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus) { - ptrW tszChatID(getTStringA(hContact, "ChatRoomID")); + ptrW tszChatID(getWStringA(hContact, "ChatRoomID")); if (tszChatID == NULL) return; GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL }; @@ -95,9 +95,9 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) setString(hContact, SKYPE_SETTINGS_ID, skypename); DBVARIANT dbv; - if (!getTString(SKYPE_SETTINGS_GROUP, &dbv)) + if (!getWString(SKYPE_SETTINGS_GROUP, &dbv)) { - db_set_ts(hContact, "CList", "Group", dbv.ptszVal); + db_set_ws(hContact, "CList", "Group", dbv.ptszVal); db_free(&dbv); } @@ -206,10 +206,10 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) const JSONNode &phones = item["phones"]; std::string skypename = item["id"].as_string(); - CMString display_name = item["display_name"].as_mstring(); - CMString first_name = name["first"].as_mstring(); - CMString last_name = name["surname"].as_mstring(); - CMString avatar_url = item["avatar_url"].as_mstring(); + CMStringW display_name = item["display_name"].as_mstring(); + CMStringW first_name = name["first"].as_mstring(); + CMStringW last_name = name["surname"].as_mstring(); + CMStringW avatar_url = item["avatar_url"].as_mstring(); std::string type = item["type"].as_string(); if (type == "skype" || loadAll) @@ -243,11 +243,11 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) setString(hContact, "Type", type.c_str()); if (display_name) - setTString(hContact, "Nick", display_name); + setWString(hContact, "Nick", display_name); if (first_name) - setTString(hContact, "FirstName", first_name); + setWString(hContact, "FirstName", first_name); if (last_name) - setTString(hContact, "LastName", last_name); + setWString(hContact, "LastName", last_name); if (item["mood"]) { @@ -263,15 +263,15 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) if (!phone) break; - CMString number = phone["number"].as_mstring(); + CMStringW number = phone["number"].as_mstring(); switch (phone["type"].as_int()) { case 0: - setTString(hContact, "Phone", number); + setWString(hContact, "Phone", number); break; case 2: - setTString(hContact, "Cellular", number); + setWString(hContact, "Cellular", number); break; } } diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 227661c944..cb9a8bf3bb 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -173,7 +173,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) switch(pEvent->datatype) { - case DBVT_TCHAR: + case DBVT_WCHAR: { return (INT_PTR)mir_a2u(szText); } diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 8ad180448e..c03a048f7d 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -61,7 +61,7 @@ void CSkypeProto::InitMenus() //hChooserMenu = Menu_AddObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose"); CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; // Request authorization mi.pszService = MODULE"/RequestAuth"; diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index f4a42e2f2b..3ee550dd21 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -295,7 +295,7 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const psr[nCount] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT)); psr[nCount]->cbSize = sizeof(psr); - psr[nCount]->flags = PSR_TCHAR; + psr[nCount]->flags = PSR_UNICODE; psr[nCount]->id.w = mir_wstrdup(tszContactId); //psr[nCount]->nick.w = mir_wstrdup(tszContactName == NULL ? L"" : tszContactName); nCount++; diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp index 976cf98d77..1986d2475f 100644 --- a/protocols/SkypeWeb/src/skype_mslogin.cpp +++ b/protocols/SkypeWeb/src/skype_mslogin.cpp @@ -174,13 +174,13 @@ void CSkypeProto::OnMSLoginEnd(const NETLIBHTTPREQUEST *response) OnLoginSuccess(); } -CMString CSkypeProto::RunConfirmationCode() +CMStringW CSkypeProto::RunConfirmationCode() { - CMString caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName), TranslateT("Enter confirmation code")); + CMStringW caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName), TranslateT("Enter confirmation code")); ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_PASSWORD; pForm.caption = caption; pForm.ptszInitVal = NULL; pForm.szModuleName = m_szModuleName; - return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult)); + return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult)); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp index 1442140613..51ddd963f8 100644 --- a/protocols/SkypeWeb/src/skype_network.cpp +++ b/protocols/SkypeWeb/src/skype_network.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . void CSkypeProto::InitNetwork() { - CMString name(FORMAT, TranslateT("%s connection"), m_tszUserName); + CMStringW name(FORMAT, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index dafd60ebf2..b6ce46f0c5 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -73,7 +73,7 @@ int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInstance; odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszGroup = LPGENW("Network"); odp.pwszTab = LPGENW("Account"); diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 6cc8c44cd6..810491c807 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -9,7 +9,7 @@ void CSkypeProto::InitPopups() mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = GetIcon(IDI_NOTIFY); ppc.colorBack = RGB(255, 255, 255); @@ -19,7 +19,7 @@ void CSkypeProto::InitPopups() 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 = GetIcon(IDI_ERRORICON); ppc.colorBack = RGB(255, 255, 255); @@ -29,7 +29,7 @@ void CSkypeProto::InitPopups() mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls")); mir_snprintf(name, "%s_%s", m_szModuleName, "Call"); - ppc.ptszDescription = desc; + ppc.pwszDescription = desc; ppc.pszName = name; ppc.hIcon = GetIcon(IDI_CALL); ppc.colorBack = RGB(255, 255, 255); diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index ac9b4d6a9b..832a8f60b7 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -245,40 +245,40 @@ void CSkypeProto::InitLanguages() void CSkypeProto::UpdateProfileFirstName(const JSONNode &root, MCONTACT hContact) { - CMString firstname = root["firstname"].as_mstring(); + CMStringW firstname = root["firstname"].as_mstring(); if (!firstname.IsEmpty() && firstname != "null") - setTString(hContact, "FirstName", firstname); + setWString(hContact, "FirstName", firstname); else delSetting(hContact, "FirstName"); } void CSkypeProto::UpdateProfileLastName(const JSONNode &root, MCONTACT hContact) { - CMString lastname = root["lastname"].as_mstring(); + CMStringW lastname = root["lastname"].as_mstring(); if (!lastname.IsEmpty() && lastname != "null") - setTString(hContact, "LastName", lastname); + setWString(hContact, "LastName", lastname); else delSetting(hContact, "LastName"); } void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hContact) { - ptrW firstname(getTStringA(hContact, "FirstName")); - ptrW lastname(getTStringA(hContact, "LastName")); + ptrW firstname(getWStringA(hContact, "FirstName")); + ptrW lastname(getWStringA(hContact, "LastName")); if (firstname) { - CMString nick(firstname); + CMStringW nick(firstname); if (lastname) nick.AppendFormat(L" %s", lastname); - setTString(hContact, "Nick", nick); + setWString(hContact, "Nick", nick); } else if (lastname) - setTString(hContact, "Nick", lastname); + setWString(hContact, "Nick", lastname); else { const JSONNode &node = root["displayname"]; - CMString displayname((!node) ? root["username"].as_mstring() : node.as_mstring()); + CMStringW displayname((!node) ? root["username"].as_mstring() : node.as_mstring()); if (!displayname.IsEmpty() && displayname != "null") - setTString(hContact, "Nick", displayname); + setWString(hContact, "Nick", displayname); else delSetting(hContact, "Nick"); } @@ -286,7 +286,7 @@ void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hConta void CSkypeProto::UpdateProfileGender(const JSONNode &root, MCONTACT hContact) { - CMString gender = root["gender"].as_mstring(); + CMStringW gender = root["gender"].as_mstring(); if (!gender.IsEmpty() && gender != "null") setByte(hContact, "Gender", (BYTE)(_wtoi(gender) == 1 ? 'M' : 'F')); else @@ -295,7 +295,7 @@ void CSkypeProto::UpdateProfileGender(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact) { - CMString birthday = root["birthday"].as_mstring(); + CMStringW birthday = root["birthday"].as_mstring(); if (!birthday.IsEmpty() && birthday != "null") { int d, m, y; @@ -325,45 +325,45 @@ void CSkypeProto::UpdateProfileCountry(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileState(const JSONNode &root, MCONTACT hContact) { - CMString province = root["province"].as_mstring(); + CMStringW province = root["province"].as_mstring(); if (!province.IsEmpty() && province != "null") - setTString(hContact, "State", province); + setWString(hContact, "State", province); else delSetting(hContact, "State"); } void CSkypeProto::UpdateProfileCity(const JSONNode &root, MCONTACT hContact) { - CMString city = root["city"].as_mstring(); + CMStringW city = root["city"].as_mstring(); if (!city.IsEmpty() && city != "null") - setTString(hContact, "City", city); + setWString(hContact, "City", city); else delSetting(hContact, "City"); } void CSkypeProto::UpdateProfileLanguage(const JSONNode &root, MCONTACT hContact) { - CMString isocode = root["language"].as_mstring(); + CMStringW isocode = root["language"].as_mstring(); if (!isocode.IsEmpty() && isocode != "null") - setTString(hContact, "Language0", languages[isocode.GetBuffer()].c_str()); + setWString(hContact, "Language0", languages[isocode.GetBuffer()].c_str()); else delSetting(hContact, "Language0"); } void CSkypeProto::UpdateProfileHomepage(const JSONNode &root, MCONTACT hContact) { - CMString homepage = root["homepage"].as_mstring(); + CMStringW homepage = root["homepage"].as_mstring(); if (!homepage.IsEmpty() && homepage != "null") - setTString(hContact, "Homepage", homepage); + setWString(hContact, "Homepage", homepage); else delSetting(hContact, "Homepage"); } void CSkypeProto::UpdateProfileAbout(const JSONNode &root, MCONTACT hContact) { - CMString about = root["about"].as_mstring(); + CMStringW about = root["about"].as_mstring(); if (!about.IsEmpty() && about != "null") - setTString(hContact, "About", about); + setWString(hContact, "About", about); else delSetting(hContact, "About"); } @@ -381,7 +381,7 @@ void CSkypeProto::UpdateProfileEmails(const JSONNode &root, MCONTACT hContact) break; CMStringA name(FORMAT, "e-mail%d", i); - setTString(hContact, name, item.as_mstring()); + setWString(hContact, name, item.as_mstring()); } } else @@ -394,43 +394,43 @@ void CSkypeProto::UpdateProfileEmails(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfilePhoneMobile(const JSONNode &root, MCONTACT hContact) { - CMString province = root["phoneMobile"].as_mstring(); + CMStringW province = root["phoneMobile"].as_mstring(); if (!province.IsEmpty() && province != "null") - setTString(hContact, "Cellular", province); + setWString(hContact, "Cellular", province); else delSetting(hContact, "Cellular"); } void CSkypeProto::UpdateProfilePhoneHome(const JSONNode &root, MCONTACT hContact) { - CMString province = root["phone"].as_mstring(); + CMStringW province = root["phone"].as_mstring(); if (!province.IsEmpty() && province != "null") - setTString(hContact, "Phone", province); + setWString(hContact, "Phone", province); else delSetting(hContact, "Phone"); } void CSkypeProto::UpdateProfilePhoneOffice(const JSONNode &root, MCONTACT hContact) { - CMString province = root["phoneOffice"].as_mstring(); + CMStringW province = root["phoneOffice"].as_mstring(); if (!province.IsEmpty() && province != "null") - setTString(hContact, "CompanyPhone", province); + setWString(hContact, "CompanyPhone", province); else delSetting(hContact, "CompanyPhone"); } void CSkypeProto::UpdateProfileXStatusMessage(const JSONNode &root, MCONTACT hContact) { - CMString province = root["richMood"].as_mstring(); + CMStringW province = root["richMood"].as_mstring(); if (!province.IsEmpty() && province != "null") - setTString(hContact, "XStatusMsg", province); + setWString(hContact, "XStatusMsg", province); else delSetting(hContact, "XStatusMsg"); } void CSkypeProto::UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact) { - CMString province = root["avatarUrl"].as_mstring(); + CMStringW province = root["avatarUrl"].as_mstring(); if (!province.IsEmpty() && province != "null") { SetAvatarUrl(hContact, province); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index b496e4c2d7..1d5b85e89e 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -42,10 +42,10 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE); CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP); - m_tszAvatarFolder = std::wstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName; + m_tszAvatarFolder = std::wstring(VARSW(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()); + CreateDirectoryTreeW(m_tszAvatarFolder.c_str()); //sounds SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound")); @@ -131,7 +131,7 @@ HANDLE CSkypeProto::GetAwayMsg(MCONTACT hContact) if (JSONNode &mood = root["mood"]) { - CMString str = mood.as_mstring(); + CMStringW str = mood.as_mstring(); this->ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)str.c_str()); } this->ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 37320a43d6..964bbc1ac5 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -280,7 +280,7 @@ private: void SetContactStatus(MCONTACT hContact, WORD status); void SetAllContactsStatus(WORD status); - void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl); + void SetAvatarUrl(MCONTACT hContact, CMStringW &tszUrl); void ReloadAvatarInfo(MCONTACT hContact); void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen); @@ -408,8 +408,8 @@ private: //---/ time_t GetLastMessageTime(MCONTACT hContact); - CMString RunConfirmationCode(); - CMString ChangeTopicForm(); + CMStringW RunConfirmationCode(); + CMStringW ChangeTopicForm(); void CloseDialogs(); //events void InitDBEvents(); diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 0f9506ad6c..bc82399167 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -212,7 +212,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact)); cle.pszService = service.GetBuffer(); - CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + CMStringW tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = tooltip.GetBuffer(); pcli->pfnAddEvent(&cle); diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 0ebd7d1c8b..2faa102476 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -3,11 +3,11 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact) { wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CreateDirectoryTreeT(path); + CreateDirectoryTreeW(path); ptrA steamId(getStringA(hContact, "SteamID")); if (steamId != NULL) diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 1477b2d19f..a6a8c0668e 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -14,7 +14,7 @@ void CSteamProto::SetContactStatus(MCONTACT hContact, WORD status) { // Contact is looking to play, save it to as status message if (hContact) - db_set_ts(hContact, "CList", "StatusMsg", TranslateT("Looking to play")); + db_set_ws(hContact, "CList", "StatusMsg", TranslateT("Looking to play")); } break; @@ -22,7 +22,7 @@ void CSteamProto::SetContactStatus(MCONTACT hContact, WORD status) { // Contact is looking to trade, save it to as status message if (hContact) - db_set_ts(hContact, "CList", "StatusMsg", TranslateT("Looking to trade")); + db_set_ws(hContact, "CList", "StatusMsg", TranslateT("Looking to trade")); } break; @@ -98,7 +98,7 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) { // set common data JSONNode *node = json_get(data, "personaname"); - setTString(hContact, "Nick", ptrW(json_as_string(node))); + setWString(hContact, "Nick", ptrW(json_as_string(node))); node = json_get(data, "profileurl"); setString(hContact, "Homepage", _T2A(ptrW(json_as_string(node)))); @@ -116,12 +116,12 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) size_t pos = realname.find(L' ', 1); if (pos != std::wstring::npos) { - setTString(hContact, "FirstName", realname.substr(0, pos).c_str()); - setTString(hContact, "LastName", realname.substr(pos + 1).c_str()); + setWString(hContact, "FirstName", realname.substr(0, pos).c_str()); + setWString(hContact, "LastName", realname.substr(pos + 1).c_str()); } else { - setTString(hContact, "FirstName", realname.c_str()); + setWString(hContact, "FirstName", realname.c_str()); delSetting(hContact, "LastName"); } } @@ -186,23 +186,23 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) // nothing special, either standard client or in different status (only online, I want to play, I want to trade statuses support this flags) WORD status = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (status == ID_STATUS_ONLINE || status == ID_STATUS_OUTTOLUNCH || status == ID_STATUS_FREECHAT) - setTString(hContact, "MirVer", L"Steam"); + setWString(hContact, "MirVer", L"Steam"); } else if (stateflags & 2) { // game - setTString(hContact, "MirVer", L"Steam (in game)"); + setWString(hContact, "MirVer", L"Steam (in game)"); } else if (stateflags & 256) { // on website - setTString(hContact, "MirVer", L"Steam (website)"); + setWString(hContact, "MirVer", L"Steam (website)"); } else if (stateflags & 512) { // on mobile - setTString(hContact, "MirVer", L"Steam (mobile)"); + setWString(hContact, "MirVer", L"Steam (mobile)"); } else if (stateflags & 1024) { // big picture mode - setTString(hContact, "MirVer", L"Steam (Big Picture)"); + setWString(hContact, "MirVer", L"Steam (Big Picture)"); } else { // none/unknown (e.g. when contact is offline) @@ -228,15 +228,15 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) setString(hContact, "ServerIP", _T2A(serverIP)); setString(hContact, "ServerID", _T2A(serverID)); - CMString message(gameInfo); + CMStringW message(gameInfo); if (!gameId) message.Append(TranslateT(" (Non-Steam)")); if (serverIP[0] != '\0') message.AppendFormat(TranslateT(" on server %s"), serverIP); setDword(hContact, "XStatusId", gameId); - setTString(hContact, "XStatusName", TranslateT("Playing")); - setTString(hContact, "XStatusMsg", message); + setWString(hContact, "XStatusName", TranslateT("Playing")); + setWString(hContact, "XStatusMsg", message); SetContactExtraIcon(hContact, gameId); } @@ -264,7 +264,7 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) setDword(hContact, "DeletedTS", ::time(NULL)); SetContactStatus(hContact, ID_STATUS_OFFLINE); - ptrW nick(getTStringA(hContact, "Nick")); + ptrW nick(getWStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; mir_snwprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); @@ -282,7 +282,7 @@ void CSteamProto::ContactIsFriend(MCONTACT hContact) delSetting(hContact, "DeletedTS"); delSetting(hContact, "Grant"); - ptrW nick(getTStringA(hContact, "Nick")); + ptrW nick(getWStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; mir_snwprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); @@ -374,10 +374,10 @@ MCONTACT CSteamProto::AddContact(const char *steamId, bool isTemporary) // move to default group DBVARIANT dbv; - if (!getTString("DefaultGroup", &dbv)) + if (!getWString("DefaultGroup", &dbv)) { if(Clist_GroupExists(dbv.ptszVal)) - db_set_ts(hContact, "CList", "Group", dbv.ptszVal); + db_set_ws(hContact, "CList", "Group", dbv.ptszVal); db_free(&dbv); } } @@ -760,7 +760,7 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) STEAM_SEARCH_RESULT ssr = { 0 }; ssr.hdr.cbSize = sizeof(STEAM_SEARCH_RESULT); - ssr.hdr.flags = PSR_TCHAR; + ssr.hdr.flags = PSR_UNICODE; node = json_get(child, "steamid"); ssr.hdr.id.w = mir_wstrdup(ptrW(json_as_string(node))); diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index a51193f9cf..c3099c67c6 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -24,7 +24,7 @@ void CSteamPasswordEditor::OnOk(CCtrlButton*) mir_free(m_proto->password); m_proto->password = m_password.GetText(); if (m_savePermanently.Enabled()) - m_proto->setTString("Password", m_proto->password); + m_proto->setWString("Password", m_proto->password); EndDialog(m_hwnd, DIALOG_RESULT_OK); } diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp index 9caa7091b9..0303a9a08a 100644 --- a/protocols/Steam/src/steam_events.cpp +++ b/protocols/Steam/src/steam_events.cpp @@ -35,7 +35,7 @@ int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = g_hInstance; odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.pwszGroup = LPGENW("Network"); odp.pwszTab = LPGENW("Account"); diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index 8bf65f6f30..f399eb0195 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -92,7 +92,7 @@ void CSteamProto::OnGotRsaKey(const HttpResponse *response) mir_free(encryptedPassword); // run authorization request - T2Utf username(getTStringA("Username")); + T2Utf username(getWStringA("Username")); ptrA twoFactorCode(getStringA("TwoFactorCode")); if (!twoFactorCode) twoFactorCode = mir_strdup(""); @@ -159,7 +159,7 @@ void CSteamProto::OnAuthorizationError(const JSONNode &node) return; } - T2Utf username(getTStringA("Username")); + T2Utf username(getWStringA("Username")); if (node["requires_twofactor"].as_bool()) { diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index c6252dc81b..9a4430882d 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -97,7 +97,7 @@ int CSteamProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) void CSteamProto::OnInitStatusMenu() { CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.root = Menu_GetProtocolRoot(this); // Show block list @@ -115,7 +115,7 @@ void CSteamProto::InitMenus() ////////////////////////////////////////////////////////////////////////////////////// // Contact menu initialization CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; // "Request authorization" SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e); diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index d399f7ff47..e5f6665a6f 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -39,7 +39,7 @@ void CSteamProto::OnMessageSent(const HttpResponse *response, void *arg) SendMessageParam *param = (SendMessageParam*)arg; ptrW error(mir_wstrdup(TranslateT("Unknown error"))); - ptrW steamId(getTStringA(param->hContact, "SteamID")); + ptrW steamId(getWStringA(param->hContact, "SteamID")); time_t timestamp = NULL; if (ResponseHttpOk(response)) diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 6774bb60ab..eb5db69c3c 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -61,14 +61,14 @@ void CSteamProto::ParsePollData(JSONNode *data) if (IsMe(steamId)) { node = json_get(item, "persona_name"); - setTString("Nick", ptrW(json_as_string(node))); + setWString("Nick", ptrW(json_as_string(node))); if (status == -1 || status == ID_STATUS_OFFLINE) continue; if (status != m_iStatus) { - debugLog(L"CSteamProto::ParsePollData: Change own status to %i", status); + debugLogW(L"CSteamProto::ParsePollData: Change own status to %i", status); int oldStatus = m_iStatus; m_iStatus = m_iDesiredStatus = status; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus); @@ -85,7 +85,7 @@ void CSteamProto::ParsePollData(JSONNode *data) SetContactStatus(hContact, status); node = json_get(item, "persona_name"); - setTString(hContact, "Nick", ptrW(json_as_string(node))); + setWString(hContact, "Nick", ptrW(json_as_string(node))); // todo: find difference between state changing and info changing steamIds.append(steamId).append(","); @@ -185,7 +185,7 @@ void CSteamProto::ParsePollData(JSONNode *data) void CSteamProto::PollingThread(void*) { - debugLog(L"CSteamProto::PollingThread: entering"); + debugLogW(L"CSteamProto::PollingThread: entering"); ptrA token(getStringA("TokenSecret")); ptrA umqId(getStringA("UMQID")); @@ -251,7 +251,7 @@ void CSteamProto::PollingThread(void*) else if (!lstrcmpi(error, L"Not Logged On")) // 'else' below will handle this error, we don't need this particular check right now { // need to relogin - debugLog(L"CSteamProto::PollingThread: Not Logged On"); + debugLogW(L"CSteamProto::PollingThread: Not Logged On"); // try to reconnect only when we're actually online (during normal logout we will still got this error anyway, but in that case our status is already offline) if (IsOnline() && Relogin()) @@ -269,7 +269,7 @@ void CSteamProto::PollingThread(void*) else { // something wrong - debugLog(L"CSteamProto::PollingThread: %s (%d)", error, response->resultCode); + debugLogW(L"CSteamProto::PollingThread: %s (%d)", error, response->resultCode); // token has expired if (response->resultCode == HTTP_CODE_UNAUTHORIZED) @@ -279,7 +279,7 @@ void CSteamProto::PollingThread(void*) node = json_get(root, "sectimeout"); int timeout = json_as_int(node); if (timeout < STEAM_API_TIMEOUT) - debugLog(L"CSteamProto::PollingThread: Timeout is too low (%d)", timeout); + debugLogW(L"CSteamProto::PollingThread: Timeout is too low (%d)", timeout); // let it jump out of further processing errors = errorsLimit; @@ -295,10 +295,10 @@ void CSteamProto::PollingThread(void*) if (IsOnline()) { - debugLog(L"CSteamProto::PollingThread: unexpected termination; switching protocol to offline"); + debugLogW(L"CSteamProto::PollingThread: unexpected termination; switching protocol to offline"); SetStatus(ID_STATUS_OFFLINE); } m_hPollingThread = NULL; - debugLog(L"CSteamProto::PollingThread: leaving"); + debugLogW(L"CSteamProto::PollingThread: leaving"); } \ No newline at end of file diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 964225abcc..107c086f08 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -24,7 +24,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) mir_snprintf(settingName, "%s_%s", MODULE, "main"); SKINICONDESC sid = { 0 }; - sid.flags = SIDF_ALL_TCHAR; + sid.flags = SIDF_ALL_UNICODE; sid.defaultFile.w = filePath; sid.pszName = settingName; sid.section.w = sectionName; @@ -69,7 +69,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.ptszDescriptiveName = name; nlu.szSettingsModule = m_szModuleName; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); @@ -296,7 +296,7 @@ int CSteamProto::SetStatus(int new_status) if (new_status == m_iDesiredStatus) return 0; - debugLog(L"CSteamProto::SetStatus: changing status from %i to %i", m_iStatus, new_status); + debugLogW(L"CSteamProto::SetStatus: changing status from %i to %i", m_iStatus, new_status); int old_status = m_iStatus; m_iDesiredStatus = new_status; @@ -338,7 +338,7 @@ int CSteamProto::SetStatus(int new_status) } else { - ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getTStringA("Username"))))); + ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getWStringA("Username"))))); if (username == NULL || username[0] == '\0') { m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; @@ -366,13 +366,13 @@ void __cdecl CSteamProto::GetAwayMsgThread(void *arg) Sleep(50); MCONTACT hContact = (UINT_PTR)arg; - CMString message(db_get_tsa(hContact, "CList", "StatusMsg")); + CMStringW message(db_get_wsa(hContact, "CList", "StatusMsg")); // if contact has no status message, get xstatus message if (message.IsEmpty()) { - ptrW xStatusName(getTStringA(hContact, "XStatusName")); - ptrW xStatusMsg(getTStringA(hContact, "XStatusMsg")); + ptrW xStatusName(getWStringA(hContact, "XStatusName")); + ptrW xStatusMsg(getWStringA(hContact, "XStatusMsg")); if (xStatusName) message.AppendFormat(L"%s: %s", xStatusName, xStatusMsg); diff --git a/protocols/Steam/src/steam_xstatus.cpp b/protocols/Steam/src/steam_xstatus.cpp index 8f8cdd015c..ea8796448a 100644 --- a/protocols/Steam/src/steam_xstatus.cpp +++ b/protocols/Steam/src/steam_xstatus.cpp @@ -48,7 +48,7 @@ INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) if (pData->flags & CSSF_DEFAULT_NAME) title = mir_wstrdup(TranslateT("Playing")); else - title = getTStringA(hContact, "XStatusName"); + title = getWStringA(hContact, "XStatusName"); if (pData->flags & CSSF_UNICODE) mir_wstrncpy(pData->ptszName, title, STATUS_TITLE_MAX); @@ -58,7 +58,7 @@ INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) // fill status message member if (pData->flags & CSSF_MASK_MESSAGE) { - ptrW message(getTStringA(hContact, "XStatusMsg")); + ptrW message(getWStringA(hContact, "XStatusMsg")); if (pData->flags & CSSF_UNICODE) mir_wstrncpy(pData->ptszMessage, message, STATUS_DESC_MAX); diff --git a/protocols/Tlen/src/tlen_advsearch.cpp b/protocols/Tlen/src/tlen_advsearch.cpp index b140736096..62ee5cde41 100644 --- a/protocols/Tlen/src/tlen_advsearch.cpp +++ b/protocols/Tlen/src/tlen_advsearch.cpp @@ -34,7 +34,7 @@ static void InitComboBox(HWND hwndCombo, TLEN_FIELD_MAP *fieldMap) for (i=0;;i++) { if (fieldMap[i].name == NULL) break; - n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateTS(fieldMap[i].name)); + n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateW(fieldMap[i].name)); SendMessage(hwndCombo, CB_SETITEMDATA, n, fieldMap[i].id); } } diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 83bd751010..f82d450634 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -33,13 +33,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* ptszDest, int cbLen) { - int tPathLen = mir_snwprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); + int tPathLen = mir_snwprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARSW(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); if (_waccess(ptszDest, 0)) { - int ret = CreateDirectoryTreeT(ptszDest); + int ret = CreateDirectoryTreeW(ptszDest); if (ret == 0) - proto->debugLog(L"getAvatarFilename(): Created new directory for avatar cache: %s.", ptszDest); + proto->debugLogW(L"getAvatarFilename(): Created new directory for avatar cache: %s.", ptszDest); else { - proto->debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", ptszDest, errno, strerror(errno)); + proto->debugLogW(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", ptszDest, errno, strerror(errno)); wchar_t buffer[512]; mir_snwprintf(buffer, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _wcserror(errno), ptszDest); PUShowMessageT(buffer, SM_WARNING); @@ -108,7 +108,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it if (out != NULL) { fwrite(data, len, 1, out); fclose(out); - db_set_ts(hContact, "ContactPhoto", "File", filename); + db_set_ws(hContact, "ContactPhoto", "File", filename); db_set_s(hContact, proto->m_szModuleName, "AvatarHash", md5); db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format); } @@ -116,7 +116,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it wchar_t buffer[128]; mir_snwprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _wcserror(errno), errno); PUShowMessageT(buffer, SM_WARNING); - proto->debugLog(buffer); + proto->debugLogW(buffer); return; } ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index dadf79e4b3..11a269f377 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -585,7 +585,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) if (szFilename[0] != '\0' && ft->iqId != NULL) { wchar_t* filenameT = mir_utf8decodeW((char*)szFilename); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = filenameT; diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 50d77a3c3b..4089af4a85 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -417,7 +417,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if ((queryNode = TlenXmlGetChild(iqNode, "query")) == NULL) return; if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { jsr.hdr.cbSize = sizeof(TLEN_SEARCH_RESULT); - jsr.hdr.flags = PSR_TCHAR; + jsr.hdr.flags = PSR_UNICODE; for (i = 0; i < queryNode->numChild; i++) { itemNode = queryNode->child[i]; if (!mir_strcmp(itemNode->name, "item")) { diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 2a855116dd..c5ac79b364 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -88,7 +88,7 @@ int TlenProtocol::OptionsInit(WPARAM wParam, LPARAM) odp.hInstance = hInst; odp.pwszGroup = LPGENW("Network"); odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.dwInitParam = (LPARAM)this; for (int i = 0; i < _countof(tabPages); i++) { odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId); @@ -122,7 +122,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); TranslateDialogDefault(hwndDlg); - if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) { + if (!db_get_ws(NULL, proto->m_szModuleName, "LoginName", &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal); db_free(&dbv); } @@ -208,7 +208,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); TranslateDialogDefault(hwndDlg); - if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) { + if (!db_get_ws(NULL, proto->m_szModuleName, "LoginName", &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal); db_free(&dbv); } @@ -412,7 +412,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); TranslateDialogDefault(hwndDlg); - if (!db_get_ts(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { + if (!db_get_ws(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal); db_free(&dbv); } @@ -421,7 +421,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE); - if (!db_get_ts(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { + if (!db_get_ws(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal); db_free(&dbv); } @@ -461,12 +461,12 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)L"SOCKS4"); SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)L"SOCKS5"); SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0), 0); - if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) { + if (!db_get_ws(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) { SetDlgItemText(hwndDlg, IDC_FILE_PROXY_HOST, dbv.ptszVal); db_free(&dbv); } SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE); - if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) { + if (!db_get_ws(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) { SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index d091aaa825..43615e4316 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -262,7 +262,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { mir_snprintf(fileInfo, "%s file(s), %s bytes", c, s); wchar_t* filenameT = mir_utf8decodeW((char*)fileInfo); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = filenameT; diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index ee3759740c..dcc6395496 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -578,7 +578,7 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr) ptrA ownJid(db_get_sa(NULL, data->proto->m_szModuleName, "jid")); if (!mir_strcmp(ownJid, dbv.pszVal)) { DBVARIANT dbv2; - if (!db_get_s(data->hContact, "CList", "StatusMsg", &dbv2, DBVT_TCHAR)) { + if (!db_get_s(data->hContact, "CList", "StatusMsg", &dbv2, DBVT_WCHAR)) { data->proto->ProtoBroadcastAck(data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv2.ptszVal); db_free(&dbv2); } diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index c361120161..0742ccdf38 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -87,7 +87,7 @@ static void InitComboBox(HWND hwndCombo, TLEN_FIELD_MAP *fieldMap) for (i=0;;i++) { if (fieldMap[i].name == NULL) break; - n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateTS(fieldMap[i].name)); + n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateW(fieldMap[i].name)); SendMessage(hwndCombo, CB_SETITEMDATA, n, fieldMap[i].id); } } @@ -135,7 +135,7 @@ int TlenProtocol::UserInfoInit(WPARAM wParam, LPARAM lParam) if ((szProto != NULL && !mir_strcmp(szProto, m_szModuleName)) || !lParam) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; - odp.flags = ODPF_TCHAR; + odp.flags = ODPF_UNICODE; odp.pfnDlgProc = TlenUserInfoDlgProc; odp.position = -2000000000; odp.pszTemplate = ((HANDLE)lParam != NULL) ? MAKEINTRESOURCEA(IDD_USER_INFO):MAKEINTRESOURCEA(IDD_USER_VCARD); @@ -184,19 +184,19 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, L""); SetFocus(GetDlgItem(hwndDlg, IDC_STATIC)); - if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) { + if (!db_get_ws(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) { SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, L""); - if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) { + if (!db_get_ws(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) { SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_LASTNAME, L""); - if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) { + if (!db_get_ws(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) { SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_NICKNAME, L""); - if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) { + if (!db_get_ws(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) { SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_EMAIL, L""); @@ -204,22 +204,22 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_AGE, L""); - if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "City", &dbv)) { + if (!db_get_ws(data->hContact, data->proto->m_szModuleName, "City", &dbv)) { SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_CITY, L""); - if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "School", &dbv)) { + if (!db_get_ws(data->hContact, data->proto->m_szModuleName, "School", &dbv)) { SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_SCHOOL, L""); switch (db_get_b(data->hContact, data->proto->m_szModuleName, "Gender", '?')) { case 'M': SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0); - SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[0].name)); + SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateW(tlenFieldGender[0].name)); break; case 'F': SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 2, 0); - SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[1].name)); + SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateW(tlenFieldGender[1].name)); break; default: SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 0, 0); @@ -228,7 +228,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara } i = db_get_w(data->hContact, data->proto->m_szModuleName, "Occupation", 0); if (i>0 && i<13) { - SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, TranslateTS(tlenFieldOccupation[i-1].name)); + SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, TranslateW(tlenFieldOccupation[i-1].name)); SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0); } else { SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, L""); @@ -236,7 +236,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara } i = db_get_w(data->hContact, data->proto->m_szModuleName, "LookingFor", 0); if (i>0 && i<6) { - SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, TranslateTS(tlenFieldLookfor[i-1].name)); + SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, TranslateW(tlenFieldLookfor[i-1].name)); SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0); } else { SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, L""); diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index ec0a691917..c9008cd2ee 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -31,13 +31,13 @@ BOOL TlenWsInit(TlenProtocol *proto) nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; mir_snwprintf(name, TranslateT("%s connection"), proto->m_tszUserName); nlu.ptszDescriptiveName = name; nlu.szSettingsModule = proto->m_szModuleName; proto->m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu); - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_UNICODE; mir_snwprintf(name, TranslateT("%s SOCKS connection"), proto->m_tszUserName); nlu.ptszDescriptiveName = name; proto->hFileNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu); diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index dfdca9e4f7..f6e8f4ddd3 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -46,7 +46,7 @@ int CToxProto::OnAccountRenamed(WPARAM, LPARAM) ptrW newPath(GetToxProfilePath()); wchar_t oldPath[MAX_PATH]; - mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName); + mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), accountName); _wrename(oldPath, newPath); mir_free(accountName); accountName = mir_wstrdup(m_tszUserName); diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index ed0c482cda..9dfdd36b69 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -3,13 +3,13 @@ wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact) { wchar_t *path = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1); - mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CreateDirectoryTreeT(path); + CreateDirectoryTreeW(path); - ptrW address(getTStringA(hContact, TOX_SETTINGS_ID)); + ptrW address(getWStringA(hContact, TOX_SETTINGS_ID)); if (address == NULL) { mir_free(path); return mir_wstrdup(L""); @@ -231,7 +231,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) } wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); OnFileAllow(transfer->pfts.hContact, transfer, path); } diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index fde562fe83..e44b337a18 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -30,12 +30,12 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber) wchar_t title[MAX_PATH]; mir_snwprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber); - setTString(hContact, "Nick", title); + setWString(hContact, "Nick", title); DBVARIANT dbv; - if (!db_get_s(NULL, "Chat", "AddToGroup", &dbv, DBVT_TCHAR)) + if (!db_get_s(NULL, "Chat", "AddToGroup", &dbv, DBVT_WCHAR)) { - db_set_ts(hContact, "CList", "Group", dbv.ptszVal); + db_set_ws(hContact, "CList", "Group", dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index d3e094e0db..5abda14238 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -91,15 +91,15 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char setString(hContact, TOX_SETTINGS_ID, address); if (mir_strlen(nick)) - setTString(hContact, "Nick", ptrW(mir_utf8decodeW(nick))); + setWString(hContact, "Nick", ptrW(mir_utf8decodeW(nick))); if (mir_strlen(dnsId)) - setTString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId))); + setWString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId))); DBVARIANT dbv; - if (!getTString(TOX_SETTINGS_GROUP, &dbv)) + if (!getWString(TOX_SETTINGS_GROUP, &dbv)) { - db_set_ts(hContact, "CList", "Group", dbv.ptszVal); + db_set_ws(hContact, "CList", "Group", dbv.ptszVal); db_free(&dbv); } @@ -149,7 +149,7 @@ void CToxProto::LoadFriendList(void*) TOX_ERR_FRIEND_QUERY getNameResult; uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &getNameResult)) - setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick))); + setWString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick))); else debugLogA(__FUNCTION__": failed to get friend name (%d)", getNameResult); @@ -188,7 +188,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; TOX_ERR_FRIEND_QUERY errorFriendQuery; if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &errorFriendQuery)) - setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick))); + setWString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick))); else debugLogA(__FUNCTION__": failed to get friend name (%d)", errorFriendQuery); @@ -292,7 +292,7 @@ void CToxProto::OnFriendNameChange(Tox*, uint32_t friendNumber, const uint8_t *n rawName[length] = 0; ptrW nickname(mir_utf8decodeW(rawName)); - proto->setTString(hContact, "Nick", nickname); + proto->setWString(hContact, "Nick", nickname); } } @@ -307,7 +307,7 @@ void CToxProto::OnStatusMessageChanged(Tox*, uint32_t friendNumber, const uint8_ rawMessage[length] = 0; ptrW statusMessage(mir_utf8decodeW(rawMessage)); - db_set_ts(hContact, "CList", "StatusMsg", statusMessage); + db_set_ws(hContact, "CList", "StatusMsg", statusMessage); } } @@ -398,7 +398,7 @@ int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if (szProto != NULL && !mir_strcmp(szProto, m_szModuleName)) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.hInstance = g_hInstance; odp.dwInitParam = (LPARAM)this; odp.pwszTitle = m_tszUserName; @@ -441,7 +441,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar break; } - SetDlgItemText(hwnd, IDC_DNS_ID, ptrW(proto->getTStringA(hContact, TOX_SETTINGS_DNS))); + SetDlgItemText(hwnd, IDC_DNS_ID, ptrW(proto->getWStringA(hContact, TOX_SETTINGS_DNS))); } break; @@ -458,7 +458,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar } wchar_t dnsId[MAX_PATH]; GetDlgItemText(hwnd, IDC_DNS_ID, dnsId, MAX_PATH); - proto->setTString(hContact, TOX_SETTINGS_DNS, dnsId); + proto->setWString(hContact, TOX_SETTINGS_DNS, dnsId); break; } break; @@ -471,8 +471,6 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; - - break; } return FALSE; diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index 108d9b0003..89687f69d4 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -95,9 +95,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; tox_self_get_name(toxThread->Tox(), nick); - setTString("Nick", ptrW(Utf8DecodeT((char*)nick)));*/ + setWString("Nick", ptrW(Utf8DecodeT((char*)nick)));*/ - ptrA nick(mir_utf8encodeW(ptrW(getTStringA("Nick")))); + ptrA nick(mir_utf8encodeW(ptrW(getWStringA("Nick")))); tox_self_set_name(toxThread->Tox(), (uint8_t*)(char*)nick, mir_strlen(nick), &error); if (error != TOX_ERR_SET_INFO_OK) { @@ -107,9 +107,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 }; tox_self_get_status_message(toxThread->Tox(), statusMessage); - setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));*/ + setWString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));*/ - ptrA statusMessage(mir_utf8encodeW(ptrW(getTStringA("StatusMsg")))); + ptrA statusMessage(mir_utf8encodeW(ptrW(getWStringA("StatusMsg")))); tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, mir_strlen(statusMessage), &error); if (error != TOX_ERR_SET_INFO_OK) { diff --git a/protocols/Tox/src/tox_dialogs.h b/protocols/Tox/src/tox_dialogs.h index d72c83eb92..dedd355e1b 100644 --- a/protocols/Tox/src/tox_dialogs.h +++ b/protocols/Tox/src/tox_dialogs.h @@ -19,7 +19,7 @@ public: virtual void OnReset() { - if (GetDataType() == DBVT_TCHAR) + if (GetDataType() == DBVT_WCHAR) SetText(LoadText()); else if (GetDataType() != DBVT_DELETED) SetInt(LoadInt()); diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index e7580ef650..61b3801928 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -40,7 +40,7 @@ void CToxProto::InitMenus() HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::PrebuildContactMenu); CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; // Request authorization SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e); @@ -73,7 +73,7 @@ void CToxProto::InitMenus() int CToxProto::OnInitStatusMenu() { CMenuItem mi; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.root = Menu_GetProtocolRoot(this); // Create copy tox id command diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 580fa31622..32a2d71298 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -66,7 +66,7 @@ void CToxProto::BootstrapNodesFromJson(CToxThread *toxThread, bool isUdp, bool i { ptrA json; - VARST path(_A2W(TOX_JSON_PATH)); + VARSW path(_A2W(TOX_JSON_PATH)); if (!IsFileExists(path)) UpdateNodes(); @@ -157,7 +157,7 @@ void CToxProto::UpdateNodes() if (lastUpdate <= getDword("NodesUpdate", 0)) return; - ptrW path(mir_wstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH)))); + ptrW path(mir_wstrdup((wchar_t*)VARSW(_A2W(TOX_JSON_PATH)))); if (!IsFileExists(path)) { HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 96564f432e..271df96825 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -90,9 +90,9 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) m_toxAddress.Enable(); m_toxAddress.SetTextA(ptrA(m_proto->getStringA(TOX_SETTINGS_ID))); - m_nickname.SetText(ptrW(m_proto->getTStringA("Nick"))); - m_password.SetText(ptrW(m_proto->getTStringA("Password"))); - m_group.SetText(ptrW(m_proto->getTStringA(TOX_SETTINGS_GROUP))); + m_nickname.SetText(ptrW(m_proto->getWStringA("Nick"))); + m_password.SetText(ptrW(m_proto->getWStringA("Password"))); + m_group.SetText(ptrW(m_proto->getWStringA(TOX_SETTINGS_GROUP))); ShowWindow(m_profileCreate.GetHwnd(), FALSE); ShowWindow(m_profileImport.GetHwnd(), FALSE); @@ -144,12 +144,12 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; tox_self_get_name(toxThread.Tox(), nick); ptrW nickname(Utf8DecodeT((char*)nick)); - m_proto->setTString("Nick", nickname); + m_proto->setWString("Nick", nickname); m_nickname.SetText(nickname); uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 }; tox_self_get_status_message(toxThread.Tox(), statusMessage); - m_proto->setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage))); + m_proto->setWString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage))); ShowWindow(m_profileCreate.GetHwnd(), FALSE); ShowWindow(m_profileImport.GetHwnd(), FALSE); @@ -195,10 +195,10 @@ void CToxOptionsMain::OnApply() if (m_proto->IsOnline()) { - CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrW(m_nickname.GetText())); + CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_UNICODE, (LPARAM)ptrW(m_nickname.GetText())); // todo: add checkbox - m_proto->setTString("Password", pass_ptrT(m_password.GetText())); + m_proto->setWString("Password", pass_ptrT(m_password.GetText())); m_proto->SaveToxProfile(m_proto->toxThread); } @@ -537,7 +537,7 @@ void CToxOptionsNodeList::ReloadNodeList() int iItem = -1; - VARST path(_A2W(TOX_JSON_PATH)); + VARSW path(_A2W(TOX_JSON_PATH)); if (CToxProto::IsFileExists(path)) { ptrA json; @@ -586,11 +586,11 @@ void CToxOptionsNodeList::ReloadNodeList() for (int i = 0; i < nodeCount; i++) { mir_snprintf(setting, TOX_SETTINGS_NODE_IPV4, i); - ptrW value(db_get_tsa(NULL, module, setting)); + ptrW value(db_get_wsa(NULL, module, setting)); iItem = m_nodes.AddItem(value, -1, NULL, 1); mir_snprintf(setting, TOX_SETTINGS_NODE_IPV6, i); - value = db_get_tsa(NULL, module, setting); + value = db_get_wsa(NULL, module, setting); m_nodes.SetItem(iItem, 1, value); mir_snprintf(setting, TOX_SETTINGS_NODE_PORT, i); @@ -603,7 +603,7 @@ void CToxOptionsNodeList::ReloadNodeList() } mir_snprintf(setting, TOX_SETTINGS_NODE_PKEY, i); - value = db_get_tsa(NULL, module, setting); + value = db_get_wsa(NULL, module, setting); m_nodes.SetItem(iItem, 3, value); m_nodes.SetItem(iItem, 4, L"", 0); @@ -681,7 +681,7 @@ int CToxProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszGroup = LPGENW("Network"); odp.pwszTab = LPGENW("Account"); diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 16658bc7c6..c1d71bd40f 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -11,7 +11,7 @@ wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName) { wchar_t *profilePath = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1); wchar_t profileRootPath[MAX_PATH]; - FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARST(L"%miranda_userdata%")); + FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARSW(L"%miranda_userdata%")); mir_snwprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName); return profilePath; } @@ -62,7 +62,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) if (tox_is_data_encrypted(data)) { - pass_ptrA password(mir_utf8encodeW(pass_ptrT(getTStringA("Password")))); + pass_ptrA password(mir_utf8encodeW(pass_ptrT(getWStringA("Password")))); if (password == NULL || mir_strlen(password) == 0) { CToxPasswordEditor passwordEditor(this); @@ -108,7 +108,7 @@ void CToxProto::SaveToxProfile(CToxThread *toxThread) uint8_t *data = (uint8_t*)mir_calloc(size + TOX_PASS_ENCRYPTION_EXTRA_LENGTH); tox_get_savedata(toxThread->Tox(), data); - pass_ptrA password(mir_utf8encodeW(pass_ptrT(getTStringA("Password")))); + pass_ptrA password(mir_utf8encodeW(pass_ptrT(getWStringA("Password")))); if (password && mir_strlen(password)) { TOX_ERR_ENCRYPTION coreEncryptError; @@ -167,7 +167,7 @@ void CToxPasswordEditor::OnOk(CCtrlButton*) { pass_ptrT tszPassword(password.GetText()); if (savePermanently.Enabled()) - m_proto->setTString("Password", tszPassword); + m_proto->setWString("Password", tszPassword); EndDialog(m_hwnd, 1); } diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index ece71c724d..952515d60d 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -91,7 +91,7 @@ void CToxProto::SearchByNameAsync(void *arg) /*int resolved = 0; - if (IsFileExists((wchar_t*)VARST(_T(TOX_INI_PATH)))) + if (IsFileExists((wchar_t*)VARSW(_T(TOX_INI_PATH)))) { char fileName[MAX_PATH]; mir_strcpy(fileName, VARS(TOX_INI_PATH)); diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp index 1651bbc597..5f3db0ac89 100644 --- a/protocols/Tox/src/tox_services.cpp +++ b/protocols/Tox/src/tox_services.cpp @@ -3,7 +3,7 @@ INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam) { ptrW nickname((wParam & SMNN_UNICODE) ? mir_wstrdup((wchar_t*)lParam) : mir_a2u((char*)lParam)); - setTString("Nick", nickname); + setWString("Nick", nickname); if (IsOnline()) { diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 5eaf69dffe..c00cc4bf59 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -18,7 +18,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u { Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": incoming avatar (%d) from (%d)", fileNumber, friendNumber); - ptrW address(proto->getTStringA(hContact, TOX_SETTINGS_ID)); + ptrW address(proto->getWStringA(hContact, TOX_SETTINGS_ID)); wchar_t avatarName[MAX_PATH]; mir_snwprintf(avatarName, MAX_PATH, L"%s.png", address); @@ -53,7 +53,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u proto->transfers.Add(transfer); PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.w = L""; diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index af5b51d8cc..372b047fb3 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -19,7 +19,7 @@ struct FileTransferParam transferNumber = (((int64_t)friendNumber) << 32) | ((int64_t)fileNumber); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.flags = PFTS_TCHAR; + pfts.flags = PFTS_UNICODE; pfts.hContact = NULL; pfts.totalFiles = 1; pfts.ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(pfts.totalFiles + 1)); diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 8a7d155f26..0daee31258 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -64,7 +64,7 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) switch (hook->pDest->iType) { case GC_USER_MESSAGE: - debugLog(L"**Chat - Outgoing message: %s", hook->ptszText); + debugLogW(L"**Chat - Outgoing message: %s", hook->ptszText); { T2Utf text(hook->ptszText); diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index bad7284cbf..913bcd70e2 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -162,8 +162,8 @@ bool TwitterProto::NegotiateConnection() } //write those bitches to the db foe latta - setTString(TWITTER_KEY_OAUTH_TOK, oauthToken.c_str()); - setTString(TWITTER_KEY_OAUTH_TOK_SECRET, oauthTokenSecret.c_str()); + setWString(TWITTER_KEY_OAUTH_TOK, oauthToken.c_str()); + setWString(TWITTER_KEY_OAUTH_TOK_SECRET, oauthTokenSecret.c_str()); // this looks like bad code.. can someone clean this up please? or confirm that it's ok wchar_t buf[1024] = {}; @@ -175,7 +175,7 @@ bool TwitterProto::NegotiateConnection() ShowPinDialog(); } - if (!getTString(TWITTER_KEY_GROUP, &dbv)) { + if (!getWString(TWITTER_KEY_GROUP, &dbv)) { Clist_GroupCreate(0, dbv.ptszVal); db_free(&dbv); } @@ -396,7 +396,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) // db_get_s returns 0 when it suceeds, so if this suceeds it will return 0, or false. // therefore if it returns 1, or true, we want to return as there is no such user. // as a side effect, dbv now has the username in it i think - if (getTString(data->hContact, TWITTER_KEY_UN, &dbv)) + if (getWString(data->hContact, TWITTER_KEY_UN, &dbv)) return; std::string ext = data->url.substr(data->url.rfind('.')); // finds the filetype of the avatar @@ -535,7 +535,7 @@ void TwitterProto::ShowContactPopup(MCONTACT hContact, const std::string &text, popup.colorBack = GetSysColor(COLOR_WINDOWTEXT); DBVARIANT dbv; - if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !getTString(hContact, TWITTER_KEY_UN, &dbv)) { + if (!db_get_ws(hContact, "CList", "MyHandle", &dbv) || !getWString(hContact, TWITTER_KEY_UN, &dbv)) { wcsncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME); db_free(&dbv); } diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 174046afdb..d5d56f9d85 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -126,7 +126,7 @@ void TwitterProto::DoSearch(void *pArg) if (found) { PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = mir_a2u(info.username.c_str()); psr.firstName.w = mir_a2u(info.real_name.c_str()); @@ -162,7 +162,7 @@ void TwitterProto::GetAwayMsgWorker(void *arg) return; DBVARIANT dbv; - if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); db_free(&dbv); } @@ -251,8 +251,8 @@ MCONTACT TwitterProto::AddToClientList(const char *name, const char *status) setString(hContact, "Homepage", url.c_str()); SkinPlaySound("TwitterNewContact"); DBVARIANT dbv; - if (!getTString(TWITTER_KEY_GROUP, &dbv)) { - db_set_ts(hContact, "CList", "Group", dbv.ptszVal); + if (!getWString(TWITTER_KEY_GROUP, &dbv)) { + db_set_ws(hContact, "CList", "Group", dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index c0f1e32b01..bfe83fcb81 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -256,7 +256,7 @@ int TwitterProto::OnBuildStatusMenu(WPARAM, LPARAM) { CMenuItem mi; mi.root = Menu_GetProtocolRoot(this); - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.position = 1001; Menu_AddStatusMenuItem(&mi, m_szModuleName); @@ -279,7 +279,7 @@ int TwitterProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pwszGroup = LPGENW("Network"); odp.pwszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.pwszTab = LPGENW("Basic"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); @@ -309,7 +309,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) { wchar_t descr[512]; NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; // Create standard network connection @@ -455,7 +455,7 @@ void TwitterProto::UpdateSettings() std::wstring TwitterProto::GetAvatarFolder() { wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName); + mir_snwprintf(path, L"%s\\%s", VARSW(L"%miranda_avatarcache%"), m_tszUserName); return path; } diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 4f0f988d02..3365299b08 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -90,7 +90,7 @@ void InitContactMenus() HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); CMenuItem mi; - mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR; + mi.flags = CMIF_NOTOFFLINE | CMIF_UNICODE; SET_UID(mi, 0xfc4e1245, 0xc8e0, 0x4de2, 0x92, 0x15, 0xfc, 0xcf, 0x48, 0xf9, 0x41, 0x56); mi.position = -2000006000; diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index e6e5dc2a5e..f2bad47bed 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); DBVARIANT dbv; - if (!proto->getTString(TWITTER_KEY_GROUP, &dbv)) { + if (!proto->getWString(TWITTER_KEY_GROUP, &dbv)) { SetDlgItemText(hwndDlg, IDC_GROUP, dbv.ptszVal); db_free(&dbv); } @@ -88,7 +88,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM proto->setString(TWITTER_KEY_BASEURL, str); GetDlgItemText(hwndDlg, IDC_GROUP, tstr, _countof(tstr)); - proto->setTString(TWITTER_KEY_GROUP, tstr); + proto->setWString(TWITTER_KEY_GROUP, tstr); return true; } diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index 565ef3622b..b427f64f1f 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -146,7 +146,7 @@ bool save_url(HANDLE hNetlib, const std::string &url, const std::wstring &filena // Create folder if necessary std::wstring dir = filename.substr(0, filename.rfind('\\')); if (_waccess(dir.c_str(), 0)) - CreateDirectoryTreeT(dir.c_str()); + CreateDirectoryTreeW(dir.c_str()); // Write to file FILE *f = _wfopen(filename.c_str(), L"wb"); diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 494ef63183..4f1a9c6cb4 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -292,7 +292,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) pReq->m_iRetry--; } else { - CMString msg(FORMAT, TranslateT("Error %d. Data will not be sent or received."), pReq->m_iErrorCode); + CMStringW msg(FORMAT, TranslateT("Error %d. Data will not be sent or received."), pReq->m_iErrorCode); MsgPopup(NULL, msg, TranslateT("Error"), true); debugLogA("CVkProto::CheckJsonResult SendError"); } @@ -413,7 +413,7 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul return true; } -CMString CVkProto::RunConfirmationCode() +CMStringW CVkProto::RunConfirmationCode() { ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_PASSWORD; @@ -421,10 +421,10 @@ CMString CVkProto::RunConfirmationCode() pForm.ptszInitVal = NULL; pForm.szModuleName = m_szModuleName; pForm.szDataPrefix = "confirmcode_"; - return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult)); + return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult)); } -CMString CVkProto::RunRenameNick(LPCWSTR pwszOldName) +CMStringW CVkProto::RunRenameNick(LPCWSTR pwszOldName) { ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_COMBO; @@ -433,7 +433,7 @@ CMString CVkProto::RunRenameNick(LPCWSTR pwszOldName) pForm.ptszInitVal = pwszOldName; pForm.szModuleName = m_szModuleName; pForm.szDataPrefix = "renamenick_"; - return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult)); + return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult)); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -589,7 +589,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) return; } - CMString MirVer, OldMirVer(ptrW(db_get_wsa(hContact, m_szModuleName, "MirVer"))); + CMStringW MirVer, OldMirVer(ptrW(db_get_wsa(hContact, m_szModuleName, "MirVer"))); bool bSetFlag = true; switch (platform) { @@ -830,7 +830,7 @@ int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// -CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedback, VKObjType& vkParent) +CMStringW CVkProto::SpanVKNotificationType(CMStringW& wszType, VKObjType& vkFeedback, VKObjType& vkParent) { CVKNotification vkNotification[] = { // type, parent, feedback, string for translate @@ -866,7 +866,7 @@ CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedba { L"mention_comment_video", vkVideo, vkComment, L"mentioned you in comment to video" } }; - CMString wszRes; + CMStringW wszRes; vkFeedback = vkParent = vkNull; for (int i = 0; i < _countof(vkNotification); i++) if (wszType == vkNotification[i].pwszType) { @@ -878,14 +878,14 @@ CMString CVkProto::SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedba return wszRes; } -CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) +CMStringW CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) { - CMString wszRes; + CMStringW wszRes; if (!jnPhoto) return wszRes; - CMString wszLink, wszPreviewLink; + CMStringW wszLink, wszPreviewLink; for (int i = 0; i < _countof(szImageTypes); i++) { const JSONNode &n = jnPhoto[szImageTypes[i]]; if (n) { @@ -913,14 +913,14 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) wszRes.AppendFormat(L"%s (%dx%d)", SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, wszLink), iWidth, iHeight); if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo) wszRes.AppendFormat(L"\n\t%s", SetBBCString(!wszPreviewLink.IsEmpty() ? wszPreviewLink : (!wszLink.IsEmpty() ? wszLink : L""), bbcBasic, vkbbcImg)); - CMString wszText(jnPhoto["text"].as_mstring()); + CMStringW wszText(jnPhoto["text"].as_mstring()); if (!wszText.IsEmpty()) wszRes += L"\n" + wszText; return wszRes; } -CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString) +CMStringW CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString) { CVKBBCItem bbcItem[] = { { vkbbcB, bbcNo, L"%s" }, @@ -953,7 +953,7 @@ CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType b }; if (IsEmpty(pwszString)) - return CMString(); + return CMStringW(); wchar_t *pwszFormat = NULL; for (int i = 0; i < _countof(bbcItem); i++) @@ -962,9 +962,9 @@ CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType b break; } - CMString res; + CMStringW res; if (pwszFormat == NULL) - return CMString(pwszString); + return CMStringW(pwszString); if (bbcType == vkbbcUrl && iBBC != bbcAdvanced) res.AppendFormat(pwszFormat, pwszString, wszAddString ? wszAddString : L""); @@ -976,12 +976,12 @@ CMString CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType b return res; } -CMString& CVkProto::ClearFormatNick(CMString& wszText) +CMStringW& CVkProto::ClearFormatNick(CMStringW& wszText) { int iNameEnd = wszText.Find(L"],"), iNameBeg = wszText.Find(L"|"); if (iNameEnd != -1 && iNameBeg != -1 && iNameBeg < iNameEnd) { - CMString wszName = wszText.Mid(iNameBeg + 1, iNameEnd - iNameBeg - 1); - CMString wszBody = wszText.Mid(iNameEnd + 2); + CMStringW wszName = wszText.Mid(iNameBeg + 1, iNameEnd - iNameBeg - 1); + CMStringW wszBody = wszText.Mid(iNameEnd + 2); if (!wszName.IsEmpty() && !wszBody.IsEmpty()) wszText = wszName + L"," + wszBody; } @@ -991,10 +991,10 @@ CMString& CVkProto::ClearFormatNick(CMString& wszText) ///////////////////////////////////////////////////////////////////////////////////////// -CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC) +CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC) { debugLogA("CVkProto::GetAttachmentDescr"); - CMString res; + CMStringW res; if (!jnAttachments) { debugLogA("CVkProto::GetAttachmentDescr pAttachments == NULL"); return res; @@ -1007,7 +1007,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnAttach = (*it); res.AppendChar('\t'); - CMString wszType(jnAttach["type"].as_mstring()); + CMStringW wszType(jnAttach["type"].as_mstring()); if (wszType == L"photo") { const JSONNode &jnPhoto = jnAttach["photo"]; if (!jnPhoto) @@ -1020,10 +1020,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnAudio) continue; - CMString wszArtist(jnAudio["artist"].as_mstring()); - CMString wszTitle(jnAudio["title"].as_mstring()); - CMString wszUrl(jnAudio["url"].as_mstring()); - CMString wszAudio(FORMAT, L"%s - %s", wszArtist, wszTitle); + CMStringW wszArtist(jnAudio["artist"].as_mstring()); + CMStringW wszTitle(jnAudio["title"].as_mstring()); + CMStringW wszUrl(jnAudio["url"].as_mstring()); + CMStringW wszAudio(FORMAT, L"%s - %s", wszArtist, wszTitle); int iParamPos = wszUrl.Find(L"?"); if (m_vkOptions.bShortenLinksForAudio && iParamPos != -1) @@ -1038,10 +1038,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnVideo) continue; - CMString wszTitle(jnVideo["title"].as_mstring()); + CMStringW wszTitle(jnVideo["title"].as_mstring()); int vid = jnVideo["id"].as_int(); int ownerID = jnVideo["owner_id"].as_int(); - CMString wszUrl(FORMAT, L"https://vk.com/video%d_%d", ownerID, vid); + CMStringW wszUrl(FORMAT, L"https://vk.com/video%d_%d", ownerID, vid); res.AppendFormat(L"%s: %s", SetBBCString(TranslateT("Video"), iBBC, vkbbcB), SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl)); @@ -1051,8 +1051,8 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnDoc) continue; - CMString wszTitle(jnDoc["title"].as_mstring()); - CMString wszUrl(jnDoc["url"].as_mstring()); + CMStringW wszTitle(jnDoc["title"].as_mstring()); + CMStringW wszUrl(jnDoc["url"].as_mstring()); res.AppendFormat(L"%s: %s", SetBBCString(TranslateT("Document"), iBBC, vkbbcB), SetBBCString(wszTitle, iBBC, vkbbcUrl, wszUrl)); @@ -1062,10 +1062,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnWall) continue; - CMString wszText(jnWall["text"].as_mstring()); + CMStringW wszText(jnWall["text"].as_mstring()); int id = jnWall["id"].as_int(); int fromID = jnWall["from_id"].as_int(); - CMString wszUrl(FORMAT, L"https://vk.com/wall%d_%d", fromID, id); + CMStringW wszUrl(FORMAT, L"https://vk.com/wall%d_%d", fromID, id); res.AppendFormat(L"%s: %s", SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, wszUrl), wszText.IsEmpty() ? L" " : wszText); @@ -1074,10 +1074,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport for (auto aCHit = jnCopyHystory.begin(); aCHit != jnCopyHystory.end(); ++aCHit) { const JSONNode &jnCopyHystoryItem = (*aCHit); - CMString wszCHText(jnCopyHystoryItem["text"].as_mstring()); + CMStringW wszCHText(jnCopyHystoryItem["text"].as_mstring()); int iCHid = jnCopyHystoryItem["id"].as_int(); int iCHfromID = jnCopyHystoryItem["from_id"].as_int(); - CMString wszCHUrl(FORMAT, L"https://vk.com/wall%d_%d", iCHfromID, iCHid); + CMStringW wszCHUrl(FORMAT, L"https://vk.com/wall%d_%d", iCHfromID, iCHid); wszCHText.Replace(L"\n", L"\n\t\t"); res.AppendFormat(L"\n\t\t%s: %s", SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, wszCHUrl), @@ -1086,7 +1086,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnSubAttachments = jnCopyHystoryItem["attachments"]; if (jnSubAttachments) { debugLogA("CVkProto::GetAttachmentDescr SubAttachments"); - CMString wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC); + CMStringW wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC); wszAttachmentDescr.Replace(L"\n", L"\n\t\t"); res += L"\n\t\t" + wszAttachmentDescr; } @@ -1095,7 +1095,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport const JSONNode &jnSubAttachments = jnWall["attachments"]; if (jnSubAttachments) { debugLogA("CVkProto::GetAttachmentDescr SubAttachments"); - CMString wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC); + CMStringW wszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC); wszAttachmentDescr.Replace(L"\n", L"\n\t"); res += L"\n\t" + wszAttachmentDescr; } @@ -1111,7 +1111,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport res.AppendFormat(L"[sticker:%d]", id); } else { - CMString wszLink; + CMStringW wszLink; for (int i = 0; i < _countof(szImageTypes); i++) { const JSONNode &n = jnSticker[szImageTypes[i]]; if (n) { @@ -1130,10 +1130,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnLink) continue; - CMString wszUrl(jnLink["url"].as_mstring()); - CMString wszTitle(jnLink["title"].as_mstring()); - CMString wszCaption(jnLink["caption"].as_mstring()); - CMString wszDescription(jnLink["description"].as_mstring()); + CMStringW wszUrl(jnLink["url"].as_mstring()); + CMStringW wszTitle(jnLink["title"].as_mstring()); + CMStringW wszCaption(jnLink["caption"].as_mstring()); + CMStringW wszDescription(jnLink["description"].as_mstring()); res.AppendFormat(L"%s: %s", SetBBCString(TranslateT("Link"), iBBC, vkbbcB), @@ -1153,10 +1153,10 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport int id = jnMarket["id"].as_int(); int ownerID = jnMarket["owner_id"].as_int(); - CMString wszTitle(jnMarket["title"].as_mstring()); - CMString wszDescription(jnMarket["description"].as_mstring()); - CMString wszPhoto(jnMarket["thumb_photo"].as_mstring()); - CMString wszUrl(FORMAT, L"https://vk.com/%s%d?w=product%d_%d", + CMStringW wszTitle(jnMarket["title"].as_mstring()); + CMStringW wszDescription(jnMarket["description"].as_mstring()); + CMStringW wszPhoto(jnMarket["thumb_photo"].as_mstring()); + CMStringW wszUrl(FORMAT, L"https://vk.com/%s%d?w=product%d_%d", ownerID > 0 ? L"id" : L"club", ownerID > 0 ? ownerID : (-1)*ownerID, ownerID, @@ -1184,7 +1184,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (!jnGift) continue; - CMString wszLink; + CMStringW wszLink; for (int i = 0; i < _countof(szGiftTypes); i++) { const JSONNode &n = jnGift[szGiftTypes[i]]; if (n) { @@ -1208,9 +1208,9 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport return res; } -CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC) +CMStringW CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC) { - CMString res; + CMStringW res; debugLogA("CVkProto::GetFwdMessages"); if (!jnMessages) { debugLogA("CVkProto::GetFwdMessages pMessages == NULL"); @@ -1223,8 +1223,8 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnUser = (*it); int iUserId = jnUser["id"].as_int(); - CMString wszNick(FORMAT, L"%s %s", jnUser["first_name"].as_mstring(), jnUser["last_name"].as_mstring()); - CMString wszLink(FORMAT, L"https://vk.com/id%d", iUserId); + CMStringW wszNick(FORMAT, L"%s %s", jnUser["first_name"].as_mstring(), jnUser["last_name"].as_mstring()); + CMStringW wszLink(FORMAT, L"https://vk.com/id%d", iUserId); CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, wszNick, wszLink, FindUser(iUserId)); vkUsers.insert(vkUser); @@ -1236,7 +1236,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn UINT uid = jnMsg["user_id"].as_int(); CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&uid); - CMString wszNick, wszUrl; + CMStringW wszNick, wszUrl; if (vkUser) { wszNick = vkUser->m_wszUserNick; @@ -1257,11 +1257,11 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn _wcsftime_l(ttime, _countof(ttime), L"%x %X", localtime(&datetime), locale); _free_locale(locale); - CMString wszBody(jnMsg["body"].as_mstring()); + CMStringW wszBody(jnMsg["body"].as_mstring()); const JSONNode &jnFwdMessages = jnMsg["fwd_messages"]; if (jnFwdMessages) { - CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments()); + CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments()); if (!wszBody.IsEmpty()) wszFwdMessages = L"\n" + wszFwdMessages; wszBody += wszFwdMessages; @@ -1269,7 +1269,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnAttachments = jnMsg["attachments"]; if (jnAttachments) { - CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments()); + CMStringW wszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments()); if (!wszBody.IsEmpty()) wszAttachmentDescr = L"\n" + wszAttachmentDescr; wszBody += wszAttachmentDescr; @@ -1277,7 +1277,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn wszBody.Replace(L"\n", L"\n\t"); wchar_t tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' '; - CMString wszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n", + CMStringW wszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n", SetBBCString(TranslateT("Message from"), iBBC, vkbbcB), SetBBCString(wszNick, iBBC, vkbbcUrl, wszUrl), tcSplit, @@ -1310,7 +1310,7 @@ void CVkProto::SetInvisible(MCONTACT hContact) setDword(hContact, "InvisibleTS", (DWORD)now); } -CMString CVkProto::RemoveBBC(CMString& wszSrc) +CMStringW CVkProto::RemoveBBC(CMStringW& wszSrc) { static const wchar_t *wszSimpleBBCodes[][2] = { { L"[b]", L"[/b]" }, @@ -1326,13 +1326,13 @@ CMString CVkProto::RemoveBBC(CMString& wszSrc) { L"[color=", L"[/color]" }, }; - CMString wszRes(wszSrc); - CMString wszLow(wszSrc); + CMStringW wszRes(wszSrc); + CMStringW wszLow(wszSrc); wszLow.MakeLower(); for (int i = 0; i < _countof(wszSimpleBBCodes); i++) { - CMString wszOpenTag(wszSimpleBBCodes[i][0]); - CMString wszCloseTag(wszSimpleBBCodes[i][1]); + CMStringW wszOpenTag(wszSimpleBBCodes[i][0]); + CMStringW wszCloseTag(wszSimpleBBCodes[i][1]); int lenOpen = wszOpenTag.GetLength(); int lenClose = wszCloseTag.GetLength(); @@ -1357,8 +1357,8 @@ CMString CVkProto::RemoveBBC(CMString& wszSrc) } for (int i = 0; i < _countof(wszParamBBCodes); i++) { - CMString wszOpenTag(wszParamBBCodes[i][0]); - CMString wszCloseTag(wszParamBBCodes[i][1]); + CMStringW wszOpenTag(wszParamBBCodes[i][0]); + CMStringW wszCloseTag(wszParamBBCodes[i][1]); int lenOpen = wszOpenTag.GetLength(); int lenClose = wszCloseTag.GetLength(); @@ -1396,7 +1396,7 @@ void CVkProto::ShowCaptchaInBrowser(HBITMAP hBitmap) if (!GetEnvironmentVariable(L"TEMP", wszTempDir, MAX_PATH)) return; - CMString wszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", wszTempDir); + CMStringW wszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", wszTempDir); FILE *pFile = _wfopen(wszHTMLPath, L"w"); if (pFile == NULL) diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 61a05f3002..1bb02b1287 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -130,7 +130,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); DWORD dwAttributes = GetFileAttributes(pwszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -150,9 +150,9 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cb mir_snwprintf(pwszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType); } -void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &wszUrl) +void CVkProto::SetAvatarUrl(MCONTACT hContact, CMStringW &wszUrl) { - CMString oldUrl(getWStringA(hContact, "AvatarUrl")); + CMStringW oldUrl(getWStringA(hContact, "AvatarUrl")); if (wszUrl == oldUrl) return; diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index ff8cee7677..4b0853d9d2 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -30,7 +30,7 @@ extern JSONNode nullNode; CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) { - debugLog(L"CVkProto::AppendChat"); + debugLogW(L"CVkProto::AppendChat"); if (id == 0) return NULL; @@ -42,14 +42,14 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) if (c != NULL) return c; - CMString wszTitle; + CMStringW wszTitle; c = new CVkChatInfo(id); if (jnDlg) { wszTitle = jnDlg["title"].as_mstring(); c->m_wszTopic = mir_wstrdup(!wszTitle.IsEmpty() ? wszTitle : L""); } - CMString sid; + CMStringW sid; sid.Format(L"%S_%d", m_szModuleName, id); c->m_wszId = mir_wstrdup(sid); @@ -73,13 +73,13 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP }; GCEVENT gce = { sizeof(gce), &gcd }; for (int i = _countof(sttStatuses)-1; i >= 0; i--) { - gce.ptszStatus = TranslateTS(sttStatuses[i]); + gce.ptszStatus = TranslateW(sttStatuses[i]); CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); } setDword(gci.hContact, "vk_chat_id", id); - CMString wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id); + CMStringW wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id); setWString(gci.hContact, "Homepage", wszHomepage); db_unset(gci.hContact, m_szModuleName, "off"); @@ -183,10 +183,10 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe bNew = cu->m_bUnknown; cu->m_bDel = false; - CMString wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid)))); + CMStringW wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid)))); if (wszNick.IsEmpty()) { - CMString fName(jnUser["first_name"].as_mstring()); - CMString lName(jnUser["last_name"].as_mstring()); + CMStringW fName(jnUser["first_name"].as_mstring()); + CMStringW lName(jnUser["last_name"].as_mstring()); wszNick = fName.Trim() + L" " + lName.Trim(); } cu->m_wszNick = mir_wstrdup(wszNick); @@ -198,7 +198,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe gce.bIsMe = uid == m_myUserId; gce.ptszUID = wszId; gce.ptszNick = wszNick; - gce.ptszStatus = TranslateTS(sttStatuses[uid == cc->m_admin_id]); + gce.ptszStatus = TranslateW(sttStatuses[uid == cc->m_admin_id]); gce.dwItemData = (INT_PTR)cu; CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); } @@ -217,7 +217,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe gce.ptszUID = wszId; gce.dwFlags = GCEF_REMOVECONTACT | GCEF_NOTNOTIFY; gce.time = time(NULL); - gce.ptszNick = mir_wstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId)); + gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId)); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); cc->m_users.remove(i); @@ -268,7 +268,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCWSTR wszTopic) { - debugLog(L"CVkProto::SetChatTitle"); + debugLogW(L"CVkProto::SetChatTitle"); if (!cc) return; @@ -302,11 +302,11 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (!msgTime || msgTime > now) msgTime = now; - CMString wszBody(jnMsg["body"].as_mstring()); + CMStringW wszBody(jnMsg["body"].as_mstring()); const JSONNode &jnFwdMessages = jnMsg["fwd_messages"]; if (jnFwdMessages) { - CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, bbcNo); + CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, bbcNo); if (!wszBody.IsEmpty()) wszFwdMessages = L"\n" + wszFwdMessages; wszBody += wszFwdMessages; @@ -314,7 +314,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & const JSONNode &jnAttachments = jnMsg["attachments"]; if (jnAttachments) { - CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo); + CMStringW wszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo); if (!wszBody.IsEmpty()) wszAttachmentDescr = L"\n" + wszAttachmentDescr; wszBody += wszAttachmentDescr; @@ -322,18 +322,18 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (jnMsg["action"]) { bIsAction = true; - CMString wszAction = jnMsg["action"].as_mstring(); + CMStringW wszAction = jnMsg["action"].as_mstring(); if (wszAction == L"chat_create") { - CMString wszActionText = jnMsg["action_text"].as_mstring(); + CMStringW wszActionText = jnMsg["action_text"].as_mstring(); wszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), wszActionText.IsEmpty() ? L" " : wszActionText); } else if (wszAction == L"chat_kick_user") { - CMString wszActionMid = jnMsg["action_mid"].as_mstring(); + CMStringW wszActionMid = jnMsg["action_mid"].as_mstring(); if (wszActionMid.IsEmpty()) wszBody = TranslateT("kick user"); else { - CMString wszUid(FORMAT, L"%d", uid); + CMStringW wszUid(FORMAT, L"%d", uid); if (wszUid == wszActionMid) { if (cc->m_bHistoryRead) return; @@ -355,11 +355,11 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & } } else if (wszAction == L"chat_invite_user") { - CMString wszActionMid = jnMsg["action_mid"].as_mstring(); + CMStringW wszActionMid = jnMsg["action_mid"].as_mstring(); if (wszActionMid.IsEmpty()) wszBody = TranslateT("invite user"); else { - CMString wszUid(FORMAT, L"%d", uid); + CMStringW wszUid(FORMAT, L"%d", uid); if (wszUid == wszActionMid) wszBody.AppendFormat(L" (https://vk.com/id%s) %s", wszUid, TranslateT("returned to chat")); else { @@ -378,7 +378,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & } } else if (wszAction == L"chat_title_update") { - CMString wszTitle = jnMsg["action_text"].as_mstring(); + CMStringW wszTitle = jnMsg["action_text"].as_mstring(); wszBody.AppendFormat(L"%s \"%s\"", TranslateT("change chat title to"), wszTitle.IsEmpty() ? L" " : wszTitle); if (!bIsHistory) @@ -419,7 +419,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid); if (cu == NULL) { cc->m_users.insert(cu = new CVkChatUser(uid)); - CMString wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid)))); + CMStringW wszNick(ptrW(db_get_wsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid)))); cu->m_wszNick = mir_wstrdup(wszNick.IsEmpty() ? (hContact ? ptrW(db_get_wsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : wszNick); cu->m_bUnknown = true; } @@ -514,7 +514,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) db_set_dw(hContact, "Ignore", "Mask1", 0); RetrieveUserInfo(_wtoi(gch->ptszUID)); } - CallService(MS_MSG_SENDMESSAGET, hContact); + CallService(MS_MSG_SENDMESSAGEW, hContact); } break; @@ -691,7 +691,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con return; MCONTACT hContact = FindUser(user_id, false); - CMString msg(jnMsg["body"].as_mstring()); + CMStringW msg(jnMsg["body"].as_mstring()); if (msg.IsEmpty()) { msg = TranslateT("You've been kicked by "); if (hContact != NULL) @@ -782,14 +782,14 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) case IDM_VISIT_PROFILE: hContact = FindUser(cu->m_uid); if (hContact == NULL) - Utils_OpenUrlW(CMString(FORMAT, L"https://vk.com/id%d", cu->m_uid)); + Utils_OpenUrlW(CMStringW(FORMAT, L"https://vk.com/id%d", cu->m_uid)); else SvcVisitProfile(hContact, 0); break; case IDM_CHANGENICK: { - CMString wszNewNick = RunRenameNick(cu->m_wszNick); + CMStringW wszNewNick = RunRenameNick(cu->m_wszNick); if (wszNewNick.IsEmpty() || wszNewNick == cu->m_wszNick) break; diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 889ded760b..0c9f5287a1 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -120,7 +120,7 @@ void CVkWallPostForm::OnInitDialog() { Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_WALL)); - CMString wszTitle(FORMAT, L"%s %s", TranslateT("Wall message for"), m_param->pwszNick); + CMStringW wszTitle(FORMAT, L"%s %s", TranslateT("Wall message for"), m_param->pwszNick); SetCaption(wszTitle); m_btnShare.Disable(); diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 2d52d12b9c..64c020b12a 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -32,7 +32,7 @@ void CVkProto::AddFeedSpecialUser() hContact = FindUser(VK_FEED_USER, true); setWString(hContact, "Nick", TranslateT("VKontakte")); - CMString wszUrl = L"https://vk.com/press/Simple.png"; + CMStringW wszUrl = L"https://vk.com/press/Simple.png"; SetAvatarUrl(hContact, wszUrl); ReloadAvatarInfo(hContact); @@ -102,8 +102,8 @@ CVkUserInfo* CVkProto::GetVkUserInfo(LONG iUserId, OBJLIST &vkUsers CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&iUserId); if (vkUser == NULL) { - CMString wszNick = TranslateT("Unknown"); - CMString wszLink(L"https://vk.com/"); + CMStringW wszNick = TranslateT("Unknown"); + CMStringW wszLink(L"https://vk.com/"); if (iUserId) { wszLink += bIsGroup ? "club" : "id"; wszLink.AppendFormat(L"%d", bIsGroup ? -iUserId : iUserId); @@ -130,11 +130,11 @@ void CVkProto::CreateVkUserInfoList(OBJLIST &vkUsers, const JSONNod continue; LONG UserId = jnProfile["id"].as_int(); - CMString wszNick(jnProfile["first_name"].as_mstring()); + CMStringW wszNick(jnProfile["first_name"].as_mstring()); wszNick.AppendChar(' '); wszNick += jnProfile["last_name"].as_mstring(); - CMString wszLink = L"https://vk.com/"; - CMString wszScreenName(jnProfile["screen_name"].as_mstring()); + CMStringW wszLink = L"https://vk.com/"; + CMStringW wszScreenName(jnProfile["screen_name"].as_mstring()); if (wszScreenName.IsEmpty()) wszScreenName.AppendFormat(L"id%d", UserId); wszLink += wszScreenName; @@ -150,8 +150,8 @@ void CVkProto::CreateVkUserInfoList(OBJLIST &vkUsers, const JSONNod continue; LONG UserId = - jnProfile["id"].as_int(); - CMString wszNick(jnProfile["name"].as_mstring()); - CMString wszLink = L"https://vk.com/"; + CMStringW wszNick(jnProfile["name"].as_mstring()); + CMStringW wszLink = L"https://vk.com/"; wszLink += jnProfile["screen_name"].as_mstring(); CVkUserInfo *vkUser = new CVkUserInfo(UserId, true, wszNick, wszLink); vkUsers.insert(vkUser); @@ -169,8 +169,8 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLISTwszType = jnItem["type"].as_mstring(); vkNewsItem->vkUser = GetVkUserInfo(iSourceId, vkUsers); @@ -180,7 +180,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLISTwszType); + debugLogW(L"CVkProto::GetVkNewsItem %d %d %s", iSourceId, iPostId, vkNewsItem->wszType); if (vkNewsItem->wszType == L"photo_tag") { bPostLink = false; @@ -246,7 +246,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLISTwszId.AppendFormat(L"%d_%d", vkNewsItem->vkUser->m_UserId, iPostId); if (bPostLink) { - vkNewsItem->wszLink = CMString(L"https://vk.com/wall") + vkNewsItem->wszId; + vkNewsItem->wszLink = CMStringW(L"https://vk.com/wall") + vkNewsItem->wszId; vkNewsItem->wszText.AppendChar('\n'); vkNewsItem->wszText += SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNewsItem->wszLink); } - debugLog(L"CVkProto::GetVkNewsItem %d %d <\n%s\n>", iSourceId, iPostId, vkNewsItem->wszText); + debugLogW(L"CVkProto::GetVkNewsItem %d %d <\n%s\n>", iSourceId, iPostId, vkNewsItem->wszText); return vkNewsItem; } ////////////////////////////////////////////////////////////////////////////////////////////////////////// -CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST &vkUsers, CVkUserInfo *vkUser) +CMStringW CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST &vkUsers, CVkUserInfo *vkUser) { debugLogA("CVkProto::GetVkFeedback"); - CMString wszRes; + CMStringW wszRes; if (!jnFeedback || !vkFeedbackType) return wszRes; - CMString wszFormat; + CMStringW wszFormat; LONG iUserId = 0; if (vkFeedbackType == vkComment) { @@ -299,7 +299,7 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac else if (vkFeedbackType == VKObjType::vkUsers || vkFeedbackType == vkCopy) { const JSONNode &jnUsers = jnFeedback["items"]; - CMString wszUsers; + CMStringW wszUsers; for (auto it = jnUsers.begin(); it != jnUsers.end(); ++it) { const JSONNode &jnUserItem = (*it); if (!jnUserItem["from_id"]) @@ -317,7 +317,7 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac if (iUserId) { vkUser = GetVkUserInfo(iUserId, vkUsers); - CMString wszText(jnFeedback["text"].as_mstring()); + CMStringW wszText(jnFeedback["text"].as_mstring()); wszText.Replace(L"%", L"%%"); wszRes.AppendFormat(wszFormat, SetBBCString(vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_wszLink), ClearFormatNick(wszText)); } @@ -328,14 +328,14 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCWSTR pwszReplyText, LPCWSTR pwszReplyLink) { debugLogA("CVkProto::GetVkParent"); - CMString wszRes; + CMStringW wszRes; if (!jnParent || !vkParentType) return NULL; CVKNewsItem *vkNotificationItem = new CVKNewsItem(); if (vkParentType == vkPhoto) { - CMString wszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews()); + CMStringW wszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews()); LONG iOwnerId = jnParent["owner_id"].as_int(); LONG iId = jnParent["id"].as_int(); vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId); @@ -352,11 +352,11 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT else if (vkParentType == vkVideo) { LONG iOwnerId = jnParent["owner_id"].as_int(); LONG iId = jnParent["id"].as_int(); - CMString wszTitle(jnParent["title"].as_mstring()); + CMStringW wszTitle(jnParent["title"].as_mstring()); vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId); vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/video%s", vkNotificationItem->wszId); - CMString wszText(jnParent["text"].as_mstring()); + CMStringW wszText(jnParent["text"].as_mstring()); ClearFormatNick(wszText); if (!wszText.IsEmpty()) @@ -375,7 +375,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->wszId.AppendFormat(L"%d_%d", iToId, iId); vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/wall%s%s", vkNotificationItem->wszId, pwszReplyLink ? pwszReplyLink : L""); - CMString wszText(jnParent["text"].as_mstring()); + CMStringW wszText(jnParent["text"].as_mstring()); ClearFormatNick(wszText); if (!wszText.IsEmpty()) { @@ -395,12 +395,12 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT else if (vkParentType == vkTopic) { LONG iOwnerId = jnParent["owner_id"].as_int(); LONG iId = jnParent["id"].as_int(); - CMString wszTitle(jnParent["title"].as_mstring()); + CMStringW wszTitle(jnParent["title"].as_mstring()); vkNotificationItem->wszId.AppendFormat(L"%d_%d", iOwnerId, iId); vkNotificationItem->wszLink.AppendFormat(L"https://vk.com/topic%s%s", vkNotificationItem->wszId, pwszReplyLink ? pwszReplyLink : L""); - CMString wszText(jnParent["text"].as_mstring()); + CMStringW wszText(jnParent["text"].as_mstring()); ClearFormatNick(wszText); if (!wszText.IsEmpty()) { @@ -418,7 +418,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->wszText.AppendFormat(L"\n%s", SetBBCString(wszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->wszLink)); } else if (vkParentType == vkComment) { - CMString wszText(jnParent["text"].as_mstring()); + CMStringW wszText(jnParent["text"].as_mstring()); ClearFormatNick(wszText); const JSONNode &jnPhoto = jnParent["photo"]; @@ -437,14 +437,14 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT const JSONNode &jnPost = jnParent["post"]; if (jnPost) { - CMString wszRepl(FORMAT, L"?reply=%d", iId); + CMStringW wszRepl(FORMAT, L"?reply=%d", iId); delete vkNotificationItem; return GetVkParent(jnPost, vkPost, wszText, wszRepl); } const JSONNode &jnTopic = jnParent["topic"]; if (jnTopic) { - CMString wszRepl(FORMAT, L"?reply=%d", iId); + CMStringW wszRepl(FORMAT, L"?reply=%d", iId); delete vkNotificationItem; return GetVkParent(jnTopic, vkTopic, wszText, wszRepl); } @@ -459,9 +459,9 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLISTwszText); vkNotification->wszText = wszNotificaton; @@ -532,16 +532,16 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLISTvkFeedbackType = vkFeedbackType; vkNotification->vkParentType = vkParentType; - CMString wszGroupName; - CMString wszGName = jnItem["name"].as_mstring(); - CMString wszGLink(FORMAT, L"https://vk.com/%s", jnItem["screen_name"].as_mstring()); + CMStringW wszGroupName; + CMStringW wszGName = jnItem["name"].as_mstring(); + CMStringW wszGLink(FORMAT, L"https://vk.com/%s", jnItem["screen_name"].as_mstring()); wszGroupName = SetBBCString(wszGName, m_vkOptions.BBCForNews(), vkbbcUrl, wszGLink); - CMString wszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_wszLink : L"https://vk.com/"); + CMStringW wszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_wszLink : L"https://vk.com/"); vkNotification->wszText.AppendFormat(L"%s %s %s", wszUsers, wszNotificationTranslate, wszGroupName); vkNotification->wszPopupTitle.AppendFormat(L"%s %s %s", iUserId ? vkNotification->vkUser->m_wszUserNick : TranslateT("Unknown"), wszNotificationTranslate, wszGName); @@ -708,7 +708,7 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) if (time(NULL) - tLastNotificationsReqTime < 3 * 60) return; - CMString code(FORMAT, L"return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s", + CMStringW code(FORMAT, L"return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s", (LONG)(tLastNotificationsTime + 1), m_vkOptions.bNotificationFilterInvites ? L",\"groupinvates\":API.groups.getInvites({\"extended\":1})};" : L"};"); diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index af491c5729..2d977768fb 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -32,7 +32,7 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) { - CMString wszError; + CMStringW wszError; switch (ErrorCode) { case VKERR_OFFLINE: wszError = TranslateT("Protocol is offline"); @@ -89,7 +89,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) wszError = TranslateT("Unknown error occurred"); } ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ErrorCode== VKERR_AUDIO_DEL_COPYRIGHT ? ACKRESULT_DENIED : ACKRESULT_FAILED, (HANDLE)fup); - debugLog(L"CVkProto::SendFileFiled error code = %d (%s)", ErrorCode, wszError); + debugLogW(L"CVkProto::SendFileFiled error code = %d (%s)", ErrorCode, wszError); MsgPopup(NULL, wszError, TranslateT("File upload error"), true); delete fup; } @@ -97,7 +97,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) void CVkProto::SendFileThread(void *p) { CVkFileUploadParam *fup = (CVkFileUploadParam *)p; - debugLog(L"CVkProto::SendFileThread %d %s", fup->GetType(), fup->fileName()); + debugLogW(L"CVkProto::SendFileThread %d %s", fup->GetType(), fup->fileName()); if (!IsOnline()) { SendFileFiled(fup, VKERR_OFFLINE); return; @@ -252,9 +252,9 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) return; } - CMString server(jnRoot["server"].as_mstring()); - CMString hash(jnRoot["hash"].as_mstring()); - CMString upload; + CMStringW server(jnRoot["server"].as_mstring()); + CMStringW hash(jnRoot["hash"].as_mstring()); + CMStringW upload; AsyncHttpRequest *pUploadReq; @@ -330,7 +330,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR return; } - CMString Attachment; + CMStringW Attachment; switch (fup->GetType()) { case CVkFileUploadParam::typeImg: diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index ed5671492e..706f38568e 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -168,7 +168,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque mir_cslock lck(m_csLoadHistoryTask); if (m_iLoadHistoryTask > 0) m_iLoadHistoryTask--; - debugLog(L"CVkProto::OnReceiveHistoryMessages error m_iLoadHistoryTask=%d", m_iLoadHistoryTask); + debugLogW(L"CVkProto::OnReceiveHistoryMessages error m_iLoadHistoryTask=%d", m_iLoadHistoryTask); MsgPopup(NULL, TranslateT("Error loading message history from server"), TranslateT("Error"), true); if (m_iLoadHistoryTask == 0 && m_bNotifyForEndLoadingHistoryAllContact) { @@ -189,10 +189,10 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque m_iLoadHistoryTask--; ptrW pwszNick(db_get_wsa(param->hContact, m_szModuleName, "Nick")); - CMString str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), pwszNick); + CMStringW str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), pwszNick); MsgPopup(param->hContact, str, TranslateT("Error"), true); - debugLog(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask); + debugLogW(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask); if (m_iLoadHistoryTask == 0 && m_bNotifyForEndLoadingHistoryAllContact) { MsgPopup(NULL, TranslateT("Loading messages for all contacts is completed"), TranslateT("Loading history")); @@ -223,7 +223,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque char szMid[40]; _itoa(mid, szMid, 10); - CMString wszBody(jnMsg["body"].as_mstring()); + CMStringW wszBody(jnMsg["body"].as_mstring()); int datetime = jnMsg["date"].as_int(); int isOut = jnMsg["out"].as_int(); int isRead = jnMsg["read_state"].as_int(); @@ -231,7 +231,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnFwdMessages = jnMsg["fwd_messages"]; if (jnFwdMessages) { - CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments()); + CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments()); if (!wszBody.IsEmpty()) wszFwdMessages = L"\n" + wszFwdMessages; wszBody += wszFwdMessages; @@ -239,7 +239,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnAttachments = jnMsg["attachments"]; if (jnAttachments) { - CMString wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments()); + CMStringW wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments()); if (!wszBody.IsEmpty()) wszAttachmentDescr = L"\n" + wszAttachmentDescr; wszBody += wszAttachmentDescr; @@ -281,8 +281,8 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque m_iLoadHistoryTask--; ptrW pwszNick(db_get_wsa(param->hContact, m_szModuleName, "Nick")); - CMString str(FORMAT, TranslateT("Loading messages for %s is completed"), pwszNick); - debugLog(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask); + CMStringW str(FORMAT, TranslateT("Loading messages for %s is completed"), pwszNick); + debugLogW(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask); if (m_bNotifyForEndLoadingHistory) MsgPopup(param->hContact, str, TranslateT("Loading history")); diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index bf5cb8bc7f..1ebed06e69 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -242,7 +242,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe } UINT mid = jnMsg["id"].as_int(); - CMString wszBody(jnMsg["body"].as_mstring()); + CMStringW wszBody(jnMsg["body"].as_mstring()); int datetime = jnMsg["date"].as_int(); int isOut = jnMsg["out"].as_int(); int isRead = jnMsg["read_state"].as_int(); @@ -250,13 +250,13 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnFwdMessages = jnMsg["fwd_messages"]; if (jnFwdMessages) { - CMString wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments()); + CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments()); if (!wszBody.IsEmpty()) wszFwdMessages = L"\n" + wszFwdMessages; wszBody += wszFwdMessages; } - CMString wszAttachmentDescr; + CMStringW wszAttachmentDescr; const JSONNode &jnAttachments = jnMsg["attachments"]; if (jnAttachments) { wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments()); @@ -280,7 +280,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (chat_id != 0) { debugLogA("CVkProto::OnReceiveMessages chat_id != 0"); - CMString action_chat = jnMsg["action"].as_mstring(); + CMStringW action_chat = jnMsg["action"].as_mstring(); int action_mid = _wtoi(jnMsg["action_mid"].as_mstring()); if ((action_chat == "chat_kick_user") && (action_mid == m_myUserId)) KickFromChat(chat_id, uid, jnMsg, jnFUsers); diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 9007aaeef3..c30fed271d 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -181,7 +181,7 @@ void CVkOptionAccountForm::OnInitDialog() } for (size_t i = 0; i < _countof(vkLangCodes); i++) { - int cur = m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode); + int cur = m_cbxVKLang.AddString(TranslateW(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode); if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.pwszVKLang)) m_cbxVKLang.SetCurSel(cur); } diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 984799dad1..0ebfaf6079 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -65,7 +65,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) : mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); NETLIBUSER nlu = {sizeof(nlu)}; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); @@ -120,7 +120,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CVkProto::OnDbEventRead); HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged); //Sounds - SkinAddNewSoundExT("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event")); + SkinAddNewSoundExW("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event")); InitPopups(); InitMenus(); @@ -228,7 +228,7 @@ void CVkProto::InitMenus() // Contact Menu Items mi.root = NULL; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_UNICODE; mi.pszService = PS_VISITPROFILE; mi.position = -200001000 + CMI_VISITPROFILE; @@ -575,7 +575,7 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * int iRet = jnResponse.as_int(); setByte(param->hContact, "Auth", 0); if (iRet == 2) { - CMString msg, + CMStringW msg, wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick"))); if (wszNick.IsEmpty()) wszNick = TranslateT("(Unknown contact)"); diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 65f127836b..ae91f9d5f0 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -268,7 +268,7 @@ private: CVKNewsItem* GetVkGroupInvates(const JSONNode &jnItem, OBJLIST &vkUsers); CVKNewsItem* GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST &vkUsers); void OnFriendAccepted(const JSONNode &jnFeedback); - CMString GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST &vkUsers, CVkUserInfo *vkUser); + CMStringW GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST &vkUsers, CVkUserInfo *vkUser); CVKNewsItem* GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCWSTR pwszReplyText = NULL, LPCWSTR pwszReplyLink = NULL); void RetrieveUnreadNews(time_t tLastNewsTime); void OnReceiveUnreadNews(NETLIBHTTPREQUEST*, AsyncHttpRequest*); @@ -284,8 +284,8 @@ private: void SetServerStatus(int); void RetrieveUsersInfo(bool flag = false, bool bRepeat = false); - void RetrieveStatusMsg(const CMString &StatusMsg); - void RetrieveStatusMusic(const CMString &StatusMsg); + void RetrieveStatusMsg(const CMStringW &StatusMsg); + void RetrieveStatusMusic(const CMStringW &StatusMsg); void OnReceiveStatus(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnReceiveStatusMsg(NETLIBHTTPREQUEST*, AsyncHttpRequest*); MCONTACT SetContactInfo(const JSONNode &jnItem, bool flag = false, bool self = false); @@ -325,8 +325,8 @@ private: bool CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &Node); void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*); bool AutoFillForm(char*, CMStringA&, CMStringA&); - CMString RunConfirmationCode(); - CMString RunRenameNick(LPCWSTR pwszOldName); + CMStringW RunConfirmationCode(); + CMStringW RunRenameNick(LPCWSTR pwszOldName); void GrabCookies(NETLIBHTTPREQUEST *nhr); void ApplyCookies(AsyncHttpRequest*); void __cdecl DBAddAuthRequestThread(void *p); @@ -338,14 +338,14 @@ private: void MarkDialogAsRead(MCONTACT hContact); char* GetStickerId(const char *Msg, int& stickerid); CMStringA GetAttachmentsFromMessage(const char * Msg); - CMString SpanVKNotificationType(CMString& wszType, VKObjType& vkFeedback, VKObjType& vkParent); - CMString GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC); - CMString SetBBCString(LPCWSTR wszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString = NULL); - CMString& ClearFormatNick(CMString& wszText); - CMString GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC = bbcNo); - CMString GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC = bbcNo); + CMStringW SpanVKNotificationType(CMStringW& wszType, VKObjType& vkFeedback, VKObjType& vkParent); + CMStringW GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC); + CMStringW SetBBCString(LPCWSTR wszString, BBCSupport iBBC, VKBBCType bbcType, LPCWSTR wszAddString = NULL); + CMStringW& ClearFormatNick(CMStringW& wszText); + CMStringW GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC = bbcNo); + CMStringW GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC = bbcNo); void SetInvisible(MCONTACT hContact); - CMString RemoveBBC(CMString& wszSrc); + CMStringW RemoveBBC(CMStringW& wszSrc); void InitQueue(); void UninitQueue(); void ExecuteRequest(AsyncHttpRequest*); @@ -357,7 +357,7 @@ private: void OnLoggedIn(); void OnLoggedOut(); void ShutdownSession(); - void SetAvatarUrl(MCONTACT hContact, CMString &wszUrl); + void SetAvatarUrl(MCONTACT hContact, CMStringW &wszUrl); void GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen); void ReloadAvatarInfo(MCONTACT hContact); void __cdecl SendMsgAck(void *param); diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index b56376b265..7b08a446da 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -70,7 +70,7 @@ void __cdecl CVkProto::SearchThread(void *p) wchar_t arg[200]; mir_snwprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName); - debugLog(L"CVkProto::SearchThread %s", arg); + debugLogW(L"CVkProto::SearchThread %s", arg); if (!IsOnline()) return; @@ -118,13 +118,13 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) break; PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; - CMString Id(FORMAT, L"%d", jnRecord["id"].as_int()); - CMString FirstName(jnRecord["first_name"].as_mstring()); - CMString LastName(jnRecord["last_name"].as_mstring()); - CMString Nick(jnRecord["nickname"].as_mstring()); - CMString Domain(jnRecord["domain"].as_mstring()); + CMStringW Id(FORMAT, L"%d", jnRecord["id"].as_int()); + CMStringW FirstName(jnRecord["first_name"].as_mstring()); + CMStringW LastName(jnRecord["last_name"].as_mstring()); + CMStringW Nick(jnRecord["nickname"].as_mstring()); + CMStringW Domain(jnRecord["domain"].as_mstring()); psr.id.w = mir_wstrdup(Id); psr.firstName.w = mir_wstrdup(FirstName); @@ -176,13 +176,13 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) break; PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; - CMString Id(FORMAT, L"%d", jnRecord["id"].as_int()); - CMString FirstName(jnRecord["first_name"].as_mstring()); - CMString LastName(jnRecord["last_name"].as_mstring()); - CMString Nick(jnRecord["nickname"].as_mstring()); - CMString Email(jnRecord["contact"].as_mstring()); + CMStringW Id(FORMAT, L"%d", jnRecord["id"].as_int()); + CMStringW FirstName(jnRecord["first_name"].as_mstring()); + CMStringW LastName(jnRecord["last_name"].as_mstring()); + CMStringW Nick(jnRecord["nickname"].as_mstring()); + CMStringW Email(jnRecord["contact"].as_mstring()); psr.id.w = mir_wstrdup(Id); psr.firstName.w = mir_wstrdup(FirstName); diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 5f58c9dcf3..6bba4870c6 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -69,7 +69,7 @@ void CVkProto::SetServerStatus(int iNewStatus) return; int iOldStatus = m_iStatus; - CMString oldStatusMsg(ptrW(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg"))); + CMStringW oldStatusMsg(ptrW(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg"))); ptrW pwszListeningToMsg(db_get_wsa(NULL, m_szModuleName, "ListeningTo")); if (iNewStatus == ID_STATUS_OFFLINE) { @@ -127,7 +127,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR OnReceiveStatus(reply, pReq); ptrW pwszOldStatusMsg(db_get_wsa(NULL, m_szModuleName, "OldStatusMsg")); - CMString wszOldStatusMsg(pwszOldStatusMsg); + CMStringW wszOldStatusMsg(pwszOldStatusMsg); ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; @@ -139,7 +139,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (!EnterString(&pForm)) return; - CMString wszNewStatusMsg(ptrW(pForm.ptszResult)); + CMStringW wszNewStatusMsg(ptrW(pForm.ptszResult)); if (wszOldStatusMsg == wszNewStatusMsg) return; @@ -159,13 +159,13 @@ void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnAudio = jnResponse["audio"]; if (!jnAudio) { - CMString wszStatusText(jnResponse["text"].as_mstring()); + CMStringW wszStatusText(jnResponse["text"].as_mstring()); if (wszStatusText[0] != wchar_t(9835)) setWString("OldStatusMsg", wszStatusText); } } -void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg) +void CVkProto::RetrieveStatusMsg(const CMStringW &StatusMsg) { debugLogA("CVkProto::RetrieveStatusMsg"); if (!IsOnline()) @@ -175,26 +175,26 @@ void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg) << WCHAR_PARAM("text", StatusMsg)); } -void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) +void CVkProto::RetrieveStatusMusic(const CMStringW &StatusMsg) { debugLogA("CVkProto::RetrieveStatusMusic"); if (!IsOnline() || m_iStatus == ID_STATUS_INVISIBLE || m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone) return; - CMString code; - CMString wszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg")); + CMStringW code; + CMStringW wszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg")); if (StatusMsg.IsEmpty()) { if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly) code = "API.audio.setBroadcast();return null;"; else { - CMString codeformat("API.status.set({text:\"%s\"});return null;"); + CMStringW codeformat("API.status.set({text:\"%s\"});return null;"); code.AppendFormat(codeformat, wszOldStatusMsg); } m_bSetBroadcast = false; } else { if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly) { - CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var OldMsg=API.status.get();" + CMStringW codeformat("var StatusMsg=\"%s\";var CntLmt=100;var OldMsg=API.status.get();" "var Tracks=API.audio.search({\"q\":StatusMsg,\"count\":CntLmt,\"search_own\":1});" "var Cnt=Tracks.count;if(Cnt>CntLmt){Cnt=CntLmt;}" "if(Cnt==0){API.audio.setBroadcast();}" @@ -205,13 +205,13 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) code.AppendFormat(codeformat, StatusMsg); } else if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendStatusOnly) { - CMString codeformat("var StatusMsg=\"♫ %s\";var OldMsg=API.status.get();" + CMStringW codeformat("var StatusMsg=\"♫ %s\";var OldMsg=API.status.get();" "API.status.set({\"text\":StatusMsg});" "return OldMsg;"); code.AppendFormat(codeformat, StatusMsg); } else if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastAndStatus) { - CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var Track=\" \";var OldMsg=API.status.get();" + CMStringW codeformat("var StatusMsg=\"%s\";var CntLmt=100;var Track=\" \";var OldMsg=API.status.get();" "var Tracks=API.audio.search({\"q\":StatusMsg,\"count\":CntLmt,\"search_own\":1});" "var Cnt=Tracks.count;if(Cnt>CntLmt){Cnt=CntLmt;}" "if(Cnt==0){Track=\"♫ \"+StatusMsg;API.status.set({\"text\":Track});}" @@ -235,7 +235,7 @@ INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam) return 1; LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam; - CMString wszListeningTo; + CMStringW wszListeningTo; if (pliInfo == NULL || pliInfo->cbSize != sizeof(LISTENINGTOINFO)) db_unset(NULL, m_szModuleName, "ListeningTo"); else if (pliInfo->dwFlags & LTI_UNICODE) { diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 54813f388f..8d787a6101 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -185,7 +185,7 @@ struct CVkUserInfo : public MZeroedObject { m_bIsGroup(false) {} - CVkUserInfo(LONG _UserId, bool _bIsGroup, CMString& _wszUserNick, CMString& _wszLink, MCONTACT _hContact = NULL) : + CVkUserInfo(LONG _UserId, bool _bIsGroup, CMStringW& _wszUserNick, CMStringW& _wszLink, MCONTACT _hContact = NULL) : m_UserId(_UserId), m_bIsGroup(_bIsGroup), m_wszUserNick(_wszUserNick), @@ -195,8 +195,8 @@ struct CVkUserInfo : public MZeroedObject { LONG m_UserId; MCONTACT m_hContact; - CMString m_wszUserNick; - CMString m_wszLink; + CMStringW m_wszUserNick; + CMStringW m_wszLink; bool m_bIsGroup; }; @@ -218,14 +218,14 @@ struct CVKNewsItem : public MZeroedObject { vkParentType(vkNull) {} - CMString wszId; + CMStringW wszId; time_t tDate; CVkUserInfo *vkUser; - CMString wszText; - CMString wszLink; - CMString wszType; - CMString wszPopupTitle; - CMString wszPopupText; + CMStringW wszText; + CMStringW wszLink; + CMStringW wszType; + CMStringW wszPopupTitle; + CMStringW wszPopupText; VKObjType vkFeedbackType, vkParentType; bool bIsGroup; bool bIsRepost; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 05cf3f6daa..d2022cb2df 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -271,7 +271,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) else if (hContact == NULL) return NULL; - CMString wszNick, wszValue; + CMStringW wszNick, wszValue; int iValue; wszValue = jnItem["first_name"].as_mstring(); @@ -355,14 +355,14 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) setWString(hContact, "Phone", wszValue); wszValue = jnItem["status"].as_mstring(); - CMString wszOldStatus(ptrW(db_get_wsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg"))); + CMStringW wszOldStatus(ptrW(db_get_wsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg"))); if (wszValue != wszOldStatus) db_set_ws(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", wszValue); - CMString wszOldListeningTo(ptrW(db_get_wsa(hContact, m_szModuleName, "ListeningTo"))); + CMStringW wszOldListeningTo(ptrW(db_get_wsa(hContact, m_szModuleName, "ListeningTo"))); const JSONNode &jnAudio = jnItem["status_audio"]; if (jnAudio) { - CMString wszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring()); + CMStringW wszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring()); if (wszListeningTo != wszOldListeningTo) { setWString(hContact, "ListeningTo", wszListeningTo); setWString(hContact, "AudioUrl", jnAudio["url"].as_mstring()); @@ -447,7 +447,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) wszValue = jnItem["domain"].as_mstring(); if (!wszValue.IsEmpty()) { setWString(hContact, "domain", wszValue); - CMString wszUrl("https://vk.com/"); + CMStringW wszUrl("https://vk.com/"); wszUrl.Append(wszValue); setWString(hContact, "Homepage", wszUrl); } @@ -461,8 +461,8 @@ void CVkProto::RetrieveUserInfo(LONG userID) if (userID == VK_FEED_USER || !IsOnline()) return; - CMString code(FORMAT, L"var userIDs=\"%i\";var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});return{\"freeoffline\":0,\"norepeat\":1,\"usercount\":res.length,\"users\":res};", - userID, CMString(fieldsName)); + CMStringW code(FORMAT, L"var userIDs=\"%i\";var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});return{\"freeoffline\":0,\"norepeat\":1,\"usercount\":res.length,\"users\":res};", + userID, CMStringW(fieldsName)); Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo) << WCHAR_PARAM("code", code)); } @@ -473,7 +473,7 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) if (!IsOnline()) return; - CMString userIDs, code; + CMStringW userIDs, code; int i = 0; for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { LONG userID = getDword(hContact, "ID", -1); @@ -488,22 +488,22 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) i++; } - CMString codeformat("var userIDs=\"%s\";var _fields=\"%s\";"); + CMStringW codeformat("var userIDs=\"%s\";var _fields=\"%s\";"); if (m_bNeedSendOnline) codeformat += L"API.account.setOnline();"; if (bFreeOffline && !m_vkOptions.bLoadFullCList) - codeformat += CMString("var US=[];var res=[];var t=10;while(t>0){" + codeformat += CMStringW("var US=[];var res=[];var t=10;while(t>0){" "US=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});" "var index=US.length;while(index>0){" "index=index-1;if(US[index].online!=0){res.push(US[index]);};};" "t=t-1;if(res.length>0)t=0;};" "return{\"freeoffline\":1,\"norepeat\":%d,\"usercount\":res.length,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};"); else - codeformat += CMString("var res=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});" + codeformat += CMStringW("var res=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});" "return{\"freeoffline\":0,\"norepeat\":%d,\"usercount\":res.length,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};"); - code.AppendFormat(codeformat, userIDs, CMString(bFreeOffline ? "online,status" : fieldsName), (int)bRepeat); + code.AppendFormat(codeformat, userIDs, CMStringW(bFreeOffline ? "online,status" : fieldsName), (int)bRepeat); Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo) << WCHAR_PARAM("code", code)); @@ -679,7 +679,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) return 1; ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick")); - CMString pwszMsg; + CMStringW pwszMsg; if (flag == 0) { pwszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick); if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO)) @@ -699,10 +699,10 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest JSONNode jnRoot; const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot); if (jnResponse) { - CMString wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick"))); + CMStringW wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick"))); if (wszNick.IsEmpty()) wszNick = TranslateT("(Unknown contact)"); - CMString msgformat, msg; + CMStringW msgformat, msg; if (jnResponse["success"].as_bool()) { if (jnResponse["friend_deleted"].as_bool()) @@ -739,7 +739,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) return 1; CMStringA code(FORMAT, "var userID=\"%d\";API.account.banUser({\"user_id\":userID});", userID); - CMString wszVarWarning; + CMStringW wszVarWarning; if (m_vkOptions.bReportAbuse) { debugLogA("CVkProto::SvcBanUser m_vkOptions.bReportAbuse = true"); @@ -772,7 +772,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) code += "return 1;"; ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick")); - CMString pwszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"), + CMStringW pwszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"), IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick, wszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"), wszVarWarning.IsEmpty() ? L"\n" : wszVarWarning); @@ -796,7 +796,7 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER) return 1; - CMString wszNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"))), + CMStringW wszNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"))), pwszMsg(FORMAT, TranslateT("Are you sure to report abuse on %s?"), wszNick.IsEmpty() ? TranslateT("(Unknown contact)") : wszNick); if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO)) return 1; @@ -812,7 +812,7 @@ INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) { debugLogA("CVkProto::SvcOpenBroadcast"); - CMString wszAudio(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl"))); + CMStringW wszAudio(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl"))); if (!wszAudio.IsEmpty()) Utils_OpenUrlW(wszAudio); @@ -832,7 +832,7 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) LONG userID = getDword(hContact, "ID", -1); ptrW wszDomain(db_get_wsa(hContact, m_szModuleName, "domain")); - CMString wszUrl("https://vk.com/"); + CMStringW wszUrl("https://vk.com/"); if (wszDomain) wszUrl.Append(wszDomain); else diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 536602bcb2..bb163013d5 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -116,7 +116,7 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const saveInfo.tszName = tszTempFile; saveInfo.dwMask = IMGI_HBITMAP; saveInfo.fif = FIF_JPEG; - CallService(MS_IMG_SAVE, (WPARAM)&saveInfo, IMGL_TCHAR); + CallService(MS_IMG_SAVE, (WPARAM)&saveInfo, IMGL_WCHAR); if (hbmpPreview != resize.hBmp) DeleteObject(hbmpPreview); diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 26a46bec48..eded520031 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -85,7 +85,7 @@ int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam) setWord(hContact, "Status", ID_STATUS_ONLINE); db_set_b(hContact, "CList", "Hidden", 1); - setTString(hContact, "Nick", gch->ptszUID); + setWString(hContact, "Nick", gch->ptszUID); db_set_dw(hContact, "Ignore", "Mask1", 0); } CallService(MS_MSG_SENDMESSAGE, hContact, 0); @@ -145,8 +145,8 @@ void WhatsAppProto::ChatLogMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo) { - CMString title(FORMAT, TranslateT("Set new subject for %s"), pInfo->tszNick); - ptrW tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK)); + CMStringW title(FORMAT, TranslateT("Set new subject for %s"), pInfo->tszNick); + ptrW tszOldValue(getWStringA(pInfo->hContact, WHATSAPP_KEY_NICK)); ENTER_STRING es = { 0 }; es.cbSize = sizeof(es); @@ -225,7 +225,7 @@ void WhatsAppProto::AddChatUser(WAChatInfo*, const wchar_t *ptszJid) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = (wchar_t*)ptszJid; psr.nick.w = GetChatUserNick(jid); @@ -253,7 +253,7 @@ void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid) int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM) { if (isChatRoom(hContact) && isOnline()) { - ptrW tszID(getTStringA(hContact, WHATSAPP_KEY_ID)); + ptrW tszID(getWStringA(hContact, WHATSAPP_KEY_ID)); if (tszID) m_pConnection->sendJoinLeaveGroup(_T2A(tszID), false); } @@ -314,7 +314,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n GCDEST gcd = { m_szModuleName, ptszJid, GC_EVENT_ADDGROUP }; GCEVENT gce = { sizeof(gce), &gcd }; for (int i = _countof(sttStatuses) - 1; i >= 0; i--) { - gce.ptszStatus = TranslateTS(sttStatuses[i]); + gce.ptszStatus = TranslateW(sttStatuses[i]); CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); } @@ -419,7 +419,7 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string return; ptrW tszText(str2t(newSubject)); - ptrW tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK)); + ptrW tszTextDb(getWStringA(pInfo->hContact, WHATSAPP_KEY_NICK)); if (!mir_wstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one return; @@ -436,7 +436,7 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string gce.ptszText = tszText; CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); - setTString(pInfo->hContact, WHATSAPP_KEY_NICK, tszText); + setWString(pInfo->hContact, WHATSAPP_KEY_NICK, tszText); } void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &ujid, int ts) diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 8026cc0912..e4f0d50330 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -21,7 +21,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new if (oldName.compare(string(new_name)) != 0) { db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name); - CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrW(mir_utf8decodeW(new_name))); + CMStringW tmp(FORMAT, TranslateT("is now known as '%s'"), ptrW(mir_utf8decodeW(new_name))); this->NotifyEvent(_A2T(oldName.c_str()), tmp, hContact, WHATSAPP_EVENT_OTHER); } } @@ -42,7 +42,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new setString(hContact, "MirVer", "WhatsApp"); db_unset(hContact, "CList", "MyHandle"); db_set_b(hContact, "CList", "NotOnList", 1); - db_set_ts(hContact, "CList", "Group", m_tszDefaultGroup); + db_set_ws(hContact, "CList", "Group", m_tszDefaultGroup); if (new_name != NULL) db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name); @@ -74,9 +74,9 @@ void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client) { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (reset_client) { - ptrW tszMirVer(getTStringA(hContact, "MirVer")); + ptrW tszMirVer(getWStringA(hContact, "MirVer")); if (mir_wstrcmp(tszMirVer, L"WhatsApp")) - setTString(hContact, "MirVer", L"WhatsApp"); + setWString(hContact, "MirVer", L"WhatsApp"); db_set_ws(hContact, "CList", "StatusMsg", L""); } diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 6a86685895..be9cb7de70 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -134,7 +134,7 @@ int WhatsAppProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszGroup = LPGENW("Network"); odp.pwszTab = LPGENW("Account"); diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 388b12f309..98bea34363 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -133,5 +133,5 @@ void WhatsAppProto::onMessageStatusUpdate(const FMessage &fmsg) wchar_t ttime[64]; wcsftime(ttime, _countof(ttime), L"%X", localtime(&ts)); - utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy)); + utils::setStatusMessage(hContact, CMStringW(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy)); } diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index e40588f0cc..a0b3b3cbe4 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -14,7 +14,7 @@ struct SearchParam WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) : PROTO(proto_name, username), - m_tszDefaultGroup(getTStringA(WHATSAPP_KEY_DEF_GROUP)) + m_tszDefaultGroup(getWStringA(WHATSAPP_KEY_DEF_GROUP)) { update_loop_lock_ = CreateEvent(NULL, false, false, NULL); @@ -36,7 +36,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); @@ -48,10 +48,10 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) WASocketConnection::initNetwork(m_hNetlibUser); - m_tszAvatarFolder = std::wstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName; + m_tszAvatarFolder = std::wstring(VARSW(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()); + CreateDirectoryTreeW(m_tszAvatarFolder.c_str()); if (m_tszDefaultGroup == NULL) m_tszDefaultGroup = mir_wstrdup(L"WhatsApp"); @@ -196,7 +196,7 @@ void WhatsAppProto::SearchAckThread(void *targ) SearchParam *param = (SearchParam*)targ; PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.nick.w = psr.firstName.w = psr.lastName.w = L""; psr.id.w = (wchar_t*)param->jid.c_str(); @@ -285,13 +285,13 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, if (reason == "stale") NotifyEvent(ptszTitle, TranslateT("Registration failed due to stale code. Please request a new code"), NULL, WHATSAPP_EVENT_CLIENT); else { - CMString tmp(FORMAT, TranslateT("Registration failed. Reason: %s"), _A2T(reason.c_str())); + CMStringW tmp(FORMAT, TranslateT("Registration failed. Reason: %s"), _A2T(reason.c_str())); NotifyEvent(ptszTitle, tmp, NULL, WHATSAPP_EVENT_CLIENT); } const JSONNode &tmpVal = resp["retry_after"]; if (tmpVal) { - CMString tmp(FORMAT, TranslateT("Please try again in %i seconds"), tmpVal.as_int()); + CMStringW tmp(FORMAT, TranslateT("Please try again in %i seconds"), tmpVal.as_int()); NotifyEvent(ptszTitle, tmp, NULL, WHATSAPP_EVENT_OTHER); } return false; diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 93dbff7f38..e57a331c0c 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -293,7 +293,7 @@ void CYahooProto::ext_got_picture(const char*, const char *who, const char *pic_ */ if (getByte("AvatarUL", 0) != 1) { // NO avatar URL?? - if (!getTString("AvatarFile", &dbv)) { + if (!getWString("AvatarFile", &dbv)) { struct _stat statbuf; if (_wstat(dbv.ptszVal, &statbuf) != 0) { LOG(("[ext_yahoo_got_picture] Avatar File Missing? Can't find file: %s", dbv.ptszVal)); @@ -411,7 +411,7 @@ void CYahooProto::ext_got_picture(const char*, const char *who, const char *pic_ LOG(("[ext_yahoo_got_picture] Buddy: %s told us this is bad??Expired??. Re-uploading", who)); delSetting("AvatarURL"); - if (!getTString("AvatarFile", &dbv2)) { + if (!getWString("AvatarFile", &dbv2)) { setString("AvatarInv", who); SendAvatar(dbv2.ptszVal); db_free(&dbv2); @@ -596,10 +596,10 @@ void CYahooProto::request_avatar(const char* who) void CYahooProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, int cbLen, int type) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); if (_waccess(pszDest, 0)) - CreateDirectoryTreeT(pszDest); + CreateDirectoryTreeW(pszDest); if (hContact != NULL) { int ck_sum = getDword(hContact, "PictCK", 0); @@ -748,7 +748,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) int ret = -3; if (getDword("AvatarHash", 0)) { - if (!getTString("AvatarFile", &dbv)) { + if (!getWString("AvatarFile", &dbv)) { if (_waccess(dbv.ptszVal, 0) == 0) { mir_wstrncpy(buffer, dbv.ptszVal, size - 1); buffer[size - 1] = '\0'; @@ -836,7 +836,7 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM, LPARAM lParam) /* now check and make sure we don't reupload same thing over again */ if (hash != getDword("AvatarHash", 0)) { - setTString("AvatarFile", tszMyFile); + setWString("AvatarFile", tszMyFile); setDword("TMPAvatarHash", hash); /* Set Sharing to ON if it's OFF */ diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index 50156ddd5d..099c78235c 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -45,7 +45,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, MCONTACT hContact, cons ft->pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); ft->pfts.hContact = hContact; - ft->pfts.flags = PFTS_TCHAR; + ft->pfts.flags = PFTS_UNICODE; ft->pfts.flags |= (sending != 0) ? PFTS_SENDING : PFTS_RECEIVING; ft->pfts.tszWorkingDir = NULL; @@ -505,7 +505,7 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url, char *szFileName = fn; PROTORECVFILET pre = { 0 }; - pre.dwFlags = PRFF_TCHAR; + pre.dwFlags = PRFF_UNICODE; pre.fileCount = 1; pre.timestamp = time(NULL); pre.descr.a = (char*)msg; diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index 1eaeadaf44..b831f4cfcd 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -140,7 +140,7 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM, LPARAM lParam) MCONTACT hContact = proto->add_buddy(id, id, 0, PALF_TEMPORARY); /* ensure contact is on list */ if (hContact) - CallService(MS_MSG_SENDMESSAGET, hContact, (LPARAM)msg); + CallService(MS_MSG_SENDMESSAGEW, hContact, (LPARAM)msg); mir_free(id); return 0; diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index f7c04b8097..b7c0c3ff11 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -109,7 +109,7 @@ extern "C" int __declspec(dllexport)Load(void) NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS; + nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_HTTPCONNS; nlu.szSettingsModule = "YAHOO/libyahoo2"; nlu.ptszDescriptiveName = TranslateT("YAHOO plugin HTTP connections"); g_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 321851d965..5fe42858d8 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -361,7 +361,7 @@ int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO); odp.pwszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.pwszGroup = LPGENW("Network"); odp.pwszTab = LPGENW("Account"); odp.pfnDlgProc = DlgProcYahooOpts; diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 56ad2d559e..3d47152262 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -35,7 +35,7 @@ CYahooProto::CYahooProto(const char *aProtoName, const wchar_t *aUserName) logoff_buddies(); - SkinAddNewSoundExT("mail", m_tszUserName, LPGENW("New E-mail available in Inbox")); + SkinAddNewSoundExW("mail", m_tszUserName, LPGENW("New E-mail available in Inbox")); LoadYahooServices(); } @@ -72,9 +72,9 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); #ifdef HTTP_GATEWAY - nlu.flags = NUF_OUTGOING | NUF_HTTPGATEWAY| NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_HTTPGATEWAY| NUF_HTTPCONNS | NUF_UNICODE; #else - nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; #endif nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = tModuleDescr; diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index 5b0427d2a4..8a7fa143a8 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -36,7 +36,7 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) YAHOO_SEARCH_RESULT psr; memset(&psr, 0, sizeof(psr)); psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; + psr.flags = PSR_UNICODE; psr.id.w = (wchar_t*)wcslwr(id); psr.protocol = YAHOO_IM_YAHOO; diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 4b90a00e41..965e51acd4 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -117,7 +117,7 @@ int __cdecl CYahooProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInstance; odp.dwInitParam = (LPARAM)this; - odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE; MCONTACT hContact = lParam; if (IsMyContact(hContact)) { diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index ec97c1c3f1..2d5df96084 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -217,8 +217,8 @@ void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const wchar_t * T2Utf u_msg(msg); ptrA ident(getStringA(hContact, "MyIdentity")); - ptrW fname(getTStringA(NULL, "FirstName")); - ptrW lname(getTStringA(NULL, "LastName")); + ptrW fname(getWStringA(NULL, "FirstName")); + ptrW lname(getWStringA(NULL, "LastName")); SetStringUtf(hContact, "YGroup", group); -- cgit v1.2.3