From 591fc6380f5610588661cdbb8097f0f1ac3a16fb Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 18 Jun 2016 12:51:36 +0000 Subject: Tox: attempt to fix nickname setting git-svn-id: http://svn.miranda-ng.org/main/trunk@17006 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_core.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'protocols/Tox/src/tox_core.cpp') diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index 0188265f18..b535597a0e 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -91,13 +91,31 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) ToxHexAddress address(data); setString(TOX_SETTINGS_ID, address); - uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; + TOX_ERR_SET_INFO error; + + /*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; tox_self_get_name(toxThread->Tox(), nick); - setTString("Nick", ptrT(Utf8DecodeT((char*)nick))); + setTString("Nick", ptrT(Utf8DecodeT((char*)nick)));*/ + + ptrA nick(mir_utf8encodeT(ptrT(getTStringA("Nick")))); + tox_self_set_name(toxThread->Tox(), (uint8_t*)(char*)nick, mir_strlen(nick), &error); + if (error != TOX_ERR_SET_INFO_OK) + { + debugLogA(__FUNCTION__": failed to set self name (%d)", error); + return NULL; + } - uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 }; + /*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 }; tox_self_get_status_message(toxThread->Tox(), statusMessage); - setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage))); + setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));*/ + + ptrA statusMessage(mir_utf8encodeT(ptrT(getTStringA("StatusMsg")))); + tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, mir_strlen(statusMessage), &error); + if (error != TOX_ERR_SET_INFO_OK) + { + debugLogA(__FUNCTION__": failed to set self status message (%d)", error); + return NULL; + } return true; } -- cgit v1.2.3