diff options
author | James Booth <boothj5@gmail.com> | 2015-08-25 23:44:03 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-08-25 23:44:03 +0100 |
commit | cb19be2ffcc1f2881427cc12f01ac8790d9236c1 (patch) | |
tree | fac2e88be2d777db348696fb00088ae45a87301f /src/command | |
parent | 55c2d1cc21974936e5b431de49ae81e6fc3845be (diff) | |
download | profani-tty-cb19be2ffcc1f2881427cc12f01ac8790d9236c1.tar.gz |
Added PGP key autocompleter
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index 58a2e295..487c9e02 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -59,6 +59,9 @@ #ifdef HAVE_LIBOTR #include "otr/otr.h" #endif +#ifdef HAVE_LIBGPGME +#include "pgp/gpg.h" +#endif #include "profanity.h" #include "tools/autocomplete.h" #include "tools/parser.h" @@ -2242,6 +2245,9 @@ cmd_reset_autocomplete(ProfWin *window) accounts_reset_enabled_search(); prefs_reset_boolean_choice(); presence_reset_sub_request_search(); +#ifdef HAVE_LIBGPGME + p_gpg_autocomplete_key_reset(); +#endif autocomplete_reset(help_ac); autocomplete_reset(help_commands_ac); autocomplete_reset(notify_ac); @@ -2983,6 +2989,26 @@ _pgp_autocomplete(ProfWin *window, const char * const input) return found; } +#ifdef HAVE_LIBGPGME + gboolean result; + gchar **args = parse_args(input, 2, 3, &result); + if ((strncmp(input, "/pgp", 4) == 0) && (result == TRUE)) { + GString *beginning = g_string_new("/pgp "); + g_string_append(beginning, args[0]); + if (args[1]) { + g_string_append(beginning, " "); + g_string_append(beginning, args[1]); + } + found = autocomplete_param_with_func(input, beginning->str, p_gpg_autocomplete_key); + g_string_free(beginning, TRUE); + if (found) { + g_strfreev(args); + return found; + } + } + g_strfreev(args); +#endif + found = autocomplete_param_with_func(input, "/pgp setkey", roster_barejid_autocomplete); if (found) { return found; |