From df1139ff3c50f0cffc7dc7a8a4e7310eb7e55e2d Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 23 Aug 2014 18:49:59 +0000 Subject: Tox: - fixed own status changing - refactored contacts adding git-svn-id: http://svn.miranda-ng.org/main/trunk@10315 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_account.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'protocols/Tox/src/tox_account.cpp') diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp index 2b2d2c2837..8118149cdb 100644 --- a/protocols/Tox/src/tox_account.cpp +++ b/protocols/Tox/src/tox_account.cpp @@ -27,8 +27,7 @@ void CToxProto::InitToxCore() tox = tox_new(&options); tox_callback_friend_request(tox, OnFriendRequest, this); tox_callback_friend_message(tox, OnFriendMessage, this); - tox_callback_typing_change(tox, OnFriendTyping, this); - //tox_callback_friend_action(tox, OnAction, this); + tox_callback_typing_change(tox, OnTypingChanged, this); tox_callback_name_change(tox, OnFriendNameChange, this); tox_callback_status_message(tox, OnStatusMessageChanged, this); tox_callback_user_status(tox, OnUserStatusChanged, this); @@ -87,7 +86,11 @@ void CToxProto::DoTox() void CToxProto::PollingThread(void*) { debugLogA("CToxProto::PollingThread: entering"); - + + isConnected = false; + time_t timestamp0 = time(NULL); + DoBootstrap(); + while (!isTerminated) { DoTox(); @@ -97,20 +100,25 @@ void CToxProto::PollingThread(void*) if (tox_isconnected(tox)) { isConnected = true; + debugLogA("CToxProto::PollingThread: successfuly connected to DHT"); LoadContactList(); - m_iStatus = m_iDesiredStatus = ID_STATUS_ONLINE; + m_iStatus = ID_STATUS_ONLINE; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus); - - debugLogA("CToxProto::PollingThread: successfuly connected to DHT"); } else { - DoBootstrap(); + time_t timestamp1 = time(NULL); + if (timestamp0 + 250 < timestamp1) { + timestamp0 = timestamp1; + DoBootstrap(); + } } } } + isConnected = false; + debugLogA("CToxProto::PollingThread: leaving"); } \ No newline at end of file -- cgit v1.2.3