diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index a7e0a9fe..5b7a7f61 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -52,24 +52,6 @@ static uint8_t friend_not_valid(const Messenger *m, int32_t friendnumber) return 1; } -static int add_online_friend(Messenger *m, int32_t friendnumber) -{ - if (friend_not_valid(m, friendnumber)) - return -1; - - ++m->numonline_friends; - return 0; -} - - -static int remove_online_friend(Messenger *m, int32_t friendnumber) -{ - if (friend_not_valid(m, friendnumber)) - return -1; - - --m->numonline_friends; - return 0; -} /* Set the size of the friend list to numfriends. * * return -1 if realloc fails. @@ -399,9 +381,6 @@ int m_delfriend(Messenger *m, int32_t friendnumber) if (friend_not_valid(m, friendnumber)) return -1; - if (m->friendlist[friendnumber].status == FRIEND_ONLINE) - remove_online_friend(m, friendnumber); - clear_receipts(m, friendnumber); remove_request_received(&(m->fr), m->friendlist[friendnumber].real_pk); friend_connection_callbacks(m->fr_c, m->friendlist[friendnumber].friendcon_id, MESSENGER_CALLBACK_INDEX, 0, 0, 0, 0, 0); @@ -884,10 +863,7 @@ static void check_friend_connectionstatus(Messenger *m, int32_t friendnumber, ui if (is_online != was_online) { if (was_online) { break_files(m, friendnumber); - remove_online_friend(m, friendnumber); clear_receipts(m, friendnumber); - } else { - add_online_friend(m, friendnumber); } m->friendlist[friendnumber].status = status; @@ -2738,12 +2714,6 @@ uint32_t count_friendlist(const Messenger *m) return ret; } -/* Return the number of online friends in the instance m. */ -uint32_t get_num_online_friends(const Messenger *m) -{ - return m->numonline_friends; -} - /* Copy a list of valid friend IDs into the array out_list. * If out_list is NULL, returns 0. * Otherwise, returns the number of elements copied. diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 984fa545..8ab6b6ed 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h @@ -231,8 +231,6 @@ struct Messenger { Friend *friendlist; uint32_t numfriends; - uint32_t numonline_friends; - #define NUM_SAVED_TCP_RELAYS 8 uint8_t has_added_relays; // If the first connection has occurred in do_messenger Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config @@ -771,9 +769,6 @@ int messenger_load(Messenger *m, const uint8_t *data, uint32_t length); * for copy_friendlist. */ uint32_t count_friendlist(const Messenger *m); -/* Return the number of online friends in the instance m. */ -uint32_t get_num_online_friends(const Messenger *m); - /* Copy a list of valid friend IDs into the array out_list. * If out_list is NULL, returns 0. * Otherwise, returns the number of elements copied.