summaryrefslogtreecommitdiff
path: root/toxcore/friend_requests.c
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-10 16:36:20 +0200
committerCoren[m] <Break@Ocean>2013-09-10 16:36:20 +0200
commitbcb283cf4512f36b189ce2d49eb040c205cbc778 (patch)
treeb0678f9acf245e5620d21c046265a7b3ad98c561 /toxcore/friend_requests.c
parentbcf251ac3190db4230d42be97b539e4df3af736f (diff)
big push, putting all the infrastructure in place behind TOX_ENABLE_IPV6
Diffstat (limited to 'toxcore/friend_requests.c')
-rw-r--r--toxcore/friend_requests.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c
index 51a8112f..c821d998 100644
--- a/toxcore/friend_requests.c
+++ b/toxcore/friend_requests.c
@@ -50,18 +50,22 @@ int send_friendrequest(DHT *dht, uint8_t *public_key, uint32_t nospam_num, uint8
50 if (len == -1) 50 if (len == -1)
51 return -1; 51 return -1;
52 52
53 IP_Port ip_port = DHT_getfriendip(dht, public_key); 53 IP_Port ip_port;
54 int friendok = DHT_getfriendip(dht, public_key, &ip_port);
54 55
55 if (ip_port.ip.uint32 == 1) 56 // not a friend
57 if (friendok == -1)
56 return -1; 58 return -1;
57 59
58 if (ip_port.ip.uint32 != 0) { 60 // is a friend and we know how to reach him
61 if (friendok == 1) {
59 if (sendpacket(dht->c->lossless_udp->net, ip_port, packet, len) != -1) 62 if (sendpacket(dht->c->lossless_udp->net, ip_port, packet, len) != -1)
60 return 0; 63 return 0;
61 64
62 return -1; 65 return -1;
63 } 66 }
64 67
68 // is a friend, we DON'T know how to reach him
65 int num = route_tofriend(dht, public_key, packet, len); 69 int num = route_tofriend(dht, public_key, packet, len);
66 70
67 if (num == 0) 71 if (num == 0)