1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge pull request #1118 from profanity-im/fix/1117-omemo-autocompletion-crash

Only complete certain omemo commands if connected
This commit is contained in:
Michael Vetter 2019-06-07 19:49:08 +02:00 committed by GitHub
commit 1772236178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2183,39 +2183,6 @@ _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
char *found = NULL;
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) {
found = autocomplete_param_with_func(input, "/omemo start", roster_contact_autocomplete, previous);
if (found) {
return found;
}
}
found = autocomplete_param_with_func(input, "/omemo fingerprint", roster_contact_autocomplete, previous);
if (found) {
return found;
}
#ifdef HAVE_OMEMO
if (window->type == WIN_CHAT) {
found = autocomplete_param_with_func(input, "/omemo trust", omemo_fingerprint_autocomplete, previous);
if (found) {
return found;
}
} else {
found = autocomplete_param_with_func(input, "/omemo trust", roster_contact_autocomplete, previous);
if (found) {
return found;
}
found = autocomplete_param_no_with_func(input, "/omemo trust", 4, omemo_fingerprint_autocomplete, previous);
if (found) {
return found;
}
}
#endif
found = autocomplete_param_with_ac(input, "/omemo log", omemo_log_ac, TRUE, previous);
if (found) {
return found;
@ -2226,6 +2193,40 @@ _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
return found;
}
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) {
found = autocomplete_param_with_func(input, "/omemo start", roster_contact_autocomplete, previous);
if (found) {
return found;
}
found = autocomplete_param_with_func(input, "/omemo fingerprint", roster_contact_autocomplete, previous);
if (found) {
return found;
}
#ifdef HAVE_OMEMO
if (window->type == WIN_CHAT) {
found = autocomplete_param_with_func(input, "/omemo trust", omemo_fingerprint_autocomplete, previous);
if (found) {
return found;
}
} else {
found = autocomplete_param_with_func(input, "/omemo trust", roster_contact_autocomplete, previous);
if (found) {
return found;
}
found = autocomplete_param_no_with_func(input, "/omemo trust", 4, omemo_fingerprint_autocomplete, previous);
if (found) {
return found;
}
}
#endif
}
found = autocomplete_param_with_ac(input, "/omemo", omemo_ac, TRUE, previous);
if (found) {
return found;