From 7e26fcdf84e649ed25a0f8ec98ea44c7bf592113 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 27 Oct 2012 22:22:30 +0100 Subject: [PATCH] Added type autcomplete for /notify --- src/command.c | 21 ++++++++++++++++++++- src/command.h | 2 ++ src/input_win.c | 5 ++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/command.c b/src/command.c index 422eb4ed..55a44224 100644 --- a/src/command.c +++ b/src/command.c @@ -369,6 +369,7 @@ static struct cmd_t status_commands[] = static PAutocomplete commands_ac; static PAutocomplete help_ac; +static PAutocomplete notify_ac; /* * Initialise command autocompleter and history @@ -383,6 +384,10 @@ cmd_init(void) p_autocomplete_add(help_ac, strdup("status")); p_autocomplete_add(help_ac, strdup("settings")); p_autocomplete_add(help_ac, strdup("navigation")); + notify_ac = p_autocomplete_new(); + p_autocomplete_add(notify_ac, strdup("message")); + p_autocomplete_add(notify_ac, strdup("typing")); + p_autocomplete_add(notify_ac, strdup("remind")); unsigned int i; for (i = 0; i < ARRAY_SIZE(main_commands); i++) { @@ -411,6 +416,7 @@ cmd_close(void) { p_autocomplete_clear(commands_ac); p_autocomplete_clear(help_ac); + p_autocomplete_clear(notify_ac); } // Command autocompletion functions @@ -427,7 +433,7 @@ cmd_reset_completer(void) p_autocomplete_reset(commands_ac); } -// Command help +// Command help autocomplete char * cmd_help_complete(char *inp) { @@ -440,6 +446,19 @@ cmd_help_reset_completer(void) p_autocomplete_reset(help_ac); } +// Command notify autcomplete +char * +cmd_notify_complete(char *inp) +{ + return p_autocomplete_complete(notify_ac, inp); +} + +void +cmd_notify_reset_completer(void) +{ + p_autocomplete_reset(notify_ac); +} + GSList * cmd_get_basic_help(void) { diff --git a/src/command.h b/src/command.h index c15b6bd5..a7c37fcf 100644 --- a/src/command.h +++ b/src/command.h @@ -41,7 +41,9 @@ gboolean cmd_execute_default(const char * const inp); // command help char * cmd_help_complete(char *inp); +char * cmd_notify_complete(char *inp); void cmd_help_reset_completer(void); +void cmd_notify_reset_completer(void); GSList * cmd_get_basic_help(void); GSList * cmd_get_settings_help(void); GSList * cmd_get_status_help(void); diff --git a/src/input_win.c b/src/input_win.c index 3cb903e1..b69e3feb 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -174,6 +174,7 @@ inp_get_char(int *ch, char *input, int *size) prefs_reset_login_search(); prefs_reset_boolean_choice(); cmd_help_reset_completer(); + cmd_notify_reset_completer(); cmd_reset_completer(); } } @@ -361,9 +362,7 @@ _handle_edit(const int ch, char *input, int *size) _parameter_autocomplete(input, size, "/beep", prefs_autocomplete_boolean_choice); _parameter_autocomplete(input, size, "/notify", - prefs_autocomplete_boolean_choice); - _parameter_autocomplete(input, size, "/typing", - prefs_autocomplete_boolean_choice); + cmd_notify_complete); _parameter_autocomplete(input, size, "/flash", prefs_autocomplete_boolean_choice); _parameter_autocomplete(input, size, "/showsplash",