mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 19:43:26 +01:00
properly handle invalid statuses
This commit is contained in:
parent
3ad82cf3b1
commit
8bea44a44c
@ -714,7 +714,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
|
||||
/* Draw name, status and note in statusbar */
|
||||
if (statusbar->is_online) {
|
||||
char *status_text = "Unknown";
|
||||
const char *status_text = "Unknown";
|
||||
int colour = WHITE;
|
||||
|
||||
TOX_USERSTATUS status = statusbar->status;
|
||||
@ -732,6 +732,10 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
status_text = "Busy";
|
||||
colour = RED;
|
||||
break;
|
||||
case TOX_USERSTATUS_INVALID:
|
||||
status_text = "ERROR";
|
||||
colour = MAGENTA;
|
||||
break;
|
||||
}
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
||||
|
@ -428,6 +428,9 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
case TOX_USERSTATUS_BUSY:
|
||||
colour = RED;
|
||||
break;
|
||||
case TOX_USERSTATUS_INVALID:
|
||||
colour = MAGENTA;
|
||||
break;
|
||||
}
|
||||
|
||||
wattron(self->window, COLOR_PAIR(colour) | A_BOLD);
|
||||
|
@ -325,7 +325,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
||||
|
||||
if (statusbar->is_online) {
|
||||
int colour = WHITE;
|
||||
char *status_text = "Unknown";
|
||||
const char *status_text = "Unknown";
|
||||
|
||||
switch (statusbar->status) {
|
||||
case TOX_USERSTATUS_NONE:
|
||||
@ -340,6 +340,10 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
||||
status_text = "Busy";
|
||||
colour = RED;
|
||||
break;
|
||||
case TOX_USERSTATUS_INVALID:
|
||||
status_text = "ERROR";
|
||||
colour = MAGENTA;
|
||||
break;
|
||||
}
|
||||
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
||||
wprintw(statusbar->topline, " [%s]", status_text);
|
||||
|
Loading…
Reference in New Issue
Block a user