about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-06-20 00:39:08 +0100
committerJames Booth <boothj5@gmail.com>2015-06-20 00:39:08 +0100
commit16999a396497c90778ef6bdbab11a419a570aa0f (patch)
tree5586f73e19e58a8e8494c3edae5f47ac3ad18693 /src
parentedbb3d938edf61946df0c89779a1e9377356602d (diff)
parentd7ec339e3ea668668cbe5fb817bf9914d0265116 (diff)
downloadprofani-tty-16999a396497c90778ef6bdbab11a419a570aa0f.tar.gz
Merge branch 'master' into openpgp
Diffstat (limited to 'src')
-rw-r--r--src/command/command.c2
-rw-r--r--src/command/commands.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 00f53b53..fbb9f29d 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -204,6 +204,7 @@ static struct cmd_t command_defs[] =
           "size           : Percentage of the screen taken up by the roster (1-99).",
           "add jid [nick] : Add a new item to the roster.",
           "remove jid     : Removes an item from the roster.",
+          "empty          : Remove all items from roster."
           "nick jid nick  : Change a contacts nickname.",
           "clearnick jid  : Removes the current nickname.",
           "",
@@ -1409,6 +1410,7 @@ cmd_init(void)
     autocomplete_add(roster_ac, "nick");
     autocomplete_add(roster_ac, "clearnick");
     autocomplete_add(roster_ac, "remove");
+    autocomplete_add(roster_ac, "empty");
     autocomplete_add(roster_ac, "show");
     autocomplete_add(roster_ac, "hide");
     autocomplete_add(roster_ac, "by");
diff --git a/src/command/commands.c b/src/command/commands.c
index f40723be..113532a5 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1651,6 +1651,23 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
         }
         return TRUE;
 
+    } else if (strcmp(args[0], "empty") == 0) {
+        if (conn_status != JABBER_CONNECTED) {
+            cons_show("You are not currently connected.");
+            return TRUE;
+        }
+
+        GSList *all = roster_get_contacts();
+        GSList *curr = all;
+        while (curr) {
+            PContact contact = curr->data;
+            roster_send_remove(p_contact_barejid(contact));
+            curr = g_slist_next(curr);
+        }
+
+        g_slist_free(all);
+        return TRUE;
+
     // change nickname
     } else if (strcmp(args[0], "nick") == 0) {
         if (conn_status != JABBER_CONNECTED) {