Added /time setting
This commit is contained in:
@@ -597,6 +597,14 @@ static struct cmd_t command_defs[] =
|
||||
"Enable or disable word wrapping.",
|
||||
NULL } } },
|
||||
|
||||
{ "/time",
|
||||
cmd_time, parse_args, 1, 1, &cons_time_setting,
|
||||
{ "/time minutes|seconds", "Time display.",
|
||||
{ "/time minutes|seconds",
|
||||
"---------------------",
|
||||
"Configure time precision for the main window.",
|
||||
NULL } } },
|
||||
|
||||
{ "/notify",
|
||||
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
||||
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
||||
@@ -1071,6 +1079,7 @@ static Autocomplete form_ac;
|
||||
static Autocomplete form_field_multi_ac;
|
||||
static Autocomplete occupants_ac;
|
||||
static Autocomplete occupants_default_ac;
|
||||
static Autocomplete time_ac;
|
||||
|
||||
/*
|
||||
* Initialise command autocompleter and history
|
||||
@@ -1397,6 +1406,10 @@ cmd_init(void)
|
||||
autocomplete_add(occupants_default_ac, "show");
|
||||
autocomplete_add(occupants_default_ac, "hide");
|
||||
|
||||
time_ac = autocomplete_new();
|
||||
autocomplete_add(time_ac, "minutes");
|
||||
autocomplete_add(time_ac, "seconds");
|
||||
|
||||
cmd_history_init();
|
||||
}
|
||||
|
||||
@@ -1450,6 +1463,7 @@ cmd_uninit(void)
|
||||
autocomplete_free(form_field_multi_ac);
|
||||
autocomplete_free(occupants_ac);
|
||||
autocomplete_free(occupants_default_ac);
|
||||
autocomplete_free(time_ac);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1620,6 +1634,7 @@ cmd_reset_autocomplete()
|
||||
autocomplete_reset(form_field_multi_ac);
|
||||
autocomplete_reset(occupants_ac);
|
||||
autocomplete_reset(occupants_default_ac);
|
||||
autocomplete_reset(time_ac);
|
||||
|
||||
if (ui_current_win_type() == WIN_MUC_CONFIG) {
|
||||
ProfWin *window = wins_get_current();
|
||||
@@ -1885,8 +1900,8 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
}
|
||||
}
|
||||
|
||||
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins", "/subject", "/room" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac, subject_ac, room_ac };
|
||||
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins", "/subject", "/room", "/time" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac, subject_ac, room_ac, time_ac };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
|
||||
|
||||
@@ -3030,6 +3030,25 @@ cmd_wrap(gchar **args, struct cmd_help_t help)
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_time(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
if (g_strcmp0(args[0], "minutes") == 0) {
|
||||
prefs_set_string(PREF_TIME, "minutes");
|
||||
cons_show("Time precision set to minutes.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[0], "seconds") == 0) {
|
||||
prefs_set_string(PREF_TIME, "seconds");
|
||||
cons_show("Time precision set to seconds.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_states(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
|
||||
@@ -134,6 +134,7 @@ gboolean cmd_role(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_presence(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_wrap(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_time(gchar **args, struct cmd_help_t help);
|
||||
|
||||
gboolean cmd_form_field(char *tag, gchar **args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user