summaryrefslogtreecommitdiff
path: root/toxcore/friend_requests.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-11-27 14:18:39 -0500
committerirungentoo <irungentoo@gmail.com>2013-11-27 14:18:39 -0500
commit74b13a9fcfdce5d9513b3d58a9f647a68981b3ed (patch)
tree562630675850be2a3a1030ba482d3a27482883e3 /toxcore/friend_requests.h
parent3fe7e087913d07c5805a9e27c267476527de0e84 (diff)
Friend requests from friends are now discarded.
Diffstat (limited to 'toxcore/friend_requests.h')
-rw-r--r--toxcore/friend_requests.h10
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);
53uint32_t get_nospam(Friend_Requests *fr); 55uint32_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 */
58void callback_friendrequest(Friend_Requests *fr, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), 60void 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 */
67void 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. */
62void friendreq_init(Friend_Requests *fr, Net_Crypto *c); 70void friendreq_init(Friend_Requests *fr, Net_Crypto *c);
63 71