diff options
Diffstat (limited to 'toxcore/friend_requests.h')
-rw-r--r-- | toxcore/friend_requests.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h index b5c46056..c655669d 100644 --- a/toxcore/friend_requests.h +++ b/toxcore/friend_requests.h | |||
@@ -34,6 +34,8 @@ typedef struct { | |||
34 | uint8_t handle_friendrequest_isset; | 34 | uint8_t handle_friendrequest_isset; |
35 | void *handle_friendrequest_userdata; | 35 | void *handle_friendrequest_userdata; |
36 | 36 | ||
37 | int (*filter_function)(uint8_t *, void *); | ||
38 | void *filter_function_userdata; | ||
37 | /* NOTE: The following is just a temporary fix for the multiple friend requests received at the same time problem. | 39 | /* NOTE: The following is just a temporary fix for the multiple friend requests received at the same time problem. |
38 | * TODO: Make this better (This will most likely tie in with the way we will handle spam.) | 40 | * TODO: Make this better (This will most likely tie in with the way we will handle spam.) |
39 | */ | 41 | */ |
@@ -53,11 +55,17 @@ void set_nospam(Friend_Requests *fr, uint32_t num); | |||
53 | uint32_t get_nospam(Friend_Requests *fr); | 55 | uint32_t get_nospam(Friend_Requests *fr); |
54 | 56 | ||
55 | /* Set the function that will be executed when a friend request for us is received. | 57 | /* Set the function that will be executed when a friend request for us is received. |
56 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) | 58 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length, void * userdata) |
57 | */ | 59 | */ |
58 | void callback_friendrequest(Friend_Requests *fr, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), | 60 | void callback_friendrequest(Friend_Requests *fr, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), |
59 | void *userdata); | 61 | void *userdata); |
60 | 62 | ||
63 | /* Set the function used to check if a friend request should be displayed to the user or not. | ||
64 | * Function format is int function(uint8_t * public_key, void * userdata) | ||
65 | * It must return 0 if the request is ok (anything else if it is bad.) | ||
66 | */ | ||
67 | void set_filter_function(Friend_Requests *fr, int (*function)(uint8_t *, void *), void *userdata); | ||
68 | |||
61 | /* Sets up friendreq packet handlers. */ | 69 | /* Sets up friendreq packet handlers. */ |
62 | void friendreq_init(Friend_Requests *fr, Net_Crypto *c); | 70 | void friendreq_init(Friend_Requests *fr, Net_Crypto *c); |
63 | 71 | ||