mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Colour chat room members by presence for /who
This commit is contained in:
parent
b89ca4fc3e
commit
c8b650e8be
@ -275,7 +275,7 @@ room_get_roster(const char * const room)
|
|||||||
muc_room *chat_room = g_hash_table_lookup(rooms, room);
|
muc_room *chat_room = g_hash_table_lookup(rooms, room);
|
||||||
|
|
||||||
if (chat_room != NULL) {
|
if (chat_room != NULL) {
|
||||||
return g_hash_table_get_keys(chat_room->roster);
|
return g_hash_table_get_values(chat_room->roster);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -789,10 +789,44 @@ win_show_room_roster(const char * const room)
|
|||||||
wattron(win, COLOUR_ONLINE);
|
wattron(win, COLOUR_ONLINE);
|
||||||
|
|
||||||
while (roster != NULL) {
|
while (roster != NULL) {
|
||||||
wprintw(win, "%s", roster->data);
|
PContact member = roster->data;
|
||||||
|
const char const *name = p_contact_jid(member);
|
||||||
|
const char const *show = p_contact_presence(member);
|
||||||
|
|
||||||
|
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(show, "online") == 0) {
|
||||||
|
wattron(win, COLOUR_ONLINE);
|
||||||
|
} else {
|
||||||
|
wattron(win, COLOUR_OFFLINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
wprintw(win, "%s", name);
|
||||||
|
|
||||||
|
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(show, "online") == 0) {
|
||||||
|
wattroff(win, COLOUR_ONLINE);
|
||||||
|
} else {
|
||||||
|
wattroff(win, COLOUR_OFFLINE);
|
||||||
|
}
|
||||||
|
|
||||||
if (roster->next != NULL) {
|
if (roster->next != NULL) {
|
||||||
wprintw(win, ", ");
|
wprintw(win, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
roster = g_list_next(roster);
|
roster = g_list_next(roster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user