diff options
Diffstat (limited to 'src/command/cmd_ac.c')
-rw-r--r-- | src/command/cmd_ac.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 09de573c..e64da7ce 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -123,7 +123,7 @@ static char* _avatar_autocomplete(ProfWin *window, const char *const input, gboo static char* _correction_autocomplete(ProfWin *window, const char *const input, gboolean previous); static char* _correct_autocomplete(ProfWin *window, const char *const input, gboolean previous); static char* _software_autocomplete(ProfWin *window, const char *const input, gboolean previous); -static char* _urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previous); +static char* _url_autocomplete(ProfWin *window, const char *const input, gboolean previous); static char* _executable_autocomplete(ProfWin *window, const char *const input, gboolean previous); static char* _script_autocomplete_func(const char *const prefix, gboolean previous, void *context); @@ -259,6 +259,7 @@ static Autocomplete logging_group_ac; static Autocomplete color_ac; static Autocomplete correction_ac; static Autocomplete avatar_ac; +static Autocomplete url_ac; static Autocomplete executable_ac; void @@ -1007,9 +1008,14 @@ cmd_ac_init(void) autocomplete_add(avatar_ac, "get"); autocomplete_add(avatar_ac, "open"); + url_ac = autocomplete_new(); + autocomplete_add(url_ac, "open"); + autocomplete_add(url_ac, "save"); + executable_ac = autocomplete_new(); autocomplete_add(executable_ac, "avatar"); autocomplete_add(executable_ac, "urlopen"); + autocomplete_add(executable_ac, "urlsave"); } void @@ -1328,6 +1334,7 @@ cmd_ac_reset(ProfWin *window) autocomplete_reset(color_ac); autocomplete_reset(correction_ac); autocomplete_reset(avatar_ac); + autocomplete_reset(url_ac); autocomplete_reset(executable_ac); autocomplete_reset(script_ac); @@ -1489,6 +1496,7 @@ cmd_ac_uninit(void) autocomplete_free(color_ac); autocomplete_free(correction_ac); autocomplete_free(avatar_ac); + autocomplete_free(url_ac); autocomplete_free(executable_ac); } @@ -1749,7 +1757,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete); g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete); g_hash_table_insert(ac_funcs, "/software", _software_autocomplete); - g_hash_table_insert(ac_funcs, "/urlopen", _urlopen_autocomplete); + g_hash_table_insert(ac_funcs, "/url", _url_autocomplete); g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete); int len = strlen(input); @@ -4036,14 +4044,24 @@ _software_autocomplete(ProfWin *window, const char *const input, gboolean previo } static char* -_urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previous) +_url_autocomplete(ProfWin *window, const char *const input, gboolean previous) { char *result = NULL; + result = autocomplete_param_with_ac(input, "/url", url_ac, TRUE, previous); + if (result) { + return result; + } + if (window->type == WIN_CHAT || window->type == WIN_MUC || window->type == WIN_PRIVATE) { - result = autocomplete_param_with_func(input, "/urlopen", wins_get_url, previous, window); + result = autocomplete_param_with_func(input, "/url open", wins_get_url, previous, window); + if (result) { + return result; + } + + result = autocomplete_param_with_func(input, "/url save", wins_get_url, previous, window); } return result; |