From a604de901702eabcdc73507025e77e34db6a9266 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Wed, 31 Jul 2013 21:44:57 -0400 Subject: fixed friend add bugs --- testing/toxic/prompt.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'testing/toxic/prompt.c') diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index e18bdff0..6970441f 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c @@ -133,10 +133,26 @@ static void execute(ToxWindow* self, char* cmd) { } num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); - - wprintw(self->window, "Friend added as %d.\n", num); - on_friendadded(num); + switch (num) { + case -1: + wprintw(self->window, "Message is too long.\n"); + break; + case -2: + wprintw(self->window, "That appears to be your own ID.\n"); + break; + case -3: + wprintw(self->window, "Friend request already sent.\n"); + break; + case -4: + wprintw(self->window, "Invalid ID.\n"); + break; + default: + wprintw(self->window, "Friend added as %d.\n", num); + on_friendadded(num); + break; + } } + else if(!strcmp(cmd, "help")) { wattron(self->window, COLOR_PAIR(2) | A_BOLD); wprintw(self->window, "Commands:\n"); -- cgit v1.2.3