diff options
-rw-r--r-- | src/room_chat.c | 2 | ||||
-rw-r--r-- | src/windows.c | 36 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/room_chat.c b/src/room_chat.c index a55b8910..46cb8ee6 100644 --- a/src/room_chat.c +++ b/src/room_chat.c @@ -275,7 +275,7 @@ room_get_roster(const char * const room) muc_room *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { - return g_hash_table_get_keys(chat_room->roster); + return g_hash_table_get_values(chat_room->roster); } else { return NULL; } diff --git a/src/windows.c b/src/windows.c index 3563f4ca..2aee2ec5 100644 --- a/src/windows.c +++ b/src/windows.c @@ -789,10 +789,44 @@ win_show_room_roster(const char * const room) wattron(win, COLOUR_ONLINE); 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) { wprintw(win, ", "); } + roster = g_list_next(roster); } |