mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added /time off
This commit is contained in:
parent
8c027a56f9
commit
cd855d3740
@ -1409,6 +1409,7 @@ cmd_init(void)
|
||||
time_ac = autocomplete_new();
|
||||
autocomplete_add(time_ac, "minutes");
|
||||
autocomplete_add(time_ac, "seconds");
|
||||
autocomplete_add(time_ac, "off");
|
||||
|
||||
cmd_history_init();
|
||||
}
|
||||
|
@ -3043,6 +3043,11 @@ cmd_time(gchar **args, struct cmd_help_t help)
|
||||
cons_show("Time precision set to seconds.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[0], "off") == 0) {
|
||||
prefs_set_string(PREF_TIME, "off");
|
||||
cons_show("Time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
return TRUE;
|
||||
|
@ -906,6 +906,8 @@ _cons_time_setting(void)
|
||||
char *pref_time = prefs_get_string(PREF_TIME);
|
||||
if (g_strcmp0(pref_time, "minutes") == 0)
|
||||
cons_show("Time (/time) : minutes");
|
||||
else if (g_strcmp0(pref_time, "off") == 0)
|
||||
cons_show("Time (/time) : OFF");
|
||||
else
|
||||
cons_show("Time (/time) : seconds");
|
||||
|
||||
|
@ -580,21 +580,23 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
int colour = COLOUR_ME;
|
||||
|
||||
if ((flags & NO_DATE) == 0) {
|
||||
gchar *date_fmt;
|
||||
gchar *date_fmt = NULL;
|
||||
char *time_pref = prefs_get_string(PREF_TIME);
|
||||
if (g_strcmp0(time_pref, "minutes") == 0) {
|
||||
date_fmt = g_date_time_format(time, "%H:%M");
|
||||
} else {
|
||||
} else if (g_strcmp0(time_pref, "seconds") == 0) {
|
||||
date_fmt = g_date_time_format(time, "%H:%M:%S");
|
||||
}
|
||||
free(time_pref);
|
||||
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
wattron(window->win, COLOUR_TIME);
|
||||
}
|
||||
wprintw(window->win, "%s %c ", date_fmt, show_char);
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
wattroff(window->win, COLOUR_TIME);
|
||||
if (date_fmt) {
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
wattron(window->win, COLOUR_TIME);
|
||||
}
|
||||
wprintw(window->win, "%s %c ", date_fmt, show_char);
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
wattroff(window->win, COLOUR_TIME);
|
||||
}
|
||||
}
|
||||
g_free(date_fmt);
|
||||
}
|
||||
@ -650,7 +652,7 @@ _win_print_wrapped(WINDOW *win, const char * const message)
|
||||
int wrap_space = 0;
|
||||
if (g_strcmp0(time_pref, "minutes") == 0) {
|
||||
wrap_space = 8;
|
||||
} else {
|
||||
} else if (g_strcmp0(time_pref, "seconds") == 0) {
|
||||
wrap_space = 11;
|
||||
}
|
||||
free(time_pref);
|
||||
|
Loading…
Reference in New Issue
Block a user