diff options
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 8113a8f0..472ddd9e 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -168,7 +168,7 @@ static int send_offline_packet(Messenger *m, int friendcon_id) | |||
168 | sizeof(packet), 0) != -1; | 168 | sizeof(packet), 0) != -1; |
169 | } | 169 | } |
170 | 170 | ||
171 | static int handle_status(void *object, int i, uint8_t status); | 171 | static int handle_status(void *object, int i, uint8_t status, void *userdata); |
172 | static int handle_packet(void *object, int i, const uint8_t *temp, uint16_t len, void *userdata); | 172 | static int handle_packet(void *object, int i, const uint8_t *temp, uint16_t len, void *userdata); |
173 | static int handle_custom_lossy_packet(void *object, int friend_num, const uint8_t *packet, uint16_t length); | 173 | static int handle_custom_lossy_packet(void *object, int friend_num, const uint8_t *packet, uint16_t length); |
174 | 174 | ||
@@ -450,8 +450,8 @@ int m_get_friend_connectionstatus(const Messenger *m, int32_t friendnumber) | |||
450 | if (m->friendlist[friendnumber].status == FRIEND_ONLINE) { | 450 | if (m->friendlist[friendnumber].status == FRIEND_ONLINE) { |
451 | _Bool direct_connected = 0; | 451 | _Bool direct_connected = 0; |
452 | unsigned int num_online_relays = 0; | 452 | unsigned int num_online_relays = 0; |
453 | crypto_connection_status(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c, | 453 | int crypt_conn_id = friend_connection_crypt_connection_id(m->fr_c, m->friendlist[friendnumber].friendcon_id); |
454 | m->friendlist[friendnumber].friendcon_id), &direct_connected, &num_online_relays); | 454 | crypto_connection_status(m->net_crypto, crypt_conn_id, &direct_connected, &num_online_relays); |
455 | 455 | ||
456 | if (direct_connected) { | 456 | if (direct_connected) { |
457 | return CONNECTION_UDP; | 457 | return CONNECTION_UDP; |
@@ -836,10 +836,9 @@ void m_callback_log(Messenger *m, logger_cb *function, void *userdata) | |||
836 | 836 | ||
837 | /* Set the function that will be executed when a friend request is received. */ | 837 | /* Set the function that will be executed when a friend request is received. */ |
838 | void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const uint8_t *, const uint8_t *, size_t, | 838 | void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const uint8_t *, const uint8_t *, size_t, |
839 | void *), void *userdata) | 839 | void *)) |
840 | { | 840 | { |
841 | void (*handle_friendrequest)(void *, const uint8_t *, const uint8_t *, size_t, void *) = (void *)function; | 841 | callback_friendrequest(&(m->fr), (void (*)(void *, const uint8_t *, const uint8_t *, size_t, void *))function, m); |
842 | callback_friendrequest(&(m->fr), handle_friendrequest, m, userdata); | ||
843 | } | 842 | } |
844 | 843 | ||
845 | /* Set the function that will be executed when a message from a friend is received. */ | 844 | /* Set the function that will be executed when a message from a friend is received. */ |
@@ -2040,7 +2039,7 @@ static void check_friend_request_timed_out(Messenger *m, uint32_t i, uint64_t t) | |||
2040 | } | 2039 | } |
2041 | } | 2040 | } |
2042 | 2041 | ||
2043 | static int handle_status(void *object, int i, uint8_t status) | 2042 | static int handle_status(void *object, int i, uint8_t status, void *userdata) |
2044 | { | 2043 | { |
2045 | Messenger *m = object; | 2044 | Messenger *m = object; |
2046 | 2045 | ||
@@ -2500,7 +2499,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2500 | 2499 | ||
2501 | do_net_crypto(m->net_crypto, userdata); | 2500 | do_net_crypto(m->net_crypto, userdata); |
2502 | do_onion_client(m->onion_c); | 2501 | do_onion_client(m->onion_c); |
2503 | do_friend_connections(m->fr_c); | 2502 | do_friend_connections(m->fr_c, userdata); |
2504 | do_friends(m, userdata); | 2503 | do_friends(m, userdata); |
2505 | connection_status_cb(m, userdata); | 2504 | connection_status_cb(m, userdata); |
2506 | 2505 | ||