1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Added quote param to autocomplete_param_with_ac

This commit is contained in:
James Booth 2014-07-09 20:32:28 +01:00
parent 954661e59e
commit 2f3234a5f5
4 changed files with 38 additions and 38 deletions

View File

@ -1526,7 +1526,7 @@ _cmd_complete_parameters(char *input, int *size)
for (i = 0; i < ARRAY_SIZE(nick_choices); i++) {
result = autocomplete_param_with_ac(input, size, nick_choices[i],
nick_ac);
nick_ac, TRUE);
if (result != NULL) {
ui_replace_input(input, result, size);
g_free(result);
@ -1582,7 +1582,7 @@ _cmd_complete_parameters(char *input, int *size)
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac };
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i]);
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
if (result != NULL) {
ui_replace_input(input, result, size);
g_free(result);
@ -1647,7 +1647,7 @@ _sub_autocomplete(char *input, int *size)
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/sub", sub_ac);
result = autocomplete_param_with_ac(input, size, "/sub", sub_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1671,7 +1671,7 @@ _who_autocomplete(char *input, int *size)
}
}
result = autocomplete_param_with_ac(input, size, "/who", who_ac);
result = autocomplete_param_with_ac(input, size, "/who", who_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1695,7 +1695,7 @@ _roster_autocomplete(char *input, int *size)
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/roster", roster_ac);
result = autocomplete_param_with_ac(input, size, "/roster", roster_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1728,7 +1728,7 @@ _group_autocomplete(char *input, int *size)
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/group", group_ac);
result = autocomplete_param_with_ac(input, size, "/group", group_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1787,7 +1787,7 @@ _bookmark_autocomplete(char *input, int *size)
if (autojoin) {
found = autocomplete_param_with_func(input, size, beginning->str, prefs_autocomplete_boolean_choice);
} else {
found = autocomplete_param_with_ac(input, size, beginning->str, bookmark_property_ac);
found = autocomplete_param_with_ac(input, size, beginning->str, bookmark_property_ac, TRUE);
}
g_string_free(beginning, TRUE);
if (found != NULL) {
@ -1808,7 +1808,7 @@ _bookmark_autocomplete(char *input, int *size)
return found;
}
found = autocomplete_param_with_ac(input, size, "/bookmark", bookmark_ac);
found = autocomplete_param_with_ac(input, size, "/bookmark", bookmark_ac, TRUE);
return found;
}
@ -1843,17 +1843,17 @@ _notify_autocomplete(char *input, int *size)
return result;
}
result = autocomplete_param_with_ac(input, size, "/notify room", notify_room_ac);
result = autocomplete_param_with_ac(input, size, "/notify room", notify_room_ac, TRUE);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/notify message", notify_message_ac);
result = autocomplete_param_with_ac(input, size, "/notify message", notify_message_ac, TRUE);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/notify typing", notify_typing_ac);
result = autocomplete_param_with_ac(input, size, "/notify typing", notify_typing_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1867,7 +1867,7 @@ _notify_autocomplete(char *input, int *size)
}
}
result = autocomplete_param_with_ac(input, size, "/notify", notify_ac);
result = autocomplete_param_with_ac(input, size, "/notify", notify_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1880,7 +1880,7 @@ _autoaway_autocomplete(char *input, int *size)
{
char *result = NULL;
result = autocomplete_param_with_ac(input, size, "/autoaway mode", autoaway_mode_ac);
result = autocomplete_param_with_ac(input, size, "/autoaway mode", autoaway_mode_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1889,7 +1889,7 @@ _autoaway_autocomplete(char *input, int *size)
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/autoaway", autoaway_ac);
result = autocomplete_param_with_ac(input, size, "/autoaway", autoaway_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1912,7 +1912,7 @@ _log_autocomplete(char *input, int *size)
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/log", log_ac);
result = autocomplete_param_with_ac(input, size, "/log", log_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1930,7 +1930,7 @@ _autoconnect_autocomplete(char *input, int *size)
return result;
}
result = autocomplete_param_with_ac(input, size, "/autoconnect", autoconnect_ac);
result = autocomplete_param_with_ac(input, size, "/autoconnect", autoconnect_ac, TRUE);
if (result != NULL) {
return result;
}
@ -1948,7 +1948,7 @@ _otr_autocomplete(char *input, int *size)
return found;
}
found = autocomplete_param_with_ac(input, size, "/otr log", otr_log_ac);
found = autocomplete_param_with_ac(input, size, "/otr log", otr_log_ac, TRUE);
if (found != NULL) {
return found;
}
@ -1969,7 +1969,7 @@ _otr_autocomplete(char *input, int *size)
}
}
found = autocomplete_param_with_ac(input, size, "/otr policy", otr_policy_ac);
found = autocomplete_param_with_ac(input, size, "/otr policy", otr_policy_ac, TRUE);
if (found != NULL) {
return found;
}
@ -1980,7 +1980,7 @@ _otr_autocomplete(char *input, int *size)
return found;
}
found = autocomplete_param_with_ac(input, size, "/otr", otr_ac);
found = autocomplete_param_with_ac(input, size, "/otr", otr_ac, TRUE);
if (found != NULL) {
return found;
}
@ -2003,12 +2003,12 @@ _theme_autocomplete(char *input, int *size)
g_slist_free(themes);
autocomplete_add(theme_load_ac, "default");
}
result = autocomplete_param_with_ac(input, size, "/theme set", theme_load_ac);
result = autocomplete_param_with_ac(input, size, "/theme set", theme_load_ac, TRUE);
if (result != NULL) {
return result;
}
}
result = autocomplete_param_with_ac(input, size, "/theme", theme_ac);
result = autocomplete_param_with_ac(input, size, "/theme", theme_ac, TRUE);
if (result != NULL) {
return result;
}
@ -2021,22 +2021,22 @@ _statuses_autocomplete(char *input, int *size)
{
char *result = NULL;
result = autocomplete_param_with_ac(input, size, "/statuses console", statuses_setting_ac);
result = autocomplete_param_with_ac(input, size, "/statuses console", statuses_setting_ac, TRUE);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/statuses chat", statuses_setting_ac);
result = autocomplete_param_with_ac(input, size, "/statuses chat", statuses_setting_ac, TRUE);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/statuses muc", statuses_setting_ac);
result = autocomplete_param_with_ac(input, size, "/statuses muc", statuses_setting_ac, TRUE);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/statuses", statuses_ac);
result = autocomplete_param_with_ac(input, size, "/statuses", statuses_ac, TRUE);
if (result != NULL) {
return result;
}
@ -2049,12 +2049,12 @@ _alias_autocomplete(char *input, int *size)
{
char *result = NULL;
result = autocomplete_param_with_ac(input, size, "/alias remove", aliases_ac);
result = autocomplete_param_with_ac(input, size, "/alias remove", aliases_ac, TRUE);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_ac(input, size, "/alias", alias_ac);
result = autocomplete_param_with_ac(input, size, "/alias", alias_ac, TRUE);
if (result != NULL) {
return result;
}
@ -2080,7 +2080,7 @@ _connect_autocomplete(char *input, int *size)
g_string_append(beginning, " ");
g_string_append(beginning, args[2]);
}
found = autocomplete_param_with_ac(input, size, beginning->str, connect_property_ac);
found = autocomplete_param_with_ac(input, size, beginning->str, connect_property_ac, TRUE);
g_string_free(beginning, TRUE);
if (found != NULL) {
return found;
@ -2119,7 +2119,7 @@ _join_autocomplete(char *input, int *size)
g_string_append(beginning, " ");
g_string_append(beginning, args[2]);
}
found = autocomplete_param_with_ac(input, size, beginning->str, join_property_ac);
found = autocomplete_param_with_ac(input, size, beginning->str, join_property_ac, TRUE);
g_string_free(beginning, TRUE);
if (found != NULL) {
return found;
@ -2144,13 +2144,13 @@ _account_autocomplete(char *input, int *size)
if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "otr")) == 0) {
g_string_append(beginning, " ");
g_string_append(beginning, args[2]);
found = autocomplete_param_with_ac(input, size, beginning->str, otr_policy_ac);
found = autocomplete_param_with_ac(input, size, beginning->str, otr_policy_ac, TRUE);
g_string_free(beginning, TRUE);
if (found != NULL) {
return found;
}
} else {
found = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac);
found = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac, TRUE);
g_string_free(beginning, TRUE);
if (found != NULL) {
return found;
@ -2161,7 +2161,7 @@ _account_autocomplete(char *input, int *size)
if ((strncmp(input, "/account clear", 14) == 0) && (result == TRUE)) {
GString *beginning = g_string_new("/account clear ");
g_string_append(beginning, args[1]);
found = autocomplete_param_with_ac(input, size, beginning->str, account_clear_ac);
found = autocomplete_param_with_ac(input, size, beginning->str, account_clear_ac, TRUE);
g_string_free(beginning, TRUE);
if (found != NULL) {
return found;
@ -2182,6 +2182,6 @@ _account_autocomplete(char *input, int *size)
}
}
found = autocomplete_param_with_ac(input, size, "/account", account_ac);
found = autocomplete_param_with_ac(input, size, "/account", account_ac, TRUE);
return found;
}

View File

@ -578,11 +578,11 @@ muc_autocomplete(char *input, int *size)
gchar *last_space = g_strrstr(input, " ");
char *result = NULL;
if (last_space == NULL) {
result = autocomplete_complete(nick_ac, input, TRUE);
result = autocomplete_complete(nick_ac, input, FALSE);
} else {
int len = (last_space - input);
char *start_str = strndup(input, len);
result = autocomplete_param_with_ac(input, size, start_str, nick_ac);
result = autocomplete_param_with_ac(input, size, start_str, nick_ac, FALSE);
free(start_str);
}
if (result != NULL) {

View File

@ -220,7 +220,7 @@ autocomplete_param_with_func(char *input, int *size, char *command,
char *
autocomplete_param_with_ac(char *input, int *size, char *command,
Autocomplete ac)
Autocomplete ac, gboolean quote)
{
GString *auto_msg = NULL;
char *result = NULL;
@ -235,7 +235,7 @@ autocomplete_param_with_ac(char *input, int *size, char *command,
}
inp_cpy[(*size) - len] = '\0';
char *found = autocomplete_complete(ac, inp_cpy, TRUE);
char *found = autocomplete_complete(ac, inp_cpy, quote);
if (found != NULL) {
auto_msg = g_string_new(command_cpy);
g_string_append(auto_msg, found);

View File

@ -50,7 +50,7 @@ char * autocomplete_param_with_func(char *input, int *size, char *command,
autocomplete_func func);
char * autocomplete_param_with_ac(char *input, int *size, char *command,
Autocomplete ac);
Autocomplete ac, gboolean quote);
char * autocomplete_param_no_with_func(char *input, int *size, char *command,
int arg_number, autocomplete_func func);