about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c11
-rw-r--r--src/command/commands.c27
2 files changed, 37 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c
index b6c00803..f3c4d3bb 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -282,6 +282,7 @@ static struct cmd_t command_defs[] =
             "/roster hide [offline|resource|presence|status|empty|count|priority|rooms]",
             "/roster by group|presence|none",
             "/roster order name|presence",
+            "/roster unread before|after|off",
             "/roster room order name|unread",
             "/roster room unread before|after|off",
             "/roster header char <char>|none",
@@ -326,11 +327,14 @@ static struct cmd_t command_defs[] =
             { "by none",                    "No grouping in the roster panel." },
             { "order name",                 "Order roster items by name only." },
             { "order presence",             "Order roster items by presence, and then by name." },
+            { "unread before",              "Show unread message count before contact in roster." },
+            { "unread after",               "Show unread message count after contact in roster." },
+            { "unread off",                 "Do not show unread message count for contacts in roster." },
             { "room order name",            "Order roster rooms by name." },
             { "room order unread",          "Order roster rooms by unread messages, and then by name." },
             { "room unread before",         "Show unread message count before room in roster." },
             { "room unread after",          "Show unread message count after room in roster." },
-            { "room unread off",            "Do not show unread message count for rooms in rosters." },
+            { "room unread off",            "Do not show unread message count for rooms in roster." },
             { "header char <char>",         "Prefix roster headers with specified character." },
             { "header char none",           "Remove roster header character prefix." },
             { "contact char <char>",        "Prefix roster contacts with specified character." },
@@ -2172,6 +2176,7 @@ cmd_init(void)
     autocomplete_add(roster_ac, "hide");
     autocomplete_add(roster_ac, "by");
     autocomplete_add(roster_ac, "order");
+    autocomplete_add(roster_ac, "unread");
     autocomplete_add(roster_ac, "room");
     autocomplete_add(roster_ac, "size");
     autocomplete_add(roster_ac, "wrap");
@@ -3169,6 +3174,10 @@ _roster_autocomplete(ProfWin *window, const char *const input)
     if (result) {
         return result;
     }
+    result = autocomplete_param_with_ac(input, "/roster unread", roster_unread_ac, TRUE);
+    if (result) {
+        return result;
+    }
     result = autocomplete_param_with_ac(input, "/roster room", roster_room_ac, TRUE);
     if (result) {
         return result;
diff --git a/src/command/commands.c b/src/command/commands.c
index 3ad79778..76904ef0 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2310,6 +2310,33 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
             return TRUE;
         }
 
+    } else if (g_strcmp0(args[0], "unread") == 0) {
+        if (g_strcmp0(args[1], "before") == 0) {
+            cons_show("Roster unread message count: before");
+            prefs_set_string(PREF_ROSTER_UNREAD, "before");
+            if (conn_status == JABBER_CONNECTED) {
+                rosterwin_roster();
+            }
+            return TRUE;
+        } else if (g_strcmp0(args[1], "after") == 0) {
+            cons_show("Roster unread message count: after");
+            prefs_set_string(PREF_ROSTER_UNREAD, "after");
+            if (conn_status == JABBER_CONNECTED) {
+                rosterwin_roster();
+            }
+            return TRUE;
+        } else if (g_strcmp0(args[1], "off") == 0) {
+            cons_show("Roster unread message count: off");
+            prefs_set_string(PREF_ROSTER_UNREAD, "off");
+            if (conn_status == JABBER_CONNECTED) {
+                rosterwin_roster();
+            }
+            return TRUE;
+        } else {
+            cons_bad_cmd_usage(command);
+            return TRUE;
+        }
+
     } else if (g_strcmp0(args[0], "room") == 0) {
         if (g_strcmp0(args[1], "order") == 0) {
             if (g_strcmp0(args[2], "name") == 0) {