From 697c3a9ab13f212655a713c60e2be895b02334da Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Tue, 17 Feb 2015 06:43:34 +0000 Subject: Tox: - fixed (strange hack) profile loading - reverted frend list loading on login git-svn-id: http://svn.miranda-ng.org/main/trunk@12157 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_network.cpp | 3 +++ protocols/Tox/src/tox_profile.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'protocols/Tox') diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 7d3eb4c5a2..71ec195ccb 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -48,6 +48,9 @@ void CToxProto::TryConnect() { isConnected = true; debugLogA("CToxProto::PollingThread: successfuly connected to DHT"); + + ForkThread(&CToxProto::LoadFriendList, NULL); + m_iStatus = m_iDesiredStatus; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus); tox_set_user_status(tox, MirandaToToxStatus(m_iStatus)); diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 9bb69f6289..f5a35c6629 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -31,7 +31,7 @@ bool CToxProto::LoadToxProfile() } fseek(profile, 0, SEEK_END); - long size = ftell(profile); + size_t size = ftell(profile); rewind(profile); if (size == 0) { @@ -41,7 +41,7 @@ bool CToxProto::LoadToxProfile() } uint8_t *data = (uint8_t*)mir_calloc(size); - if (fread((char*)data, sizeof(char), size, profile) != (size_t)size) + if (fread((char*)data, sizeof(char), size, profile) != size) { fclose(profile); debugLogA("CToxProto::LoadToxData: could not read tox profile"); @@ -74,7 +74,8 @@ bool CToxProto::LoadToxProfile() } else { - if (tox_load(tox, data, size) == TOX_ERROR) + // it return -1 but load, wtf? + if (tox_load(tox, data, size) > 0) { debugLogA("CToxProto::LoadToxData: could not load tox profile"); mir_free(data); -- cgit v1.2.3