about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-07 22:46:20 +0000
committerJames Booth <boothj5@gmail.com>2012-11-07 22:46:20 +0000
commita676c50b681e092a25d96c5f9300b1314cd6b3d4 (patch)
tree84d56c7582754e63f070bab1a4cf5cf8f2bb51db /src
parent54e591fea34c1168a48457d25a500ce9f506a13b (diff)
downloadprofani-tty-a676c50b681e092a25d96c5f9300b1314cd6b3d4.tar.gz
windows: format room roster
Diffstat (limited to 'src')
-rw-r--r--src/profanity.c7
-rw-r--r--src/ui.h3
-rw-r--r--src/windows.c22
3 files changed, 21 insertions, 11 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 21d3847b..7ef6a9a9 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -189,12 +189,7 @@ prof_handle_room_message(const char * const room_jid, const char * const nick,
 void
 prof_handle_room_roster_complete(const char * const room)
 {
-    GSList *roster = room_get_roster(room);
-
-    while (roster != NULL) {
-        win_show_chat_room_member(room, roster->data);
-        roster = g_slist_next(roster);
-    }
+    win_show_room_roster(room);
 }
 
 void
diff --git a/src/ui.h b/src/ui.h
index 35c8e0b5..59128299 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -104,8 +104,7 @@ void win_bad_show(const char * const msg);
 void win_remind(void);
 
 void win_join_chat(const char * const room_jid, const char * const nick);
-void win_show_chat_room_member(const char * const room_jid,
-    const char * const nick);
+void win_show_room_roster(const char * const room);
 int win_in_groupchat(void);
 void win_show_room_history(const char * const room_jid, const char * const nick,
     GTimeVal tv_stamp, const char * const message);
diff --git a/src/windows.c b/src/windows.c
index 1f49c540..91b6ee31 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -495,13 +495,29 @@ win_join_chat(const char * const room_jid, const char * const nick)
 }
 
 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;
 
+    GSList *roster = room_get_roster(room);
+
+
+    if (roster != NULL) {
+        wprintw(win, "Room occupants:\n");
+    }
+
     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);
 
     if (win_index == _curr_prof_win)