summaryrefslogtreecommitdiff
path: root/core/friend_requests.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/friend_requests.c')
-rw-r--r--core/friend_requests.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/friend_requests.c b/core/friend_requests.c
index 3708f154..7be7a4bd 100644
--- a/core/friend_requests.c
+++ b/core/friend_requests.c
@@ -24,7 +24,7 @@
24#include "friend_requests.h" 24#include "friend_requests.h"
25 25
26uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; 26uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
27 27uint8_t self_secret_key[crypto_box_SECRETKEYBYTES];
28 28
29/* Try to send a friendrequest to peer with public_key 29/* Try to send a friendrequest to peer with public_key
30 data is the data in the request and length is the length. 30 data is the data in the request and length is the length.
@@ -40,7 +40,7 @@ int send_friendrequest(uint8_t *public_key, uint32_t nospam_num, uint8_t *data,
40 memcpy(temp, &nospam_num, sizeof(nospam_num)); 40 memcpy(temp, &nospam_num, sizeof(nospam_num));
41 memcpy(temp + sizeof(nospam_num), data, length); 41 memcpy(temp + sizeof(nospam_num), data, length);
42 uint8_t packet[MAX_DATA_SIZE]; 42 uint8_t packet[MAX_DATA_SIZE];
43 int len = create_request(packet, public_key, temp, length + sizeof(nospam_num), 43 int len = create_request(self_public_key, self_secret_key, packet, public_key, temp, length + sizeof(nospam_num),
44 32); /* 32 is friend request packet id */ 44 32); /* 32 is friend request packet id */
45 45
46 if (len == -1) 46 if (len == -1)
@@ -52,7 +52,7 @@ int send_friendrequest(uint8_t *public_key, uint32_t nospam_num, uint8_t *data,
52 return -1; 52 return -1;
53 53
54 if (ip_port.ip.i != 0) { 54 if (ip_port.ip.i != 0) {
55 if (sendpacket(ip_port, packet, len) != -1) 55 if (sendpacket(temp_net->sock, ip_port, packet, len) != -1)
56 return 0; 56 return 0;
57 57
58 return -1; 58 return -1;
@@ -146,5 +146,5 @@ static int friendreq_handlepacket(IP_Port source, uint8_t *source_pubkey, uint8_
146 146
147void friendreq_init(void) 147void friendreq_init(void)
148{ 148{
149 cryptopacket_registerhandler(32, &friendreq_handlepacket); 149 cryptopacket_registerhandler(temp_net_crypto, 32, &friendreq_handlepacket);
150} 150}