diff options
Diffstat (limited to 'core/friend_requests.c')
-rw-r--r-- | core/friend_requests.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/friend_requests.c b/core/friend_requests.c index b723de36..ee2da633 100644 --- a/core/friend_requests.c +++ b/core/friend_requests.c | |||
@@ -37,7 +37,8 @@ int send_friendrequest(DHT *dht, uint8_t *public_key, uint32_t nospam_num, uint8 | |||
37 | memcpy(temp, &nospam_num, sizeof(nospam_num)); | 37 | memcpy(temp, &nospam_num, sizeof(nospam_num)); |
38 | memcpy(temp + sizeof(nospam_num), data, length); | 38 | memcpy(temp + sizeof(nospam_num), data, length); |
39 | uint8_t packet[MAX_DATA_SIZE]; | 39 | uint8_t packet[MAX_DATA_SIZE]; |
40 | int len = create_request(dht->c->self_public_key, dht->c->self_secret_key, packet, public_key, temp, length + sizeof(nospam_num), | 40 | int len = create_request(dht->c->self_public_key, dht->c->self_secret_key, packet, public_key, temp, |
41 | length + sizeof(nospam_num), | ||
41 | 32); /* 32 is friend request packet id */ | 42 | 32); /* 32 is friend request packet id */ |
42 | 43 | ||
43 | if (len == -1) | 44 | if (len == -1) |
@@ -79,7 +80,8 @@ uint32_t get_nospam(Friend_Requests *fr) | |||
79 | 80 | ||
80 | 81 | ||
81 | /* set the function that will be executed when a friend request is received. */ | 82 | /* set the function that will be executed when a friend request is received. */ |
82 | void callback_friendrequest(Friend_Requests *fr, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata) | 83 | void callback_friendrequest(Friend_Requests *fr, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), |
84 | void *userdata) | ||
83 | { | 85 | { |
84 | fr->handle_friendrequest = function; | 86 | fr->handle_friendrequest = function; |
85 | fr->handle_friendrequest_isset = 1; | 87 | fr->handle_friendrequest_isset = 1; |
@@ -111,9 +113,11 @@ static int request_received(Friend_Requests *fr, uint8_t *client_id) | |||
111 | } | 113 | } |
112 | 114 | ||
113 | 115 | ||
114 | static int friendreq_handlepacket(void *object, IP_Port source, uint8_t *source_pubkey, uint8_t *packet, uint32_t length) | 116 | static int friendreq_handlepacket(void *object, IP_Port source, uint8_t *source_pubkey, uint8_t *packet, |
117 | uint32_t length) | ||
115 | { | 118 | { |
116 | Friend_Requests *fr = object; | 119 | Friend_Requests *fr = object; |
120 | |||
117 | if (fr->handle_friendrequest_isset == 0) | 121 | if (fr->handle_friendrequest_isset == 0) |
118 | return 1; | 122 | return 1; |
119 | 123 | ||