about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-12-15 00:38:16 +0000
committerJames Booth <boothj5@gmail.com>2015-12-15 00:38:16 +0000
commit88fd2a25ee8fdd9f2f8f36f3a705364800206867 (patch)
treed49752fd8533c1a4ecc295e6a72750ab78727331 /src/command
parent482eea4fcf68b9f2bd9f8d6f1db98fe313bef141 (diff)
downloadprofani-tty-88fd2a25ee8fdd9f2f8f36f3a705364800206867.tar.gz
Show PGP error strings
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 6db8f5d3..53f06b95 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -651,12 +651,14 @@ cmd_account(ProfWin *window, const char *const command, gchar **args)
                     cons_show("");
                 } else if (strcmp(property, "pgpkeyid") == 0) {
 #ifdef HAVE_LIBGPGME
-                    if (!p_gpg_valid_key(value)) {
-                        cons_show("Invalid PGP key ID specified, see /pgp keys");
+                    char *err_str = NULL;
+                    if (!p_gpg_valid_key(value, &err_str)) {
+                        cons_show("Invalid PGP key ID specified: %s, see /pgp keys", err_str);
                     } else {
                         accounts_set_pgp_keyid(account_name, value);
                         cons_show("Updated PGP key ID for account %s: %s", account_name, value);
                     }
+                    free(err_str);
 #else
                     cons_show("PGP support is not included in this build.");
 #endif
@@ -5319,11 +5321,14 @@ cmd_pgp(ProfWin *window, const char *const command, gchar **args)
         }
 
         ProfAccount *account = accounts_get_account(jabber_get_account_name());
-        if (!p_gpg_valid_key(account->pgp_keyid)) {
-            ui_current_print_formatted_line('!', 0, "You must specify a valid PGP key ID for this account to start PGP encryption.");
+        char *err_str = NULL;
+        if (!p_gpg_valid_key(account->pgp_keyid, &err_str)) {
+            ui_current_print_formatted_line('!', 0, "Invalid PGP key ID %s: %s, cannot start PGP encryption.", account->pgp_keyid, err_str);
+            free(err_str);
             account_free(account);
             return TRUE;
         }
+        free(err_str);
         account_free(account);
 
         if (!p_gpg_available(chatwin->barejid)) {