Implemented /group command with no args (list groups)

This commit is contained in:
James Booth
2013-06-02 20:20:44 +01:00
parent b89a751903
commit 6082ab8778
3 changed files with 20 additions and 1 deletions

View File

@@ -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;
}