From 40dc5932f71ccb6bd67f4fd8365749a0ddecbf71 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 5 Nov 2019 21:06:07 +0100 Subject: [PATCH] Add `/titlebar show presence` command Additionally to `/presence titlebar on` we now allow the setting via /titlebar show|hide presence` since it's about the titlebar. Regards https://github.com/profanity-im/profanity/issues/1116 --- src/command/cmd_ac.c | 1 + src/command/cmd_funcs.c | 6 ++++++ src/ui/console.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index f8aa2e21..a3b0625f 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -777,6 +777,7 @@ cmd_ac_init(void) autocomplete_add(titlebar_show_ac, "tls"); autocomplete_add(titlebar_show_ac, "encwarn"); autocomplete_add(titlebar_show_ac, "resource"); + autocomplete_add(titlebar_show_ac, "presence"); tls_certpath_ac = autocomplete_new(); autocomplete_add(tls_certpath_ac, "set"); diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 32474650..3a8ae2de 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -5960,6 +5960,9 @@ cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args) } else if (g_strcmp0(args[1], "resource") == 0) { cons_show("Showing resource in titlebar enabled."); prefs_set_boolean(PREF_RESOURCE_TITLE , TRUE); + } else if (g_strcmp0(args[1], "presence") == 0) { + cons_show("Showing contact presence in titlebar enabled."); + prefs_set_boolean(PREF_PRESENCE , TRUE); } else { cons_bad_cmd_usage(command); } @@ -5974,6 +5977,9 @@ cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args) } else if (g_strcmp0(args[1], "resource") == 0) { cons_show("Showing resource in titlebar disabled."); prefs_set_boolean(PREF_RESOURCE_TITLE , FALSE); + } else if (g_strcmp0(args[1], "presence") == 0) { + cons_show("Showing contact presence in titlebar enabled."); + prefs_set_boolean(PREF_PRESENCE , FALSE); } else { cons_bad_cmd_usage(command); } diff --git a/src/ui/console.c b/src/ui/console.c index 1fe9b01a..198b61a4 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1151,6 +1151,12 @@ cons_titlebar_setting(void) } else { cons_show("Resource show (/titlebar) : OFF"); } + + if (prefs_get_boolean(PREF_PRESENCE)) { + cons_show("Titlebar presence (/titlebar) : ON"); + } else { + cons_show("Titlebar presence (/titlebar) : OFF"); + } } void