From 660bfc134048444d2311ff296a548b6d3ab7a6c2 Mon Sep 17 00:00:00 2001 From: Sebastian Stal Date: Wed, 7 Aug 2013 09:57:23 -0700 Subject: [PATCH] Check for correct error value in toxic. --- chat.c | 2 +- prompt.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chat.c b/chat.c index 7262e72..bad4cbf 100644 --- a/chat.c +++ b/chat.c @@ -127,7 +127,7 @@ static void chat_onKey(ToxWindow* self, int key) { wattroff(ctx->history, COLOR_PAIR(1)); wprintw(ctx->history, "%s\n", ctx->line); } - if(m_sendmessage(ctx->friendnum, (uint8_t*) ctx->line, strlen(ctx->line)+1) < 0) { + if(m_sendmessage(ctx->friendnum, (uint8_t*) ctx->line, strlen(ctx->line)+1) == 0) { wattron(ctx->history, COLOR_PAIR(3)); wprintw(ctx->history, " * Failed to send message.\n"); wattroff(ctx->history, COLOR_PAIR(3)); diff --git a/prompt.c b/prompt.c index 20f6b48..670a93a 100644 --- a/prompt.c +++ b/prompt.c @@ -45,7 +45,7 @@ static void execute(ToxWindow* self, char* u_cmd) { int i; int newlines = 0; char cmd[256] = {0}; - for(i = 0; i < strlen(prompt_buf); i++) + for(i = 0; i < strlen(prompt_buf); i++) { if (u_cmd[i] == '\n') ++newlines; @@ -260,7 +260,7 @@ static void execute(ToxWindow* self, char* u_cmd) { msg[0] = 0; msg++; - if(m_sendmessage(atoi(id), (uint8_t*) msg, strlen(msg)+1) < 0) { + if(m_sendmessage(atoi(id), (uint8_t*) msg, strlen(msg)+1) == 0) { wprintw(self->window, "Error occurred while sending message.\n"); } else { @@ -338,7 +338,7 @@ static void print_usage(ToxWindow* self) { wprintw(self->window, " myid : Print your ID\n"); wprintw(self->window, " quit/exit : Exit program\n"); wprintw(self->window, " help : Print this message again\n"); - wprintw(self->window, " clear : Clear this window\n"); + wprintw(self->window, " clear : Clear this window\n"); wattron(self->window, A_BOLD); wprintw(self->window, "TIP: Use the TAB key to navigate through the tabs.\n\n");