about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2018-03-10 22:16:52 +0000
committerJames Booth <boothj5@gmail.com>2018-03-10 22:16:52 +0000
commit95b639a21f77c825a36076562363154216cdad05 (patch)
tree9eda4cd8d11d08d6c0097124d679927fe15890aa /src/command
parentb38f6ba5128a7ce091021537b2253da81f65cddb (diff)
downloadprofani-tty-95b639a21f77c825a36076562363154216cdad05.tar.gz
WIP add self prefs for statusbar
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c15
-rw-r--r--src/command/cmd_defs.c19
-rw-r--r--src/command/cmd_funcs.c29
3 files changed, 55 insertions, 8 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index de57ac82..c996d814 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -201,6 +201,7 @@ static Autocomplete presence_ac;
 static Autocomplete presence_setting_ac;
 static Autocomplete winpos_ac;
 static Autocomplete statusbar_ac;
+static Autocomplete statusbar_self_ac;
 static Autocomplete statusbar_chat_ac;
 static Autocomplete statusbar_room_ac;
 static Autocomplete statusbar_show_ac;
@@ -784,9 +785,16 @@ cmd_ac_init(void)
     autocomplete_add(statusbar_ac, "show");
     autocomplete_add(statusbar_ac, "hide");
     autocomplete_add(statusbar_ac, "maxtabs");
+    autocomplete_add(statusbar_ac, "self");
     autocomplete_add(statusbar_ac, "chat");
     autocomplete_add(statusbar_ac, "room");
 
+    statusbar_self_ac = autocomplete_new();
+    autocomplete_add(statusbar_self_ac, "user");
+    autocomplete_add(statusbar_self_ac, "barejid");
+    autocomplete_add(statusbar_self_ac, "fulljid");
+    autocomplete_add(statusbar_self_ac, "off");
+
     statusbar_chat_ac = autocomplete_new();
     autocomplete_add(statusbar_chat_ac, "user");
     autocomplete_add(statusbar_chat_ac, "jid");
@@ -1080,6 +1088,7 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(presence_setting_ac);
     autocomplete_reset(winpos_ac);
     autocomplete_reset(statusbar_ac);
+    autocomplete_reset(statusbar_self_ac);
     autocomplete_reset(statusbar_chat_ac);
     autocomplete_reset(statusbar_room_ac);
     autocomplete_reset(statusbar_show_ac);
@@ -1211,6 +1220,7 @@ cmd_ac_uninit(void)
     autocomplete_free(presence_setting_ac);
     autocomplete_free(winpos_ac);
     autocomplete_free(statusbar_ac);
+    autocomplete_free(statusbar_self_ac);
     autocomplete_free(statusbar_chat_ac);
     autocomplete_free(statusbar_room_ac);
     autocomplete_free(statusbar_show_ac);
@@ -3230,6 +3240,11 @@ _statusbar_autocomplete(ProfWin *window, const char *const input, gboolean previ
         return found;
     }
 
+    found = autocomplete_param_with_ac(input, "/statusbar self", statusbar_self_ac, TRUE, previous);
+    if (found) {
+        return found;
+    }
+
     found = autocomplete_param_with_ac(input, "/statusbar chat", statusbar_chat_ac, TRUE, previous);
     if (found) {
         return found;
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 5a873309..d6ee9be6 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1361,6 +1361,7 @@ static struct cmd_t command_defs[] =
             "/statusbar show name|number",
             "/statusbar hide name|number",
             "/statusbar maxtabs <value>",
+            "/statusbar self user|barejid|fulljid|off",
             "/statusbar chat user|jid",
             "/statusbar room room|jid",
             "/statusbar up",
@@ -1368,16 +1369,18 @@ static struct cmd_t command_defs[] =
         CMD_DESC(
             "Manage statusbar display preferences.")
         CMD_ARGS(
-            { "maxtabs <value>",    "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
-            { "show|hide name",     "Show or hide names in tabs." },
-            { "show|hide number",   "Show or hide numbers in tabs." },
-            { "chat user|jid",      "Show only the users name, or the full jid if no nick is present for chat tabs." },
-            { "room room|jid",      "Show only the rooms name, or the full jid for room tabs." },
-            { "up",                 "Move the status bar up the screen." },
-            { "down",               "Move the status bar down the screen." })
+            { "maxtabs <value>",            "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
+            { "show|hide name",             "Show or hide names in tabs." },
+            { "show|hide number",           "Show or hide numbers in tabs." },
+            { "self user|barejid|fulljid",  "Show account user name, barejid, fulljid as status bar title." },
+            { "self off",                   "Disable showing self as status bar title." },
+            { "chat user|jid",              "Show users name, or the fulljid if no nick is present for chat tabs." },
+            { "room room|jid",              "Show room name, or the fulljid for room tabs." },
+            { "up",                         "Move the status bar up the screen." },
+            { "down",                       "Move the status bar down the screen." })
         CMD_EXAMPLES(
             "/statusbar maxtabs 5",
-            "/statusbar hide name",
+            "/statusbar self user",
             "/statusbar chat jid",
             "/statusbar hide name")
     },
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 98a08267..11f1f51c 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5846,6 +5846,35 @@ cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
         }
     }
 
+    if (g_strcmp0(args[0], "self") == 0) {
+        if (g_strcmp0(args[1], "barejid") == 0) {
+            prefs_set_string(PREF_STATUSBAR_SELF, "barejid");
+            cons_show("Using barejid for statusbar title.");
+            ui_resize();
+            return TRUE;
+        }
+        if (g_strcmp0(args[1], "fulljid") == 0) {
+            prefs_set_string(PREF_STATUSBAR_SELF, "fulljid");
+            cons_show("Using fulljid for statusbar title.");
+            ui_resize();
+            return TRUE;
+        }
+        if (g_strcmp0(args[1], "user") == 0) {
+            prefs_set_string(PREF_STATUSBAR_SELF, "user");
+            cons_show("Using user for statusbar title.");
+            ui_resize();
+            return TRUE;
+        }
+        if (g_strcmp0(args[1], "off") == 0) {
+            prefs_set_string(PREF_STATUSBAR_SELF, "off");
+            cons_show("Disabling statusbar title.");
+            ui_resize();
+            return TRUE;
+        }
+        cons_bad_cmd_usage(command);
+        return TRUE;
+    }
+
     if (g_strcmp0(args[0], "chat") == 0) {
         if (g_strcmp0(args[1], "jid") == 0) {
             prefs_set_string(PREF_STATUSBAR_CHAT, "jid");