about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-10 20:20:38 +0000
committerJames Booth <boothj5@gmail.com>2014-01-10 20:20:38 +0000
commite294a6db92b23956be777844d3796393147f5f30 (patch)
tree700b460e60b6d69302eba1d2cab114ab4bb82ded /src/command
parent1b5254010ea1fd2b29d9802ed19de00d35e0cc8d (diff)
downloadprofani-tty-e294a6db92b23956be777844d3796393147f5f30.tar.gz
Added "/otr fp" to show users fingerprint
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c7
-rw-r--r--src/command/commands.c20
2 files changed, 16 insertions, 11 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 9aca7185..3f220cee 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -570,10 +570,11 @@ static struct cmd_t command_defs[] =
 
     { "/otr",
         cmd_otr, parse_args, 1, 2, NULL,
-        { "/otr gen|start|end|trust|untrust [contact]", "Off The Record encryption commands.",
-        { "/otr gen|start|end|trust|untrust [contact]",
-          "-----------------------------------------",
+        { "/otr gen|fp", "Off The Record encryption commands.",
+        { "/otr gen|fp",
+          "-----------",
           "gen - Load or create private key and fingerprints.",
+          "fp - Show your fingerprint.",
           NULL } } },
 
     { "/outtype",
diff --git a/src/command/commands.c b/src/command/commands.c
index b71e2af8..cb38d934 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2287,15 +2287,19 @@ gboolean
 cmd_otr(gchar **args, struct cmd_help_t help)
 {
 #ifdef HAVE_LIBOTR
+    if (jabber_get_connection_status() != JABBER_CONNECTED) {
+        cons_show("You must be connected with an account to load OTR information.");
+        return TRUE;
+    }
+
     if (strcmp(args[0], "gen") == 0) {
-        if (jabber_get_connection_status() != JABBER_CONNECTED) {
-            cons_show("You must be connected with an account to load OTR information.");
-            return TRUE;
-        } else {
-            ProfAccount *account = accounts_get_account(jabber_get_account_name());
-            otr_account_load(account);
-            return TRUE;
-        }
+        ProfAccount *account = accounts_get_account(jabber_get_account_name());
+        otr_account_load(account);
+        return TRUE;
+    } else if (strcmp(args[0], "fp") == 0) {
+        char *fingerprint = otr_get_fingerprint();
+        cons_show("Your fingerprint: %s", fingerprint);
+        return TRUE;
     } else {
         cons_show("Usage: %s", help.usage);
         return TRUE;