summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/client.c b/client.c
index 4bf109b..197d840 100644
--- a/client.c
+++ b/client.c
@@ -360,6 +360,7 @@ int do_client_loop(uint8_t *tox_id_str)
360 else 360 else
361 { 361 {
362 last_friend_connection_status_received = time(NULL); 362 last_friend_connection_status_received = time(NULL);
363 last_friend_connection_status = friend_connection_status;
363 364
364 if(friend_connection_status != TOX_CONNECTION_NONE) 365 if(friend_connection_status != TOX_CONNECTION_NONE)
365 { 366 {
@@ -575,8 +576,25 @@ int do_client_loop(uint8_t *tox_id_str)
575 576
576 fds = client_master_fdset; 577 fds = client_master_fdset;
577 578
578 if(time(NULL) - last_friend_connection_status_received > 60) 579 if(time(NULL) - last_friend_connection_status_received > 15)
579 { 580 {
581 TOX_CONNECTION friend_connection_status;
582 friend_connection_status = tox_friend_get_connection_status(tox, friendnumber, &friend_query_error);
583 if(friend_query_error != TOX_ERR_FRIEND_QUERY_OK)
584 {
585 log_printf(L_DEBUG, "tox_friend_get_connection_status: error %u", friend_query_error);
586 }
587 else
588 {
589 if(friend_connection_status != last_friend_connection_status)
590 {
591 const char* status = readable_connection_status(friend_connection_status);
592 log_printf(L_INFO, "Friend connection status changed to: %s\n", status);
593 }
594
595 last_friend_connection_status_received = time(NULL);
596 last_friend_connection_status = friend_connection_status;
597 }
580 } 598 }
581 } 599 }
582 break; 600 break;