about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-10 23:26:19 +0000
committerJames Booth <boothj5@gmail.com>2015-11-10 23:26:19 +0000
commit1e34b9c91492e17db2983e662ec5a266c9d7bdaf (patch)
tree92b2e97e023e087213809558464f287763684570 /src/command/commands.c
parentfcfdc175b6c94d1fd57e5a26b31f411a07ba3198 (diff)
downloadprofani-tty-1e34b9c91492e17db2983e662ec5a266c9d7bdaf.tar.gz
Added /tls trust
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 2c3ee1fa..1a74ebc1 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -194,6 +194,20 @@ cmd_tls(ProfWin *window, const char *const command, gchar **args)
         cons_show("Certificate path setting only supported when built with libmesode.");
         return TRUE;
 #endif
+    } else if (g_strcmp0(args[0], "trust") == 0) {
+#ifdef HAVE_LIBMESODE
+        TLSCertificate *cert = jabber_get_tls_peer_cert();
+        if (!tlscerts_exists(cert->fingerprint)) {
+            cons_show("Adding %s to trusted certificates.", cert->fingerprint);
+            tlscerts_add(cert);
+        } else {
+            cons_show("Certificate %s already trusted.", cert->fingerprint);
+        }
+        return TRUE;
+#else
+        cons_show("Manual certificate trust only supported when built with libmesode.");
+        return TRUE;
+#endif
     } else if (g_strcmp0(args[0], "trusted") == 0) {
 #ifdef HAVE_LIBMESODE
         GList *certs = tlscerts_list();