mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Show command in /prefs, and split into categories
This commit is contained in:
parent
5496b25735
commit
e7f2697e1f
@ -84,6 +84,8 @@ static char *_cmd_sub_complete(char *inp);
|
|||||||
static void _cmd_sub_reset_completer(void);
|
static void _cmd_sub_reset_completer(void);
|
||||||
static char *_cmd_log_complete(char *inp);
|
static char *_cmd_log_complete(char *inp);
|
||||||
static void _cmd_log_reset_completer(void);
|
static void _cmd_log_reset_completer(void);
|
||||||
|
static char *_cmd_prefs_complete(char *inp);
|
||||||
|
static void _cmd_prefs_reset_completer(void);
|
||||||
static void _cmd_complete_parameters(char *input, int *size);
|
static void _cmd_complete_parameters(char *input, int *size);
|
||||||
static void _notify_autocomplete(char *input, int *size);
|
static void _notify_autocomplete(char *input, int *size);
|
||||||
static void _parameter_autocomplete(char *input, int *size, char *command,
|
static void _parameter_autocomplete(char *input, int *size, char *command,
|
||||||
@ -183,12 +185,13 @@ static struct cmd_t main_commands[] =
|
|||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/prefs",
|
{ "/prefs",
|
||||||
_cmd_prefs, parse_args, 0, 0,
|
_cmd_prefs, parse_args, 0, 1,
|
||||||
{ "/prefs", "Show current preferences.",
|
{ "/prefs [ui|desktop|chat|log|xmpp]", "Show current preferences.",
|
||||||
{ "/prefs",
|
{ "/prefs [ui|desktop|chat|log|xmpp]",
|
||||||
"------",
|
"---------------------------------",
|
||||||
"List all current user preference settings.",
|
"Show current preferences.",
|
||||||
"User preferences are stored at:",
|
"The argument narrows down the category of preferences, with no argument showing all.",
|
||||||
|
"The perferences are stored in:",
|
||||||
"",
|
"",
|
||||||
" $XDG_CONFIG_HOME/profanity/profrc",
|
" $XDG_CONFIG_HOME/profanity/profrc",
|
||||||
"",
|
"",
|
||||||
@ -610,6 +613,7 @@ static PAutocomplete commands_ac;
|
|||||||
static PAutocomplete who_ac;
|
static PAutocomplete who_ac;
|
||||||
static PAutocomplete help_ac;
|
static PAutocomplete help_ac;
|
||||||
static PAutocomplete notify_ac;
|
static PAutocomplete notify_ac;
|
||||||
|
static PAutocomplete prefs_ac;
|
||||||
static PAutocomplete sub_ac;
|
static PAutocomplete sub_ac;
|
||||||
static PAutocomplete log_ac;
|
static PAutocomplete log_ac;
|
||||||
|
|
||||||
@ -624,6 +628,13 @@ cmd_init(void)
|
|||||||
commands_ac = p_autocomplete_new();
|
commands_ac = p_autocomplete_new();
|
||||||
who_ac = p_autocomplete_new();
|
who_ac = p_autocomplete_new();
|
||||||
|
|
||||||
|
prefs_ac = p_autocomplete_new();
|
||||||
|
p_autocomplete_add(prefs_ac, strdup("ui"));
|
||||||
|
p_autocomplete_add(prefs_ac, strdup("desktop"));
|
||||||
|
p_autocomplete_add(prefs_ac, strdup("chat"));
|
||||||
|
p_autocomplete_add(prefs_ac, strdup("log"));
|
||||||
|
p_autocomplete_add(prefs_ac, strdup("xmpp"));
|
||||||
|
|
||||||
help_ac = p_autocomplete_new();
|
help_ac = p_autocomplete_new();
|
||||||
p_autocomplete_add(help_ac, strdup("list"));
|
p_autocomplete_add(help_ac, strdup("list"));
|
||||||
p_autocomplete_add(help_ac, strdup("basic"));
|
p_autocomplete_add(help_ac, strdup("basic"));
|
||||||
@ -683,6 +694,7 @@ cmd_close(void)
|
|||||||
p_autocomplete_clear(notify_ac);
|
p_autocomplete_clear(notify_ac);
|
||||||
p_autocomplete_clear(sub_ac);
|
p_autocomplete_clear(sub_ac);
|
||||||
p_autocomplete_clear(log_ac);
|
p_autocomplete_clear(log_ac);
|
||||||
|
p_autocomplete_clear(prefs_ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command autocompletion functions
|
// Command autocompletion functions
|
||||||
@ -722,6 +734,7 @@ cmd_reset_autocomplete()
|
|||||||
_cmd_notify_reset_completer();
|
_cmd_notify_reset_completer();
|
||||||
_cmd_sub_reset_completer();
|
_cmd_sub_reset_completer();
|
||||||
_cmd_who_reset_completer();
|
_cmd_who_reset_completer();
|
||||||
|
_cmd_prefs_reset_completer();
|
||||||
_cmd_log_reset_completer();
|
_cmd_log_reset_completer();
|
||||||
_cmd_reset_command_completer();
|
_cmd_reset_command_completer();
|
||||||
}
|
}
|
||||||
@ -851,6 +864,18 @@ _cmd_who_reset_completer(void)
|
|||||||
p_autocomplete_reset(who_ac);
|
p_autocomplete_reset(who_ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_cmd_prefs_complete(char *inp)
|
||||||
|
{
|
||||||
|
return p_autocomplete_complete(prefs_ac, inp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cmd_prefs_reset_completer(void)
|
||||||
|
{
|
||||||
|
p_autocomplete_reset(prefs_ac);
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_cmd_help_complete(char *inp)
|
_cmd_help_complete(char *inp)
|
||||||
{
|
{
|
||||||
@ -935,6 +960,8 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
_cmd_help_complete);
|
_cmd_help_complete);
|
||||||
_parameter_autocomplete(input, size, "/who",
|
_parameter_autocomplete(input, size, "/who",
|
||||||
_cmd_who_complete);
|
_cmd_who_complete);
|
||||||
|
_parameter_autocomplete(input, size, "/prefs",
|
||||||
|
_cmd_prefs_complete);
|
||||||
_parameter_autocomplete(input, size, "/log",
|
_parameter_autocomplete(input, size, "/log",
|
||||||
_cmd_log_complete);
|
_cmd_log_complete);
|
||||||
|
|
||||||
@ -1209,7 +1236,31 @@ _cmd_about(gchar **args, struct cmd_help_t help)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cmd_prefs(gchar **args, struct cmd_help_t help)
|
_cmd_prefs(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
if (args[0] == NULL) {
|
||||||
cons_prefs();
|
cons_prefs();
|
||||||
|
} else if (strcmp(args[0], "ui") == 0) {
|
||||||
|
cons_show("");
|
||||||
|
cons_show_ui_prefs();
|
||||||
|
cons_show("");
|
||||||
|
} else if (strcmp(args[0], "desktop") == 0) {
|
||||||
|
cons_show("");
|
||||||
|
cons_show_desktop_prefs();
|
||||||
|
cons_show("");
|
||||||
|
} else if (strcmp(args[0], "chat") == 0) {
|
||||||
|
cons_show("");
|
||||||
|
cons_show_chat_prefs();
|
||||||
|
cons_show("");
|
||||||
|
} else if (strcmp(args[0], "log") == 0) {
|
||||||
|
cons_show("");
|
||||||
|
cons_show_log_prefs();
|
||||||
|
cons_show("");
|
||||||
|
} else if (strcmp(args[0], "xmpp") == 0) {
|
||||||
|
cons_show("");
|
||||||
|
cons_show_xmpp_prefs();
|
||||||
|
cons_show("");
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
5
src/ui.h
5
src/ui.h
@ -135,6 +135,11 @@ void cons_settings_help(void);
|
|||||||
void cons_presence_help(void);
|
void cons_presence_help(void);
|
||||||
void cons_navigation_help(void);
|
void cons_navigation_help(void);
|
||||||
void cons_prefs(void);
|
void cons_prefs(void);
|
||||||
|
void cons_show_ui_prefs(void);
|
||||||
|
void cons_show_desktop_prefs(void);
|
||||||
|
void cons_show_chat_prefs(void);
|
||||||
|
void cons_show_log_prefs(void);
|
||||||
|
void cons_show_xmpp_prefs(void);
|
||||||
void cons_bad_command(const char * const cmd);
|
void cons_bad_command(const char * const cmd);
|
||||||
void cons_show(const char * const cmd, ...);
|
void cons_show(const char * const cmd, ...);
|
||||||
void cons_show_time(void);
|
void cons_show_time(void);
|
||||||
|
155
src/windows.c
155
src/windows.c
@ -1031,105 +1031,146 @@ cons_show_status(const char * const contact)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_prefs(void)
|
cons_show_ui_prefs(void)
|
||||||
{
|
{
|
||||||
|
cons_show("UI preferences:");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
cons_show("Current preferences:");
|
|
||||||
cons_show("");
|
|
||||||
|
|
||||||
if (prefs_get_beep())
|
|
||||||
cons_show("Terminal beep : ON");
|
|
||||||
else
|
|
||||||
cons_show("Terminal beep : OFF");
|
|
||||||
|
|
||||||
if (prefs_get_flash())
|
|
||||||
cons_show("Terminal flash : ON");
|
|
||||||
else
|
|
||||||
cons_show("Terminal flash : OFF");
|
|
||||||
|
|
||||||
gchar *theme = prefs_get_theme();
|
gchar *theme = prefs_get_theme();
|
||||||
if (theme == NULL) {
|
if (theme == NULL) {
|
||||||
cons_show("Theme : default");
|
cons_show("Theme (/theme) : default");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Theme : %s", theme);
|
cons_show("Theme (/theme) : %s", theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_intype())
|
if (prefs_get_beep())
|
||||||
cons_show("Show typing : ON");
|
cons_show("Terminal beep (/beep) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Show typing : OFF");
|
cons_show("Terminal beep (/beep) : OFF");
|
||||||
|
|
||||||
|
if (prefs_get_flash())
|
||||||
|
cons_show("Terminal flash (/flash) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Terminal flash (/flash) : OFF");
|
||||||
|
|
||||||
|
if (prefs_get_intype())
|
||||||
|
cons_show("Show typing (/intype) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Show typing (/intype) : OFF");
|
||||||
|
|
||||||
if (prefs_get_showsplash())
|
if (prefs_get_showsplash())
|
||||||
cons_show("Splash screen : ON");
|
cons_show("Splash screen (/showsplash) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Splash screen : OFF");
|
cons_show("Splash screen (/showsplash) : OFF");
|
||||||
|
|
||||||
cons_show("Max log size : %d bytes", prefs_get_max_log_size());
|
|
||||||
|
|
||||||
if (prefs_get_chlog())
|
|
||||||
cons_show("Chat logging : ON");
|
|
||||||
else
|
|
||||||
cons_show("Chat logging : OFF");
|
|
||||||
|
|
||||||
if (prefs_get_states())
|
|
||||||
cons_show("Send chat states : ON");
|
|
||||||
else
|
|
||||||
cons_show("Send chat states : OFF");
|
|
||||||
|
|
||||||
if (prefs_get_outtype())
|
|
||||||
cons_show("Send typing notifications : ON");
|
|
||||||
else
|
|
||||||
cons_show("Send typing notifications : OFF");
|
|
||||||
|
|
||||||
if (prefs_get_history())
|
if (prefs_get_history())
|
||||||
cons_show("Chat history : ON");
|
cons_show("Chat history (/history) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Chat history : OFF");
|
cons_show("Chat history (/history) : OFF");
|
||||||
|
|
||||||
if (prefs_get_vercheck())
|
if (prefs_get_vercheck())
|
||||||
cons_show("Version checking : ON");
|
cons_show("Version checking (/vercheck) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Version checking : OFF");
|
cons_show("Version checking (/vercheck) : OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_show_desktop_prefs(void)
|
||||||
|
{
|
||||||
|
cons_show("Desktop notification preferences:");
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
if (prefs_get_notify_message())
|
if (prefs_get_notify_message())
|
||||||
cons_show("Message notifications : ON");
|
cons_show("Messages (/notify message) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Message notifications : OFF");
|
cons_show("Messages (/notify message) : OFF");
|
||||||
|
|
||||||
if (prefs_get_notify_typing())
|
if (prefs_get_notify_typing())
|
||||||
cons_show("Typing notifications : ON");
|
cons_show("Composing (/notify typing) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Typing notifications : OFF");
|
cons_show("Composing (/notify typing) : OFF");
|
||||||
|
|
||||||
gint remind_period = prefs_get_notify_remind();
|
gint remind_period = prefs_get_notify_remind();
|
||||||
if (remind_period == 0) {
|
if (remind_period == 0) {
|
||||||
cons_show("Reminder notification period : OFF");
|
cons_show("Reminder period (/notify remind) : OFF");
|
||||||
} else if (remind_period == 1) {
|
} else if (remind_period == 1) {
|
||||||
cons_show("Reminder notification period : 1 second");
|
cons_show("Reminder period (/notify remind) : 1 second");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Reminder notification period : %d seconds", remind_period);
|
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cons_show("Priority : %d", prefs_get_priority());
|
void
|
||||||
|
cons_show_chat_prefs(void)
|
||||||
|
{
|
||||||
|
cons_show("Chat preferences:");
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
|
if (prefs_get_states())
|
||||||
|
cons_show("Send chat states (/states) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Send chat states (/states) : OFF");
|
||||||
|
|
||||||
|
if (prefs_get_outtype())
|
||||||
|
cons_show("Send composing (/outtype) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Send composing (/outtype) : OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_show_log_prefs(void)
|
||||||
|
{
|
||||||
|
cons_show("Logging preferences:");
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
|
cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size());
|
||||||
|
|
||||||
|
if (prefs_get_chlog())
|
||||||
|
cons_show("Chat logging (/chlog) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Chat logging (/chlog) : OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_show_xmpp_prefs(void)
|
||||||
|
{
|
||||||
|
cons_show("XMPP preferences:");
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
|
cons_show("Priority (/priority) : %d", prefs_get_priority());
|
||||||
|
|
||||||
gint reconnect_interval = prefs_get_reconnect();
|
gint reconnect_interval = prefs_get_reconnect();
|
||||||
if (reconnect_interval == 0) {
|
if (reconnect_interval == 0) {
|
||||||
cons_show("Reconnect interval : OFF");
|
cons_show("Reconnect interval (/reconnect) : OFF");
|
||||||
} else if (remind_period == 1) {
|
} else if (reconnect_interval == 1) {
|
||||||
cons_show("Reconnect interval : 1 second");
|
cons_show("Reconnect interval (/reconnect) : 1 second");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Reconnect interval : %d seconds", reconnect_interval);
|
cons_show("Reconnect interval (/reconnect) : %d seconds", reconnect_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint autoping_interval = prefs_get_autoping();
|
gint autoping_interval = prefs_get_autoping();
|
||||||
if (autoping_interval == 0) {
|
if (autoping_interval == 0) {
|
||||||
cons_show("Autoping interval : OFF");
|
cons_show("Autoping interval (/autoping) : OFF");
|
||||||
} else if (remind_period == 1) {
|
} else if (autoping_interval == 1) {
|
||||||
cons_show("Autoping interval : 1 second");
|
cons_show("Autoping interval (/autoping) : 1 second");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Autoping interval : %d seconds", autoping_interval);
|
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_prefs(void)
|
||||||
|
{
|
||||||
|
cons_show("");
|
||||||
|
cons_show_ui_prefs();
|
||||||
|
cons_show("");
|
||||||
|
cons_show_desktop_prefs();
|
||||||
|
cons_show("");
|
||||||
|
cons_show_chat_prefs();
|
||||||
|
cons_show("");
|
||||||
|
cons_show_log_prefs();
|
||||||
|
cons_show("");
|
||||||
|
cons_show_xmpp_prefs();
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
if (current_index == 0) {
|
if (current_index == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user