about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 86285a46..bc1e162b 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -56,6 +56,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"
@@ -4064,6 +4067,31 @@ cmd_xa(gchar **args, struct cmd_help_t help)
 }
 
 gboolean
+cmd_pgp(gchar **args, struct cmd_help_t help)
+{
+#ifdef HAVE_LIBGPGME
+    if (g_strcmp0(args[0], "keys") == 0) {
+        GSList *keys = p_gpg_list_keys();
+        if (keys) {
+            while (keys) {
+                cons_debug("Key: %s", keys->data);
+                keys = g_slist_next(keys);
+            }
+        } else {
+            cons_debug("No keys found");
+        }
+        g_slist_free_full(keys, (GDestroyNotify)free);
+    }
+
+    return TRUE;
+#else
+    cons_show("This version of Profanity has not been built with PGP support enabled");
+    return TRUE;
+#endif
+
+}
+
+gboolean
 cmd_otr(gchar **args, struct cmd_help_t help)
 {
 #ifdef HAVE_LIBOTR