summaryrefslogtreecommitdiff
path: root/toxcore/friend_requests.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/friend_requests.c')
-rw-r--r--toxcore/friend_requests.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c
index 122bef3b..3d10213b 100644
--- a/toxcore/friend_requests.c
+++ b/toxcore/friend_requests.c
@@ -43,12 +43,11 @@ uint32_t get_nospam(const Friend_Requests *fr)
43 43
44/* Set the function that will be executed when a friend request is received. */ 44/* Set the function that will be executed when a friend request is received. */
45void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, size_t, 45void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, size_t,
46 void *), void *object, void *userdata) 46 void *), void *object)
47{ 47{
48 fr->handle_friendrequest = function; 48 fr->handle_friendrequest = function;
49 fr->handle_friendrequest_isset = 1; 49 fr->handle_friendrequest_isset = 1;
50 fr->handle_friendrequest_object = object; 50 fr->handle_friendrequest_object = object;
51 fr->handle_friendrequest_userdata = userdata;
52} 51}
53/* Set the function used to check if a friend request should be displayed to the user or not. */ 52/* Set the function used to check if a friend request should be displayed to the user or not. */
54void set_filter_function(Friend_Requests *fr, int (*function)(const uint8_t *, void *), void *userdata) 53void set_filter_function(Friend_Requests *fr, int (*function)(const uint8_t *, void *), void *userdata)
@@ -106,7 +105,8 @@ int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk)
106} 105}
107 106
108 107
109static int friendreq_handlepacket(void *object, const uint8_t *source_pubkey, const uint8_t *packet, uint16_t length) 108static int friendreq_handlepacket(void *object, const uint8_t *source_pubkey, const uint8_t *packet, uint16_t length,
109 void *userdata)
110{ 110{
111 Friend_Requests *fr = object; 111 Friend_Requests *fr = object;
112 112
@@ -142,8 +142,7 @@ static int friendreq_handlepacket(void *object, const uint8_t *source_pubkey, co
142 memcpy(message, packet + sizeof(fr->nospam), message_len); 142 memcpy(message, packet + sizeof(fr->nospam), message_len);
143 message[sizeof(message) - 1] = 0; /* Be sure the message is null terminated. */ 143 message[sizeof(message) - 1] = 0; /* Be sure the message is null terminated. */
144 144
145 (*fr->handle_friendrequest)(fr->handle_friendrequest_object, source_pubkey, message, message_len, 145 (*fr->handle_friendrequest)(fr->handle_friendrequest_object, source_pubkey, message, message_len, userdata);
146 fr->handle_friendrequest_userdata);
147 return 0; 146 return 0;
148} 147}
149 148