1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

windows: format room roster

This commit is contained in:
James Booth 2012-11-07 22:46:20 +00:00
parent 54e591fea3
commit a676c50b68
3 changed files with 21 additions and 11 deletions

View File

@ -189,12 +189,7 @@ prof_handle_room_message(const char * const room_jid, const char * const nick,
void void
prof_handle_room_roster_complete(const char * const room) prof_handle_room_roster_complete(const char * const room)
{ {
GSList *roster = room_get_roster(room); win_show_room_roster(room);
while (roster != NULL) {
win_show_chat_room_member(room, roster->data);
roster = g_slist_next(roster);
}
} }
void void

View File

@ -104,8 +104,7 @@ void win_bad_show(const char * const msg);
void win_remind(void); void win_remind(void);
void win_join_chat(const char * const room_jid, const char * const nick); void win_join_chat(const char * const room_jid, const char * const nick);
void win_show_chat_room_member(const char * const room_jid, void win_show_room_roster(const char * const room);
const char * const nick);
int win_in_groupchat(void); int win_in_groupchat(void);
void win_show_room_history(const char * const room_jid, const char * const nick, void win_show_room_history(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message); GTimeVal tv_stamp, const char * const message);

View File

@ -495,13 +495,29 @@ win_join_chat(const char * const room_jid, const char * const nick)
} }
void void
win_show_chat_room_member(const char * const room_jid, const char * const nick) win_show_room_roster(const char * const room)
{ {
int win_index = _find_prof_win_index(room_jid); int win_index = _find_prof_win_index(room);
WINDOW *win = _wins[win_index].win; WINDOW *win = _wins[win_index].win;
GSList *roster = room_get_roster(room);
if (roster != NULL) {
wprintw(win, "Room occupants:\n");
}
wattron(win, COLOUR_ONLINE); wattron(win, COLOUR_ONLINE);
wprintw(win, "%s\n", nick);
while (roster != NULL) {
wprintw(win, "%s", roster->data);
if (roster->next != NULL) {
wprintw(win, ", ");
}
roster = g_slist_next(roster);
}
wprintw(win, "\n");
wattroff(win, COLOUR_ONLINE); wattroff(win, COLOUR_ONLINE);
if (win_index == _curr_prof_win) if (win_index == _curr_prof_win)