summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/Messenger.c30
-rw-r--r--toxcore/Messenger.h5
2 files changed, 0 insertions, 35 deletions
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)
52 return 1; 52 return 1;
53} 53}
54 54
55static int add_online_friend(Messenger *m, int32_t friendnumber)
56{
57 if (friend_not_valid(m, friendnumber))
58 return -1;
59
60 ++m->numonline_friends;
61 return 0;
62}
63
64
65static int remove_online_friend(Messenger *m, int32_t friendnumber)
66{
67 if (friend_not_valid(m, friendnumber))
68 return -1;
69
70 --m->numonline_friends;
71 return 0;
72}
73/* Set the size of the friend list to numfriends. 55/* Set the size of the friend list to numfriends.
74 * 56 *
75 * return -1 if realloc fails. 57 * return -1 if realloc fails.
@@ -399,9 +381,6 @@ int m_delfriend(Messenger *m, int32_t friendnumber)
399 if (friend_not_valid(m, friendnumber)) 381 if (friend_not_valid(m, friendnumber))
400 return -1; 382 return -1;
401 383
402 if (m->friendlist[friendnumber].status == FRIEND_ONLINE)
403 remove_online_friend(m, friendnumber);
404
405 clear_receipts(m, friendnumber); 384 clear_receipts(m, friendnumber);
406 remove_request_received(&(m->fr), m->friendlist[friendnumber].real_pk); 385 remove_request_received(&(m->fr), m->friendlist[friendnumber].real_pk);
407 friend_connection_callbacks(m->fr_c, m->friendlist[friendnumber].friendcon_id, MESSENGER_CALLBACK_INDEX, 0, 0, 0, 0, 0); 386 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
884 if (is_online != was_online) { 863 if (is_online != was_online) {
885 if (was_online) { 864 if (was_online) {
886 break_files(m, friendnumber); 865 break_files(m, friendnumber);
887 remove_online_friend(m, friendnumber);
888 clear_receipts(m, friendnumber); 866 clear_receipts(m, friendnumber);
889 } else {
890 add_online_friend(m, friendnumber);
891 } 867 }
892 868
893 m->friendlist[friendnumber].status = status; 869 m->friendlist[friendnumber].status = status;
@@ -2738,12 +2714,6 @@ uint32_t count_friendlist(const Messenger *m)
2738 return ret; 2714 return ret;
2739} 2715}
2740 2716
2741/* Return the number of online friends in the instance m. */
2742uint32_t get_num_online_friends(const Messenger *m)
2743{
2744 return m->numonline_friends;
2745}
2746
2747/* Copy a list of valid friend IDs into the array out_list. 2717/* Copy a list of valid friend IDs into the array out_list.
2748 * If out_list is NULL, returns 0. 2718 * If out_list is NULL, returns 0.
2749 * Otherwise, returns the number of elements copied. 2719 * 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 {
231 Friend *friendlist; 231 Friend *friendlist;
232 uint32_t numfriends; 232 uint32_t numfriends;
233 233
234 uint32_t numonline_friends;
235
236#define NUM_SAVED_TCP_RELAYS 8 234#define NUM_SAVED_TCP_RELAYS 8
237 uint8_t has_added_relays; // If the first connection has occurred in do_messenger 235 uint8_t has_added_relays; // If the first connection has occurred in do_messenger
238 Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config 236 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);
771 * for copy_friendlist. */ 769 * for copy_friendlist. */
772uint32_t count_friendlist(const Messenger *m); 770uint32_t count_friendlist(const Messenger *m);
773 771
774/* Return the number of online friends in the instance m. */
775uint32_t get_num_online_friends(const Messenger *m);
776
777/* Copy a list of valid friend IDs into the array out_list. 772/* Copy a list of valid friend IDs into the array out_list.
778 * If out_list is NULL, returns 0. 773 * If out_list is NULL, returns 0.
779 * Otherwise, returns the number of elements copied. 774 * Otherwise, returns the number of elements copied.