about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-21 22:03:43 +0000
committerJames Booth <boothj5@gmail.com>2015-11-21 22:03:43 +0000
commit5c08bea8d075714182ca898fcb68d5ad15605f0d (patch)
treedbf27ab1e792c8fc755223a94d2321b73de9dde7 /src/command
parentef0f093efde451ff9c73e304bf50020385942d55 (diff)
downloadprofani-tty-5c08bea8d075714182ca898fcb68d5ad15605f0d.tar.gz
Added /roster indent presence
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c5
-rw-r--r--src/command/commands.c16
2 files changed, 20 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c
index aaf0c555..37e963c9 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -282,6 +282,7 @@ static struct cmd_t command_defs[] =
             "/roster char contact <char>|none",
             "/roster indent contact <indent>",
             "/roster indent resource <indent>",
+            "/roster indent presence <indent>",
             "/roster size <percent>",
             "/roster add <jid> [<nick>]",
             "/roster remove <jid>",
@@ -319,7 +320,8 @@ static struct cmd_t command_defs[] =
             { "char contact <char>",        "Prefix roster contacts with specificed character." },
             { "char contact none",          "Remove roster contact character prefix." },
             { "indent contact <indent>",    "Indent contact line by <indent> spaces." },
-            { "indent resource <indent>",   "Indent roster line by <indent> spaces." },
+            { "indent resource <indent>",   "Indent resource line by <indent> spaces." },
+            { "indent presence <indent>",   "Indent presence line by <indent> spaces." },
             { "size <precent>",             "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." },
@@ -2050,6 +2052,7 @@ cmd_init(void)
     roster_indent_ac = autocomplete_new();
     autocomplete_add(roster_indent_ac, "contact");
     autocomplete_add(roster_indent_ac, "resource");
+    autocomplete_add(roster_indent_ac, "presence");
 
     roster_option_ac = autocomplete_new();
     autocomplete_add(roster_option_ac, "offline");
diff --git a/src/command/commands.c b/src/command/commands.c
index 8de6a6df..18fa1bd9 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1815,6 +1815,22 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
                     free(err_msg);
                 }
             }
+        } else if (g_strcmp0(args[1], "presence") == 0) {
+            if (!args[2]) {
+                cons_bad_cmd_usage(command);
+            } else {
+                int intval = 0;
+                char *err_msg = NULL;
+                gboolean res = strtoi_range(args[2], &intval, 0, 10, &err_msg);
+                if (res) {
+                    prefs_set_roster_presence_indent(intval);
+                    cons_show("Roster presence indent set to: %d", intval);
+                    rosterwin_roster();
+                } else {
+                    cons_show(err_msg);
+                    free(err_msg);
+                }
+            }
         } else {
             cons_bad_cmd_usage(command);
         }