summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-18 15:24:06 +0100
committersin <sin@2f30.org>2014-09-18 15:24:06 +0100
commit9371e160e7a90a623cffeddc52a3704d6d383822 (patch)
tree8ec67c77431ff192ccafca202e89b23309ff3206 /ratox.c
parent9c1571bfa3fd7f00858f96db14c2200614cfc1c6 (diff)
Allow the user to reject a friend request
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ratox.c b/ratox.c
index 688e312..08d4f25 100644
--- a/ratox.c
+++ b/ratox.c
@@ -1050,11 +1050,15 @@ loop(void)
rtmp = TAILQ_NEXT(r, entry);
if (FD_ISSET(r->fd, &rfds) == 0)
continue;
- if (read(r->fd, &c, 1) != 1 || c != '1')
+ if (read(r->fd, &c, 1) != 1)
continue;
- tox_add_friend_norequest(tox, r->id);
- printout("Accepted friend request for %s\n", r->idstr);
- datasave();
+ if (c != '0' && c != '1')
+ continue;
+ if (c == '1') {
+ tox_add_friend_norequest(tox, r->id);
+ printout("Accepted friend request for %s\n", r->idstr);
+ datasave();
+ }
unlinkat(gslots[REQUEST].fd[OUT], r->idstr, 0);
close(r->fd);
TAILQ_REMOVE(&reqhead, r, entry);