1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 06:33:02 +01:00

properly handle invalid statuses

This commit is contained in:
Jfreegman 2014-03-18 05:16:42 -04:00
parent 3ad82cf3b1
commit 8bea44a44c
3 changed files with 13 additions and 2 deletions

View File

@ -714,7 +714,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
/* Draw name, status and note in statusbar */ /* Draw name, status and note in statusbar */
if (statusbar->is_online) { if (statusbar->is_online) {
char *status_text = "Unknown"; const char *status_text = "Unknown";
int colour = WHITE; int colour = WHITE;
TOX_USERSTATUS status = statusbar->status; TOX_USERSTATUS status = statusbar->status;
@ -732,6 +732,10 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
status_text = "Busy"; status_text = "Busy";
colour = RED; colour = RED;
break; break;
case TOX_USERSTATUS_INVALID:
status_text = "ERROR";
colour = MAGENTA;
break;
} }
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD); wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);

View File

@ -428,6 +428,9 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
case TOX_USERSTATUS_BUSY: case TOX_USERSTATUS_BUSY:
colour = RED; colour = RED;
break; break;
case TOX_USERSTATUS_INVALID:
colour = MAGENTA;
break;
} }
wattron(self->window, COLOR_PAIR(colour) | A_BOLD); wattron(self->window, COLOR_PAIR(colour) | A_BOLD);

View File

@ -325,7 +325,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
if (statusbar->is_online) { if (statusbar->is_online) {
int colour = WHITE; int colour = WHITE;
char *status_text = "Unknown"; const char *status_text = "Unknown";
switch (statusbar->status) { switch (statusbar->status) {
case TOX_USERSTATUS_NONE: case TOX_USERSTATUS_NONE:
@ -340,6 +340,10 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
status_text = "Busy"; status_text = "Busy";
colour = RED; colour = RED;
break; break;
case TOX_USERSTATUS_INVALID:
status_text = "ERROR";
colour = MAGENTA;
break;
} }
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD); wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
wprintw(statusbar->topline, " [%s]", status_text); wprintw(statusbar->topline, " [%s]", status_text);