Added time format perferences per window type
This commit is contained in:
@@ -947,8 +947,8 @@ static struct cmd_t command_defs[] =
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/time main set <format>",
|
||||
"/time main off",
|
||||
"/time console|chat|muc|mucconfig|private|xml set <format>",
|
||||
"/time console|chat|muc|mucconfig|private|xml off",
|
||||
"/time statusbar set <format>",
|
||||
"/time statusbar off",
|
||||
"/time lastactivity set <format>")
|
||||
@@ -959,8 +959,18 @@ static struct cmd_t command_defs[] =
|
||||
"Setting the format to an unsupported string, will display the string. "
|
||||
"If the format contains spaces, it must be surrounded with double quotes.")
|
||||
CMD_ARGS(
|
||||
{ "main set <format>", "Change time format in main window." },
|
||||
{ "main off", "Do not show time in main window." },
|
||||
{ "console set <format>", "Set time format for console window." },
|
||||
{ "console off", "Do not show time in console window." },
|
||||
{ "chat set <format>", "Set time format for chat windows." },
|
||||
{ "chat off", "Do not show time in chat windows." },
|
||||
{ "muc set <format>", "Set time format for chat room windows." },
|
||||
{ "muc off", "Do not show time in chat room windows." },
|
||||
{ "mucconfig set <format>", "Set time format for chat room config windows." },
|
||||
{ "mucconfig off", "Do not show time in chat room config windows." },
|
||||
{ "private set <format>", "Set time format for private chat windows." },
|
||||
{ "private off", "Do not show time in private chat windows." },
|
||||
{ "xml set <format>", "Set time format for XML console window." },
|
||||
{ "xml off", "Do not show time in XML console window." },
|
||||
{ "statusbar set <format>", "Change time format in statusbar." },
|
||||
{ "statusbar off", "Do not show time in status bar." },
|
||||
{ "lastactivity set <format>", "Change time format for last activity." })
|
||||
@@ -2099,7 +2109,12 @@ cmd_init(void)
|
||||
autocomplete_add(occupants_show_ac, "jid");
|
||||
|
||||
time_ac = autocomplete_new();
|
||||
autocomplete_add(time_ac, "main");
|
||||
autocomplete_add(time_ac, "console");
|
||||
autocomplete_add(time_ac, "chat");
|
||||
autocomplete_add(time_ac, "muc");
|
||||
autocomplete_add(time_ac, "mucconfig");
|
||||
autocomplete_add(time_ac, "private");
|
||||
autocomplete_add(time_ac, "xml");
|
||||
autocomplete_add(time_ac, "statusbar");
|
||||
autocomplete_add(time_ac, "lastactivity");
|
||||
|
||||
@@ -3376,7 +3391,32 @@ _time_autocomplete(ProfWin *window, const char * const input)
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/time main", time_format_ac, TRUE);
|
||||
found = autocomplete_param_with_ac(input, "/time console", time_format_ac, TRUE);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/time chat", time_format_ac, TRUE);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/time muc", time_format_ac, TRUE);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/time mucconfig", time_format_ac, TRUE);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/time private", time_format_ac, TRUE);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/time xml", time_format_ac, TRUE);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -3571,7 +3571,7 @@ cmd_time(ProfWin *window, const char * const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "lastactivity") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("Current last activity time format is '%s'.", prefs_get_string(PREF_TIME_LASTACTIVITY));
|
||||
cons_show("Last activity time format: '%s'.", prefs_get_string(PREF_TIME_LASTACTIVITY));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]);
|
||||
@@ -3588,7 +3588,7 @@ cmd_time(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "statusbar") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("Current status bar time format is '%s'.", prefs_get_string(PREF_TIME_STATUSBAR));
|
||||
cons_show("Status bar time format: '%s'.", prefs_get_string(PREF_TIME_STATUSBAR));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME_STATUSBAR, args[2]);
|
||||
@@ -3596,7 +3596,7 @@ cmd_time(ProfWin *window, const char * const command, gchar **args)
|
||||
ui_redraw();
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "off") == 0) {
|
||||
prefs_set_string(PREF_TIME_STATUSBAR, "");
|
||||
prefs_set_string(PREF_TIME_STATUSBAR, "off");
|
||||
cons_show("Status bar time display disabled.");
|
||||
ui_redraw();
|
||||
return TRUE;
|
||||
@@ -3604,18 +3604,108 @@ cmd_time(ProfWin *window, const char * const command, gchar **args)
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "main") == 0) {
|
||||
} else if (g_strcmp0(args[0], "console") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("Current time format is '%s'.", prefs_get_string(PREF_TIME));
|
||||
cons_show("Console time format: '%s'.", prefs_get_string(PREF_TIME_CONSOLE));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME, args[2]);
|
||||
cons_show("Time format set to '%s'.", args[2]);
|
||||
prefs_set_string(PREF_TIME_CONSOLE, args[2]);
|
||||
cons_show("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, "");
|
||||
cons_show("Time display disabled.");
|
||||
prefs_set_string(PREF_TIME_CONSOLE, "off");
|
||||
cons_show("Console time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "chat") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("Chat time format: '%s'.", prefs_get_string(PREF_TIME_CHAT));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME_CHAT, args[2]);
|
||||
cons_show("Chat 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_CHAT, "off");
|
||||
cons_show("Chat time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "muc") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("MUC time format: '%s'.", prefs_get_string(PREF_TIME_MUC));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME_MUC, args[2]);
|
||||
cons_show("MUC 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_MUC, "off");
|
||||
cons_show("MUC time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "mucconfig") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("MUC config time format: '%s'.", prefs_get_string(PREF_TIME_MUCCONFIG));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME_MUCCONFIG, args[2]);
|
||||
cons_show("MUC config 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_MUCCONFIG, "off");
|
||||
cons_show("MUC config time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "private") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("Private chat time format: '%s'.", prefs_get_string(PREF_TIME_PRIVATE));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
prefs_set_string(PREF_TIME_PRIVATE, args[2]);
|
||||
cons_show("Private chat 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_PRIVATE, "off");
|
||||
cons_show("Private chat time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "xml") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_show("XML Console time format: '%s'.", prefs_get_string(PREF_TIME_XMLCONSOLE));
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
|
||||
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_XMLCONSOLE, "off");
|
||||
cons_show("XML Console time display disabled.");
|
||||
wins_resize_all();
|
||||
return TRUE;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user