diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-06-17 14:23:33 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2019-06-17 14:23:33 +0200 |
commit | ae1e60a9f900708f5ea42746c84c0451d6f7473d (patch) | |
tree | a442d3b414fbe5b7b39592cfe72294ff9c54f0c1 /src/command/cmd_funcs.c | |
parent | de787a858237a88e07f989273f361ca7c6bd4d1d (diff) | |
download | profani-tty-ae1e60a9f900708f5ea42746c84c0451d6f7473d.tar.gz |
Add option to set all window related time formats
Implements feature requested at: https://github.com/profanity-im/profanity/issues/632 So instead of: /time console set <format> /time chat set <format> /time muc set <format> /time mucconfig set <format> /time private set <format> /time xml set <format> As a short cut the user can do: /time all set <format> Excluding statusbar and lastactivity settings since they are not for main windows, but used slightly differently.
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index b5e996e9..e9e266c1 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -5359,6 +5359,44 @@ cmd_time(ProfWin *window, const char *const command, gchar **args) cons_bad_cmd_usage(command); return TRUE; } + } else if (g_strcmp0(args[0], "all") == 0) { + if (args[1] == NULL) { + cons_time_setting(); + return TRUE; + } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { + prefs_set_string(PREF_TIME_CONSOLE, args[2]); + cons_show("Console time format set to '%s'.", args[2]); + prefs_set_string(PREF_TIME_CHAT, args[2]); + cons_show("Chat time format set to '%s'.", args[2]); + prefs_set_string(PREF_TIME_MUC, args[2]); + cons_show("MUC time format set to '%s'.", args[2]); + prefs_set_string(PREF_TIME_CONFIG, args[2]); + cons_show("config time format set to '%s'.", args[2]); + prefs_set_string(PREF_TIME_PRIVATE, args[2]); + cons_show("Private chat time format set to '%s'.", args[2]); + prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]); + cons_show("XML Console time format set to '%s'.", args[2]); + wins_resize_all(); + return TRUE; + } else if (g_strcmp0(args[1], "off") == 0) { + prefs_set_string(PREF_TIME_CONSOLE, "off"); + cons_show("Console time display disabled."); + prefs_set_string(PREF_TIME_CHAT, "off"); + cons_show("Chat time display disabled."); + prefs_set_string(PREF_TIME_MUC, "off"); + cons_show("MUC time display disabled."); + prefs_set_string(PREF_TIME_CONFIG, "off"); + cons_show("config time display disabled."); + prefs_set_string(PREF_TIME_PRIVATE, "off"); + cons_show("config time display disabled."); + prefs_set_string(PREF_TIME_XMLCONSOLE, "off"); + cons_show("XML Console time display disabled."); + ui_redraw(); + return TRUE; + } else { + cons_bad_cmd_usage(command); + return TRUE; + } } else { cons_bad_cmd_usage(command); return TRUE; |