1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Added type autcomplete for /notify

This commit is contained in:
James Booth 2012-10-27 22:22:30 +01:00
parent c71259c322
commit 7e26fcdf84
3 changed files with 24 additions and 4 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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",