1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added status colour preference support

This commit is contained in:
James Booth 2012-08-19 01:17:48 +01:00
parent 7344a68fac
commit 37357b5933

View File

@ -529,16 +529,43 @@ cons_show_online_contacts(GSList *list)
while(curr) { while(curr) {
PContact contact = curr->data; PContact contact = curr->data;
_win_show_time(_cons_win); _win_show_time(_cons_win);
const char *show = p_contact_show(contact);
if (strcmp(show, "online") == 0) {
wattron(_cons_win, COLOUR_ONLINE); wattron(_cons_win, COLOUR_ONLINE);
} else if (strcmp(show, "away") == 0) {
wattron(_cons_win, COLOUR_AWAY);
} else if (strcmp(show, "chat") == 0) {
wattron(_cons_win, COLOUR_CHAT);
} else if (strcmp(show, "dnd") == 0) {
wattron(_cons_win, COLOUR_DND);
} else if (strcmp(show, "xa") == 0) {
wattron(_cons_win, COLOUR_XA);
} else {
wattron(_cons_win, COLOUR_OFFLINE);
}
wprintw(_cons_win, "%s", p_contact_name(contact)); wprintw(_cons_win, "%s", p_contact_name(contact));
wprintw(_cons_win, " is %s", p_contact_show(contact)); wprintw(_cons_win, " is %s", show);
if (p_contact_status(contact)) if (p_contact_status(contact))
wprintw(_cons_win, ", \"%s\"", p_contact_status(contact)); wprintw(_cons_win, ", \"%s\"", p_contact_status(contact));
wprintw(_cons_win, "\n"); wprintw(_cons_win, "\n");
if (strcmp(show, "online") == 0) {
wattroff(_cons_win, COLOUR_ONLINE); wattroff(_cons_win, COLOUR_ONLINE);
} else if (strcmp(show, "away") == 0) {
wattroff(_cons_win, COLOUR_AWAY);
} else if (strcmp(show, "chat") == 0) {
wattroff(_cons_win, COLOUR_CHAT);
} else if (strcmp(show, "dnd") == 0) {
wattroff(_cons_win, COLOUR_DND);
} else if (strcmp(show, "xa") == 0) {
wattroff(_cons_win, COLOUR_XA);
} else {
wattroff(_cons_win, COLOUR_OFFLINE);
}
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }
@ -786,7 +813,18 @@ _show_status_string(WINDOW *win, const char * const from,
const char * const default_show) const char * const default_show)
{ {
_win_show_time(win); _win_show_time(win);
if (strcmp(default_show, "online") == 0) {
if (show != NULL) {
if (strcmp(show, "away") == 0) {
wattron(win, COLOUR_AWAY);
} else if (strcmp(show, "chat") == 0) {
wattron(win, COLOUR_CHAT);
} else if (strcmp(show, "dnd") == 0) {
wattron(win, COLOUR_DND);
} else if (strcmp(show, "xa") == 0) {
wattron(win, COLOUR_XA);
}
} else if (strcmp(default_show, "online") == 0) {
wattron(win, COLOUR_ONLINE); wattron(win, COLOUR_ONLINE);
} else { } else {
wattron(win, COLOUR_OFFLINE); wattron(win, COLOUR_OFFLINE);
@ -804,7 +842,17 @@ _show_status_string(WINDOW *win, const char * const from,
wprintw(win, "\n"); wprintw(win, "\n");
if (strcmp(default_show, "online") == 0) { if (show != NULL) {
if (strcmp(show, "away") == 0) {
wattroff(win, COLOUR_AWAY);
} else if (strcmp(show, "chat") == 0) {
wattroff(win, COLOUR_CHAT);
} else if (strcmp(show, "dnd") == 0) {
wattroff(win, COLOUR_DND);
} else if (strcmp(show, "xa") == 0) {
wattroff(win, COLOUR_XA);
}
} else if (strcmp(default_show, "online") == 0) {
wattroff(win, COLOUR_ONLINE); wattroff(win, COLOUR_ONLINE);
} else { } else {
wattroff(win, COLOUR_OFFLINE); wattroff(win, COLOUR_OFFLINE);