From 39fc54972a29e41b7ddcb8257c8eabd36ab65ac6 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Thu, 26 Sep 2013 00:33:51 -0400 Subject: [PATCH] > not having green text --- src/chat.c | 16 ++++++++++++++-- src/groupchat.c | 8 +++++++- src/prompt.c | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/chat.c b/src/chat.c index 7768035..6291c4f 100644 --- a/src/chat.c +++ b/src/chat.c @@ -35,7 +35,13 @@ static void chat_onMessage(ToxWindow *self, Tox *m, int num, uint8_t *msg, uint1 wattron(ctx->history, COLOR_PAIR(4)); wprintw(ctx->history, "%s: ", nick); wattroff(ctx->history, COLOR_PAIR(4)); - wprintw(ctx->history, "%s\n", msg); + + if (msg[0] == '>') { + wattron(ctx->history, COLOR_PAIR(GREEN)); + wprintw(ctx->history, "%s\n", msg); + wattroff(ctx->history, COLOR_PAIR(GREEN)); + } else + wprintw(ctx->history, "%s\n", msg); self->blink = true; beep(); @@ -219,7 +225,13 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key) wattron(ctx->history, COLOR_PAIR(GREEN)); wprintw(ctx->history, "%s: ", selfname); wattroff(ctx->history, COLOR_PAIR(GREEN)); - wprintw(ctx->history, "%s\n", line); + + if (line[0] == '>') { + wattron(ctx->history, COLOR_PAIR(GREEN)); + wprintw(ctx->history, "%s\n", line); + wattroff(ctx->history, COLOR_PAIR(GREEN)); + } else + wprintw(ctx->history, "%s\n", line); if (!statusbar->is_online || tox_sendmessage(m, self->num, line, strlen(line) + 1) == 0) { diff --git a/src/groupchat.c b/src/groupchat.c index 3527194..986a112 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -112,7 +112,13 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int wattron(ctx->history, COLOR_PAIR(4)); wprintw(ctx->history, "%s: ", nick); wattroff(ctx->history, COLOR_PAIR(4)); - wprintw(ctx->history, "%s\n", msg); + + if (msg[0] == '>') { + wattron(ctx->history, COLOR_PAIR(GREEN)); + wprintw(ctx->history, "%s\n", msg); + wattroff(ctx->history, COLOR_PAIR(GREEN)); + } else + wprintw(ctx->history, "%s\n", msg); self->blink = true; } diff --git a/src/prompt.c b/src/prompt.c index 6d11422..1d6c41a 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -19,7 +19,7 @@ uint8_t num_frnd_requests = 0; /* One group chat request slot for each friend; slot is overwritten on subsequent requests by the same friend. */ -uint8_t pending_grp_requests[MAX_FRIENDS_NUM][TOX_CLIENT_ID_SIZE] = {'\0'}; +uint8_t pending_grp_requests[MAX_FRIENDS_NUM][TOX_CLIENT_ID_SIZE] = {'a'}; static char prompt_buf[MAX_STR_SIZE] = {'\0'}; static int prompt_buf_pos = 0;