From 559624af12bf19b4bc925cf3f95c6fbd809cc4fb Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Tue, 30 Sep 2014 19:00:16 +0000 Subject: Tox: - utf8 support in search window - try to hide tox id git-svn-id: http://svn.miranda-ng.org/main/trunk@10654 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/common.h | 1 + protocols/Tox/src/tox_proto.cpp | 4 ++-- protocols/Tox/src/tox_search.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/protocols/Tox/src/common.h b/protocols/Tox/src/common.h index d28a9f1495..ef94231761 100644 --- a/protocols/Tox/src/common.h +++ b/protocols/Tox/src/common.h @@ -46,6 +46,7 @@ extern HINSTANCE g_hInstance; #define TOX_ERROR -1 #define TOX_SETTINGS_ID "ToxID" +#define TOX_SETTINGS_DNS "DnsID" #define TOX_SETTINGS_GROUP "DefaultGroup" #define TOX_SETTINGS_AVATAR_HASH "AvatarHash" diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index be66970f60..54814135c9 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -66,9 +66,9 @@ DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT hContact) return PF4_IMSENDUTF | PF4_SINGLEFILEONLY | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)"Tox ID"; + return (INT_PTR)"Dns ID"; case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR)TOX_SETTINGS_ID; + return (DWORD_PTR)TOX_SETTINGS_DNS; case PFLAG_MAXLENOFMESSAGE: return TOX_MAX_MESSAGE_LENGTH; } diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 22cf2e78f9..8e1df68786 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -48,10 +48,10 @@ void CToxProto::SearchByNameAsync(void *arg) PROTOSEARCHRESULT psr = { sizeof(PROTOSEARCHRESULT) }; psr.flags = PSR_TCHAR; psr.id = mir_a2t(id.c_str()); - psr.nick = mir_a2t(name); + psr.nick = mir_utf8decodeT(name); TCHAR email[MAX_PATH]; - mir_sntprintf(email, SIZEOF(email), _T("%s@%s"), _A2T(name), _A2T(server->domain)); + mir_sntprintf(email, SIZEOF(email), _T("%s@%s"), psr.nick, _A2T(server->domain)); psr.email = mir_tstrdup(email); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); @@ -108,10 +108,10 @@ HWND __cdecl CToxProto::SearchAdvanced(HWND owner) std::smatch match; std::regex regex("^\\s*([A-Fa-f0-9]{76})\\s*$"); - char text[TOX_FRIEND_ADDRESS_SIZE * 2 + 1]; - GetDlgItemTextA(owner, IDC_SEARCH, text, SIZEOF(text)); + TCHAR text[MAX_PATH]; + GetDlgItemText(owner, IDC_SEARCH, text, SIZEOF(text)); - const std::string query = text; + const std::string query = ptrA(mir_utf8encodeT(text)); if (std::regex_search(query, match, regex)) { std::string address = match[1]; -- cgit v1.2.3