commit 2a1638db2e7e390d7d87d45169692cdc01b33048
parent ae00397f4c17f72e08b07210cfcec2fb964a352d
Author: z3bra <contactatz3bradotorg>
Date: Fri, 25 Nov 2016 08:13:34 +0100
Fix accepting friend requests
Actually passes the friend number returned by tox_friend_add_norequest()
to the friendcreate() function.
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git 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);