summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_options.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-06-18 12:51:36 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-06-18 12:51:36 +0000
commit591fc6380f5610588661cdbb8097f0f1ac3a16fb (patch)
treee16a159c377c127fec1c17cdafa39ad346f6aac8 /protocols/Tox/src/tox_options.cpp
parente7d18ae97ecbe5db4c9a511afc4c05fa9bf8204b (diff)
Tox: attempt to fix nickname setting
git-svn-id: http://svn.miranda-ng.org/main/trunk@17006 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_options.cpp')
-rw-r--r--protocols/Tox/src/tox_options.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index b6cad21929..887ebe88ab 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -127,7 +127,37 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(profilePath, defaultProfilePath, FALSE);
- m_profileCreate.OnClick(&m_profileCreate);
+ Tox_Options *options = NULL;
+ tox_options_default(options);
+ if (m_proto->LoadToxProfile(options))
+ {
+ CToxThread toxThread(options);
+
+ uint8_t data[TOX_ADDRESS_SIZE];
+ tox_self_get_address(toxThread.Tox(), data);
+ ToxHexAddress address(data);
+ m_proto->setString(TOX_SETTINGS_ID, address);
+
+ m_toxAddress.Enable();
+ m_toxAddress.SetTextA(address);
+
+ uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
+ tox_self_get_name(toxThread.Tox(), nick);
+ ptrT nickname(Utf8DecodeT((char*)nick));
+ m_proto->setTString("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", ptrT(Utf8DecodeT((char*)statusMessage)));
+
+ ShowWindow(m_profileCreate.GetHwnd(), FALSE);
+ ShowWindow(m_profileImport.GetHwnd(), FALSE);
+
+ ShowWindow(m_toxAddressCopy.GetHwnd(), TRUE);
+ ShowWindow(m_profileExport.GetHwnd(), TRUE);
+ }
+ tox_options_free(options);
}
void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)