about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-01-23 19:42:22 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-01-23 19:42:22 +0100
commit56b7482b0817e33286d5a941c0811d05514377d4 (patch)
tree3b5932d109743ceb37cf031cc885d0eff909ef2e /src/command/cmd_funcs.c
parent0401412c64d1a871d472d8cd5f04c89968027a5b (diff)
downloadprofani-tty-56b7482b0817e33286d5a941c0811d05514377d4.tar.gz
Add option to display MUC name or JID in titlebar
Add `/titlebar use [name|jid]`.
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 2c85251e..d9fc0ed6 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5943,6 +5943,31 @@ cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
+cmd_titlebar_use(ProfWin *window, const char *const command, gchar **args)
+{
+    if (args[1] == NULL) {
+        cons_bad_cmd_usage(command);
+        return TRUE;
+    }
+
+    if (g_strcmp0(args[0], "use") == 0) {
+        if (g_strcmp0(args[1], "jid") == 0) {
+            cons_show("Using MUC JID in titlebar as title.");
+            prefs_set_string(PREF_TITLEBAR_MUC_TITLE, "jid");
+        } else if (g_strcmp0(args[1], "name") == 0) {
+            cons_show("Using MUC name in titlebar as title.");
+            prefs_set_string(PREF_TITLEBAR_MUC_TITLE, "name");
+        } else {
+            cons_bad_cmd_usage(command);
+        }
+    } else {
+        cons_bad_cmd_usage(command);
+    }
+
+    return TRUE;
+}
+
+gboolean
 cmd_mainwin(ProfWin *window, const char *const command, gchar **args)
 {
     if (g_strcmp0(args[0], "up") == 0) {