summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
authorz3bra <contactatz3bradotorg>2016-11-25 08:13:34 +0100
committerz3bra <contactatz3bradotorg>2016-11-25 08:13:34 +0100
commit2a1638db2e7e390d7d87d45169692cdc01b33048 (patch)
tree3add2823ee8556c2db1816430fa90333b79cf3d9 /ratox.c
parentae00397f4c17f72e08b07210cfcec2fb964a352d (diff)
Fix accepting friend requests
Actually passes the friend number returned by tox_friend_add_norequest() to the friendcreate() function.
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ratox.c b/ratox.c
index 7eae5cf..010c887 100644
--- a/ratox.c
+++ b/ratox.c
@@ -1550,7 +1550,7 @@ loop(void)
size_t i;
int connected = 0, n, r, fd, fdmax;
char tstamp[64], c;
- uint32_t e;
+ uint32_t frnum;
t0 = time(NULL);
logmsg("DHT > Connecting\n");
@@ -1705,18 +1705,18 @@ loop(void)
continue;
if (c != '0' && c != '1')
continue;
- e = tox_friend_add_norequest(tox, req->id, NULL);
- if (e == UINT32_MAX) {
+ frnum = tox_friend_add_norequest(tox, req->id, NULL);
+ if (frnum == UINT32_MAX) {
weprintf("Failed to add friend %s\n", req->idstr);
fiforeset(gslots[REQUEST].fd[OUT], &req->fd, reqfifo);
continue;
}
if (c == '1') {
- friendcreate(r);
+ friendcreate(frnum);
logmsg("Request : %s > Accepted\n", req->idstr);
datasave();
} else {
- tox_friend_delete(tox, r, NULL);
+ tox_friend_delete(tox, frnum, NULL);
logmsg("Request : %s > Rejected\n", req->idstr);
}
unlinkat(gslots[REQUEST].fd[OUT], req->idstr, 0);