about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/command/command.c14
-rw-r--r--src/xmpp/roster.c6
-rw-r--r--src/xmpp/xmpp.h1
3 files changed, 20 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;
     }
 
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index c6039ed2..8e8dc328 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -379,6 +379,12 @@ roster_get_contacts(void)
 }
 
 GSList *
+roster_get_groups(void)
+{
+    return autocomplete_get_list(groups_ac);
+}
+
+GSList *
 roster_get_group(const char * const group)
 {
     GSList *result = NULL;
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 50518dba..61f07e5e 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -151,5 +151,6 @@ GSList * roster_get_group(const char * const group);
 void roster_add_to_group(const char * const group, const char * const barejid);
 void roster_remove_from_group(const char * const group,
     const char * const barejid);
+GSList * roster_get_groups(void);
 
 #endif