about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-18 02:02:49 +0000
committerJames Booth <boothj5@gmail.com>2015-11-18 02:02:49 +0000
commit4505102fa83e00c70d1ee15967b977957dcf3aa5 (patch)
tree9f8556fc7e9bd8c0abec75a6cca3f00c283c32de /src/command
parentedbd2d5843fe7cefd730899aace631416715bb8f (diff)
downloadprofani-tty-4505102fa83e00c70d1ee15967b977957dcf3aa5.tar.gz
Added roster count option
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c7
-rw-r--r--src/command/commands.c14
2 files changed, 19 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 2a98ba75..1057084c 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -274,8 +274,8 @@ static struct cmd_t command_defs[] =
         CMD_SYN(
             "/roster",
             "/roster online",
-            "/roster show [offline|resource|presence|status|empty]",
-            "/roster hide [offline|resource|presence|status|empty]",
+            "/roster show [offline|resource|presence|status|empty|count]",
+            "/roster hide [offline|resource|presence|status|empty|count]",
             "/roster by group|presence|none",
             "/roster order name|presence"
             "/roster size <percent>",
@@ -295,12 +295,14 @@ static struct cmd_t command_defs[] =
             { "show presence",       "Show contact's presence in the roster panel." },
             { "show status",         "Show contact's status message in the roster panel." },
             { "show empty",          "When grouping by presence, show empty presence groups." },
+            { "show count",          "Show number of contacts in group/presence." },
             { "hide",                "Hide the roster panel." },
             { "hide offline",        "Hide offline contacts in the roster panel." },
             { "hide resource",       "Hide contact's connected resources in the roster panel." },
             { "hide presence",       "Hide contact's presence in the roster panel." },
             { "hide status",         "Hide contact's status message in the roster panel." },
             { "hide empty",          "When grouping by presence, hide empty presence groups." },
+            { "hide count",          "Hide number of contacts in group/presence." },
             { "by group",            "Group contacts in the roster panel by roster group." },
             { "by presence",         "Group contacts in the roster panel by presence." },
             { "by none",             "No grouping in the roster panel." },
@@ -2027,6 +2029,7 @@ cmd_init(void)
     autocomplete_add(roster_option_ac, "presence");
     autocomplete_add(roster_option_ac, "status");
     autocomplete_add(roster_option_ac, "empty");
+    autocomplete_add(roster_option_ac, "count");
 
     roster_by_ac = autocomplete_new();
     autocomplete_add(roster_by_ac, "group");
diff --git a/src/command/commands.c b/src/command/commands.c
index 10143565..4d8933bd 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1794,6 +1794,13 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
                 rosterwin_roster();
             }
             return TRUE;
+        } else if (g_strcmp0(args[1], "count") == 0) {
+            cons_show("Roster count enabled");
+            prefs_set_boolean(PREF_ROSTER_COUNT, TRUE);
+            if (conn_status == JABBER_CONNECTED) {
+                rosterwin_roster();
+            }
+            return TRUE;
         } else {
             cons_bad_cmd_usage(command);
             return TRUE;
@@ -1841,6 +1848,13 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
                 rosterwin_roster();
             }
             return TRUE;
+        } else if (g_strcmp0(args[1], "count") == 0) {
+            cons_show("Roster count disabled");
+            prefs_set_boolean(PREF_ROSTER_COUNT, FALSE);
+            if (conn_status == JABBER_CONNECTED) {
+                rosterwin_roster();
+            }
+            return TRUE;
         } else {
             cons_bad_cmd_usage(command);
             return TRUE;