about summary refs log tree commit diff stats
path: root/src/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-08 00:22:15 +0000
committerJames Booth <boothj5@gmail.com>2012-11-08 00:22:15 +0000
commitc967cd9dc9aad708c30b1be16cc3fa65f2581216 (patch)
tree020b71b71657ecf93f514a274d57c9278ecff2dd /src/command.c
parent181669a8cb20d385e3635a7c1a23972a673db3fd (diff)
downloadprofani-tty-c967cd9dc9aad708c30b1be16cc3fa65f2581216.tar.gz
Using /who in chat room shows room occupants
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c75
1 files changed, 40 insertions, 35 deletions
diff --git a/src/command.c b/src/command.c
index 785b133c..e0f2edef 100644
--- a/src/command.c
+++ b/src/command.c
@@ -896,47 +896,52 @@ _cmd_who(const char * const inp, struct cmd_help_t help)
 
         // valid arg
         } else {
-            GSList *list = get_contact_list();
-
-            // no arg, show all contacts
-            if (presence == NULL) {
-                cons_show("All contacts:");
-                cons_show_contacts(list);
-
-            // online, show all status that indicate online
-            } else if (strcmp("online", presence) == 0) {
-                cons_show("Contacts (%s):", presence);
-                GSList *filtered = NULL;
-
-                while (list != NULL) {
-                    PContact contact = list->data;
-                    const char * const contact_presence = (p_contact_presence(contact));
-                    if ((strcmp(contact_presence, "online") == 0)
-                            || (strcmp(contact_presence, "away") == 0)
-                            || (strcmp(contact_presence, "dnd") == 0)
-                            || (strcmp(contact_presence, "xa") == 0)
-                            || (strcmp(contact_presence, "chat") == 0)) {
-                        filtered = g_slist_append(filtered, contact);
+            if (win_in_groupchat()) {
+                char *room = win_get_recipient();
+                win_show_room_roster(room);
+            } else {
+                GSList *list = get_contact_list();
+
+                // no arg, show all contacts
+                if (presence == NULL) {
+                    cons_show("All contacts:");
+                    cons_show_contacts(list);
+
+                // online, show all status that indicate online
+                } else if (strcmp("online", presence) == 0) {
+                    cons_show("Contacts (%s):", presence);
+                    GSList *filtered = NULL;
+
+                    while (list != NULL) {
+                        PContact contact = list->data;
+                        const char * const contact_presence = (p_contact_presence(contact));
+                        if ((strcmp(contact_presence, "online") == 0)
+                                || (strcmp(contact_presence, "away") == 0)
+                                || (strcmp(contact_presence, "dnd") == 0)
+                                || (strcmp(contact_presence, "xa") == 0)
+                                || (strcmp(contact_presence, "chat") == 0)) {
+                            filtered = g_slist_append(filtered, contact);
+                        }
+                        list = g_slist_next(list);
                     }
-                    list = g_slist_next(list);
-                }
 
-                cons_show_contacts(filtered);
+                    cons_show_contacts(filtered);
 
-            // show specific status
-            } else {
-                cons_show("Contacts (%s):", presence);
-                GSList *filtered = NULL;
+                // show specific status
+                } else {
+                    cons_show("Contacts (%s):", presence);
+                    GSList *filtered = NULL;
 
-                while (list != NULL) {
-                    PContact contact = list->data;
-                    if (strcmp(p_contact_presence(contact), presence) == 0) {
-                        filtered = g_slist_append(filtered, contact);
+                    while (list != NULL) {
+                        PContact contact = list->data;
+                        if (strcmp(p_contact_presence(contact), presence) == 0) {
+                            filtered = g_slist_append(filtered, contact);
+                        }
+                        list = g_slist_next(list);
                     }
-                    list = g_slist_next(list);
-                }
 
-                cons_show_contacts(filtered);
+                    cons_show_contacts(filtered);
+                }
             }
         }
     }