1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Allow empty autocomplete for /otr policy

This commit is contained in:
James Booth 2016-05-24 01:28:04 +01:00
parent f377e0329e
commit e183fd9186

View File

@ -1707,13 +1707,11 @@ _log_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
result = autocomplete_param_with_func(input, "/log rotate", result = autocomplete_param_with_func(input, "/log rotate", prefs_autocomplete_boolean_choice);
prefs_autocomplete_boolean_choice);
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_func(input, "/log shared", result = autocomplete_param_with_func(input, "/log shared", prefs_autocomplete_boolean_choice);
prefs_autocomplete_boolean_choice);
if (result) { if (result) {
return result; return result;
} }
@ -1765,12 +1763,14 @@ _otr_autocomplete(ProfWin *window, const char *const input)
// /otr policy always user@server.com // /otr policy always user@server.com
if (conn_status == JABBER_CONNECTED) { if (conn_status == JABBER_CONNECTED) {
gboolean result; gboolean result;
gchar **args = parse_args(input, 3, 3, &result); gchar **args = parse_args(input, 2, 3, &result);
if (result && (strcmp(args[0], "policy") == 0)) { if (result && (strcmp(args[0], "policy") == 0)) {
GString *beginning = g_string_new("/otr "); GString *beginning = g_string_new("/otr ");
g_string_append(beginning, args[0]); g_string_append(beginning, args[0]);
g_string_append(beginning, " "); g_string_append(beginning, " ");
g_string_append(beginning, args[1]); if (args[1]) {
g_string_append(beginning, args[1]);
}
found = autocomplete_param_with_func(input, beginning->str, roster_contact_autocomplete); found = autocomplete_param_with_func(input, beginning->str, roster_contact_autocomplete);
g_string_free(beginning, TRUE); g_string_free(beginning, TRUE);