1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-10-27 20:30:13 -04:00

Merge pull request #1809 from MarcoPolo-PasTonMolo/fix/no-ac-for-reconnect-now

Add autocomplete for the /reconnect command
This commit is contained in:
Michael Vetter 2023-04-03 17:15:35 +02:00 committed by GitHub
commit 46c1262b91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,7 @@ static char* _wintitle_autocomplete(ProfWin* window, const char* const input, gb
static char* _inpblock_autocomplete(ProfWin* window, const char* const input, gboolean previous); static char* _inpblock_autocomplete(ProfWin* window, const char* const input, gboolean previous);
static char* _time_autocomplete(ProfWin* window, const char* const input, gboolean previous); static char* _time_autocomplete(ProfWin* window, const char* const input, gboolean previous);
static char* _receipts_autocomplete(ProfWin* window, const char* const input, gboolean previous); static char* _receipts_autocomplete(ProfWin* window, const char* const input, gboolean previous);
static char* _reconnect_autocomplete(ProfWin* window, const char* const input, gboolean previous);
static char* _help_autocomplete(ProfWin* window, const char* const input, gboolean previous); static char* _help_autocomplete(ProfWin* window, const char* const input, gboolean previous);
static char* _wins_autocomplete(ProfWin* window, const char* const input, gboolean previous); static char* _wins_autocomplete(ProfWin* window, const char* const input, gboolean previous);
static char* _tls_autocomplete(ProfWin* window, const char* const input, gboolean previous); static char* _tls_autocomplete(ProfWin* window, const char* const input, gboolean previous);
@ -232,6 +233,7 @@ static Autocomplete time_format_ac;
static Autocomplete resource_ac; static Autocomplete resource_ac;
static Autocomplete inpblock_ac; static Autocomplete inpblock_ac;
static Autocomplete receipts_ac; static Autocomplete receipts_ac;
static Autocomplete reconnect_ac;
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
static Autocomplete pgp_ac; static Autocomplete pgp_ac;
static Autocomplete pgp_log_ac; static Autocomplete pgp_log_ac;
@ -886,6 +888,9 @@ cmd_ac_init(void)
autocomplete_add(receipts_ac, "send"); autocomplete_add(receipts_ac, "send");
autocomplete_add(receipts_ac, "request"); autocomplete_add(receipts_ac, "request");
reconnect_ac = autocomplete_new();
autocomplete_add(reconnect_ac, "now");
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
pgp_ac = autocomplete_new(); pgp_ac = autocomplete_new();
autocomplete_add(pgp_ac, "keys"); autocomplete_add(pgp_ac, "keys");
@ -1573,6 +1578,7 @@ cmd_ac_reset(ProfWin* window)
autocomplete_reset(resource_ac); autocomplete_reset(resource_ac);
autocomplete_reset(inpblock_ac); autocomplete_reset(inpblock_ac);
autocomplete_reset(receipts_ac); autocomplete_reset(receipts_ac);
autocomplete_reset(reconnect_ac);
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
autocomplete_reset(pgp_ac); autocomplete_reset(pgp_ac);
autocomplete_reset(pgp_log_ac); autocomplete_reset(pgp_log_ac);
@ -1752,6 +1758,7 @@ cmd_ac_uninit(void)
autocomplete_free(resource_ac); autocomplete_free(resource_ac);
autocomplete_free(inpblock_ac); autocomplete_free(inpblock_ac);
autocomplete_free(receipts_ac); autocomplete_free(receipts_ac);
autocomplete_free(reconnect_ac);
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
autocomplete_free(pgp_ac); autocomplete_free(pgp_ac);
autocomplete_free(pgp_log_ac); autocomplete_free(pgp_log_ac);
@ -2048,6 +2055,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete); g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
g_hash_table_insert(ac_funcs, "/time", _time_autocomplete); g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete); g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
g_hash_table_insert(ac_funcs, "/reconnect", _reconnect_autocomplete);
g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete); g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete);
g_hash_table_insert(ac_funcs, "/tls", _tls_autocomplete); g_hash_table_insert(ac_funcs, "/tls", _tls_autocomplete);
g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete); g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete);
@ -3550,6 +3558,14 @@ _receipts_autocomplete(ProfWin* window, const char* const input, gboolean previo
return result; return result;
} }
static char*
_reconnect_autocomplete(ProfWin* window, const char* const input, gboolean previous)
{
char* result = NULL;
result = autocomplete_param_with_ac(input, "/reconnect", reconnect_ac, TRUE, previous);
return result;
}
static char* static char*
_alias_autocomplete(ProfWin* window, const char* const input, gboolean previous) _alias_autocomplete(ProfWin* window, const char* const input, gboolean previous)
{ {