mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
added API function to get online friend count
This commit is contained in:
parent
9c022832db
commit
e9f3477d69
|
@ -665,8 +665,12 @@ static void check_friend_connectionstatus(Messenger *m, int friendnumber, uint8_
|
|||
onion_set_friend_online(m->onion_c, m->friendlist[friendnumber].onion_friendnum, is_online);
|
||||
|
||||
if (is_online != was_online) {
|
||||
if (was_online)
|
||||
if (was_online) {
|
||||
break_files(m, friendnumber);
|
||||
--m->numonline_friends;
|
||||
} else {
|
||||
++m->numonline_friends;
|
||||
}
|
||||
|
||||
m->friend_connectionstatuschange(m, friendnumber, is_online, m->friend_connectionstatuschange_userdata);
|
||||
}
|
||||
|
@ -2360,6 +2364,12 @@ uint32_t count_friendlist(Messenger *m)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Return the number of online friends in the instance m. */
|
||||
uint32_t get_num_online_friends(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.
|
||||
|
|
|
@ -178,6 +178,7 @@ typedef struct Messenger {
|
|||
|
||||
Friend *friendlist;
|
||||
uint32_t numfriends;
|
||||
uint32_t numonline_friends;
|
||||
|
||||
Group_Chat **chats;
|
||||
uint32_t numchats;
|
||||
|
@ -682,6 +683,9 @@ int messenger_load_encrypted(Messenger *m, uint8_t *data, uint32_t length, uint8
|
|||
* for copy_friendlist. */
|
||||
uint32_t count_friendlist(Messenger *m);
|
||||
|
||||
/* Return the number of online friends in the instance m. */
|
||||
uint32_t get_num_online_friends(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.
|
||||
|
|
|
@ -289,6 +289,13 @@ uint32_t tox_count_friendlist(Tox *tox)
|
|||
return count_friendlist(m);
|
||||
}
|
||||
|
||||
/* Return the number of online friends in the instance m. */
|
||||
uint32_t tox_get_num_online_friends(Tox *tox)
|
||||
{
|
||||
Messenger *m = tox;
|
||||
return get_num_online_friends(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.
|
||||
|
|
|
@ -284,6 +284,9 @@ void tox_set_sends_receipts(Tox *tox, int friendnumber, int yesno);
|
|||
* for copy_friendlist. */
|
||||
uint32_t tox_count_friendlist(Tox *tox);
|
||||
|
||||
/* Return the number of online friends in the instance m. */
|
||||
uint32_t tox_get_num_online_friends(Tox *tox);
|
||||
|
||||
/* 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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user