diff --git a/src/chat.c b/src/chat.c index 5bfa6ae..80b672d 100644 --- a/src/chat.c +++ b/src/chat.c @@ -386,7 +386,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key) /* RETURN key: Execute command or print line */ else if (key == '\n') { uint8_t *line = wcs_to_char(ctx->line); - line[ctx->pos+1] = '\0'; + line[ctx->pos+1] = L'\0'; wclear(ctx->linewin); wmove(self->window, y2 - CURS_Y_OFFSET, 0); wclrtobot(self->window); @@ -409,7 +409,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key) else if(!strncmp(line, "/savefile ", strlen("/savefile "))) chat_savefile(self, ctx, m, line + strlen("/savefile ")); else - execute(ctx->history, self->prompt, m, line, ctx->pos); + execute(ctx->history, self->prompt, m, line); } else { /* make sure the string has at least non-space character */ if (!string_is_empty(line)) { diff --git a/src/commands.c b/src/commands.c index e6f3851..f2f085c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -338,13 +338,10 @@ void cmd_status(WINDOW *window, ToxWindow *prompt, Tox *m, int argc, char (*argv if (!strcmp(l_status, "online")) status_kind = TOX_USERSTATUS_NONE; - else if (!strcmp(l_status, "away")) status_kind = TOX_USERSTATUS_AWAY; - else if (!strcmp(l_status, "busy")) status_kind = TOX_USERSTATUS_BUSY; - else { wprintw(window, "Invalid status. Valid statuses are: online, busy and away.\n"); return; @@ -363,7 +360,7 @@ void cmd_status(WINDOW *window, ToxWindow *prompt, Tox *m, int argc, char (*argv #define MAX_NUM_ARGS 4 /* Includes command */ -void execute(WINDOW *window, ToxWindow *prompt, Tox *m, char *u_cmd, int buf_len) +void execute(WINDOW *window, ToxWindow *prompt, Tox *m, char *u_cmd) { char args[MAX_NUM_ARGS][MAX_STR_SIZE]; int num_args = 0; diff --git a/src/commands.h b/src/commands.h index 2f32622..4bd4273 100644 --- a/src/commands.h +++ b/src/commands.h @@ -15,7 +15,7 @@ void cmd_note(WINDOW *, ToxWindow *, Tox *m, int, char (*argv)[MAX_STR_SIZE]); void cmd_quit(WINDOW *, ToxWindow *, Tox *m, int, char (*argv)[MAX_STR_SIZE]); void cmd_status(WINDOW *, ToxWindow *, Tox *m, int, char (*argv)[MAX_STR_SIZE]); -void execute(WINDOW *window, ToxWindow *prompt, Tox *m, char *u_cmd, int buf_len); +void execute(WINDOW *window, ToxWindow *prompt, Tox *m, char *u_cmd); #define NUM_COMMANDS 13 diff --git a/src/groupchat.c b/src/groupchat.c index f5cdde7..6ba6ed5 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -170,7 +170,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key) } else if (strncmp(line, "/help", strlen("/help")) == 0) print_groupchat_help(ctx); else - execute(ctx->history, self->prompt, m, line, ctx->pos); + execute(ctx->history, self->prompt, m, line); } else { /* make sure the string has at least non-space character */ if (!string_is_empty(line)) { diff --git a/src/prompt.c b/src/prompt.c index 33d1c54..aed127b 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -143,7 +143,7 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key) if (!strncmp(prompt_buf, "/help", strlen("/help"))) print_prompt_help(self); else - execute(self->window, self, m, prompt_buf, prompt_buf_pos); + execute(self->window, self, m, prompt_buf); prompt_buf_pos = 0; prompt_buf[0] = 0;