diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-07-08 15:30:19 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-07-08 22:02:52 +0000 |
commit | 76e1d05da631e8eec8b370fb4f2d775ed8e2aaa7 (patch) | |
tree | 24c79c1010d7c24dec908ee9623616291dd5fef3 /toxcore/friend_requests.h | |
parent | c0c309873775824e2cb4d029e469c8dd12903976 (diff) |
Use named function types for friend_requests callbacks.
Also:
* `#define` must be scoped. If it's used outside a scope, it must be
defined outside that scope (global `#define` does not need a matching
`#undef`).
Diffstat (limited to 'toxcore/friend_requests.h')
-rw-r--r-- | toxcore/friend_requests.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h index 91571775..97cd3164 100644 --- a/toxcore/friend_requests.h +++ b/toxcore/friend_requests.h | |||
@@ -48,11 +48,13 @@ typedef void fr_friend_request_cb(void *, const uint8_t *, const uint8_t *, size | |||
48 | */ | 48 | */ |
49 | void callback_friendrequest(Friend_Requests *fr, fr_friend_request_cb *function, void *object); | 49 | void callback_friendrequest(Friend_Requests *fr, fr_friend_request_cb *function, void *object); |
50 | 50 | ||
51 | typedef int filter_function_cb(const uint8_t *, void *); | ||
52 | |||
51 | /* Set the function used to check if a friend request should be displayed to the user or not. | 53 | /* Set the function used to check if a friend request should be displayed to the user or not. |
52 | * Function format is int function(uint8_t * public_key, void * userdata) | 54 | * Function format is int function(uint8_t * public_key, void * userdata) |
53 | * It must return 0 if the request is ok (anything else if it is bad.) | 55 | * It must return 0 if the request is ok (anything else if it is bad.) |
54 | */ | 56 | */ |
55 | void set_filter_function(Friend_Requests *fr, int (*function)(const uint8_t *, void *), void *userdata); | 57 | void set_filter_function(Friend_Requests *fr, filter_function_cb *function, void *userdata); |
56 | 58 | ||
57 | /* Sets up friendreq packet handlers. */ | 59 | /* Sets up friendreq packet handlers. */ |
58 | void friendreq_init(Friend_Requests *fr, Friend_Connections *fr_c); | 60 | void friendreq_init(Friend_Requests *fr, Friend_Connections *fr_c); |