diff options
Diffstat (limited to 'core/friend_requests.h')
-rw-r--r-- | core/friend_requests.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/core/friend_requests.h b/core/friend_requests.h deleted file mode 100644 index 2ebd557b..00000000 --- a/core/friend_requests.h +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* friend_requests.h | ||
2 | * | ||
3 | * Handle friend requests. | ||
4 | * | ||
5 | * Copyright (C) 2013 Tox project All Rights Reserved. | ||
6 | * | ||
7 | * This file is part of Tox. | ||
8 | * | ||
9 | * Tox is free software: you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation, either version 3 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * Tox is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef FRIEND_REQUESTS_H | ||
25 | #define FRIEND_REQUESTS_H | ||
26 | |||
27 | #include "DHT.h" | ||
28 | #include "net_crypto.h" | ||
29 | |||
30 | #ifdef __cplusplus | ||
31 | extern "C" { | ||
32 | #endif | ||
33 | |||
34 | typedef struct { | ||
35 | uint32_t nospam; | ||
36 | void (*handle_friendrequest)(uint8_t *, uint8_t *, uint16_t, void *); | ||
37 | uint8_t handle_friendrequest_isset; | ||
38 | void *handle_friendrequest_userdata; | ||
39 | |||
40 | /*NOTE: the following is just a temporary fix for the multiple friend requests received at the same time problem | ||
41 | TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/ | ||
42 | |||
43 | #define MAX_RECEIVED_STORED 32 | ||
44 | |||
45 | uint8_t received_requests[MAX_RECEIVED_STORED][crypto_box_PUBLICKEYBYTES]; | ||
46 | uint16_t received_requests_index; | ||
47 | } Friend_Requests; | ||
48 | |||
49 | /* Try to send a friendrequest to peer with public_key | ||
50 | data is the data in the request and length is the length. */ | ||
51 | int send_friendrequest(DHT *dht, uint8_t *public_key, uint32_t nospam_num, uint8_t *data, uint32_t length); | ||
52 | /* | ||
53 | * Set and get the nospam variable used to prevent one type of friend request spam | ||
54 | */ | ||
55 | void set_nospam(Friend_Requests *fr, uint32_t num); | ||
56 | uint32_t get_nospam(Friend_Requests *fr); | ||
57 | |||
58 | /* set the function that will be executed when a friend request for us is received. | ||
59 | function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) */ | ||
60 | void callback_friendrequest(Friend_Requests *fr, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), | ||
61 | void *userdata); | ||
62 | |||
63 | /* sets up friendreq packet handlers */ | ||
64 | void friendreq_init(Friend_Requests *fr, Net_Crypto *c); | ||
65 | |||
66 | #ifdef __cplusplus | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | #endif | ||