From ccbe4c67996b4732a167449dfe288c65281b5d2d Mon Sep 17 00:00:00 2001 From: Nick ODell Date: Wed, 31 Jul 2013 10:38:13 -0600 Subject: Show error message instead of "added friendnumber -1" --- testing/nTox.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'testing') diff --git a/testing/nTox.c b/testing/nTox.c index 29726a3a..ff8f8caf 100644 --- a/testing/nTox.c +++ b/testing/nTox.c @@ -172,13 +172,17 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) else if (inpt_command == 'a') { uint8_t numf = atoi(line + 3); char numchar[100]; - sprintf(numchar, "[i] friend request %u accepted", numf); - new_lines(numchar); int num = m_addfriend_norequest(pending_requests[numf]); - sprintf(numchar, "[i] added friendnumber %d", num); - new_lines(numchar); + if (num != -1) { + sprintf(numchar, "[i] friend request %u accepted", numf); + new_lines(numchar); + sprintf(numchar, "[i] added friendnumber %d", num); + new_lines(numchar); + } else { + sprintf(numchar, "[i] failed to add friend"); + new_lines(numchar); + } do_refresh(); - } else if (inpt_command == 'h') { //help new_lines("[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status)"); -- cgit v1.2.3