about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-06-02 20:20:44 +0100
committerJames Booth <boothj5@gmail.com>2013-06-02 20:20:44 +0100
commit6082ab8778fb3147081a3b4a9a0c929069a69b73 (patch)
tree027605f5adc8dfe103c8f0739572c287d46c5754 /src/command
parentb89a7519033a63015639524cfdde1add7b753553 (diff)
downloadprofani-tty-6082ab8778fb3147081a3b4a9a0c929069a69b73.tar.gz
Implemented /group command with no args (list groups)
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 261afb39..e95e3dc0 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -2136,7 +2136,19 @@ _cmd_group(gchar **args, struct cmd_help_t help)
 
     // list all groups
     if (args[0] == NULL) {
-        cons_show("LIST GROUPS");
+        GSList *groups = roster_get_groups();
+        GSList *curr = groups;
+        if (curr != NULL) {
+            cons_show("Groups:");
+            while (curr != NULL) {
+                cons_show("  %s", curr->data);
+                curr = g_slist_next(curr);
+            }
+
+            g_slist_free_full(groups, g_free);
+        } else {
+            cons_show("No groups.");
+        }
         return TRUE;
     }