about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-08-23 23:05:39 +0100
committerJames Booth <boothj5@gmail.com>2015-08-23 23:05:39 +0100
commit8501d1db33e78f0fc19efb1d6b36915ca5ad2c7e (patch)
tree03301e577152ea5c8955ef139c69df557d5d0dd0
parent57ca441f0236a86f1091a2664da227bac4e2ea59 (diff)
downloadprofani-tty-8501d1db33e78f0fc19efb1d6b36915ca5ad2c7e.tar.gz
Validate PGP key when chosen for account
-rw-r--r--src/command/commands.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index e2323ce6..082b1bf8 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -486,8 +486,12 @@ cmd_account(ProfWin *window, const char * const command, gchar **args)
                     }
                     cons_show("");
                 } else if (strcmp(property, "pgpkeyid") == 0) {
-                    accounts_set_pgp_keyid(account_name, value);
-                    cons_show("Updated PGP key ID for account %s: %s", account_name, value);
+                    if (!p_gpg_valid_key(value)) {
+                        cons_show("Invalid PGP key ID specified, see /pgp keys");
+                    } else {
+                        accounts_set_pgp_keyid(account_name, value);
+                        cons_show("Updated PGP key ID for account %s: %s", account_name, value);
+                    }
                     cons_show("");
                 } else if (valid_resource_presence_string(property)) {
                     int intval;