diff options
Diffstat (limited to 'core/friend_requests.c')
-rw-r--r-- | core/friend_requests.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/friend_requests.c b/core/friend_requests.c index 422cc028..5e9b447c 100644 --- a/core/friend_requests.c +++ b/core/friend_requests.c | |||
@@ -57,14 +57,15 @@ int send_friendrequest(uint8_t * public_key, uint8_t * data, uint32_t length) | |||
57 | return num; | 57 | return num; |
58 | } | 58 | } |
59 | 59 | ||
60 | static void (*handle_friendrequest)(uint8_t *, uint8_t *, uint16_t); | 60 | static void (*handle_friendrequest)(uint8_t *, uint8_t *, uint16_t, void*); |
61 | static uint8_t handle_friendrequest_isset = 0; | 61 | static uint8_t handle_friendrequest_isset = 0; |
62 | 62 | static void* handle_friendrequest_userdata; | |
63 | /* set the function that will be executed when a friend request is received. */ | 63 | /* set the function that will be executed when a friend request is received. */ |
64 | void callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t)) | 64 | void callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t, void*), void* userdata) |
65 | { | 65 | { |
66 | handle_friendrequest = function; | 66 | handle_friendrequest = function; |
67 | handle_friendrequest_isset = 1; | 67 | handle_friendrequest_isset = 1; |
68 | handle_friendrequest_userdata = userdata; | ||
68 | } | 69 | } |
69 | 70 | ||
70 | 71 | ||
@@ -121,7 +122,7 @@ static int friendreq_handlepacket(IP_Port source, uint8_t * packet, uint32_t len | |||
121 | return 1; | 122 | return 1; |
122 | 123 | ||
123 | addto_receivedlist(public_key); | 124 | addto_receivedlist(public_key); |
124 | (*handle_friendrequest)(public_key, data, len); | 125 | (*handle_friendrequest)(public_key, data, len, handle_friendrequest_userdata); |
125 | } else { /* if request is not for us, try routing it. */ | 126 | } else { /* if request is not for us, try routing it. */ |
126 | if(route_packet(packet + 1, packet, length) == length) | 127 | if(route_packet(packet + 1, packet, length) == length) |
127 | return 0; | 128 | return 0; |