about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-11 20:02:35 +0000
committerJames Booth <boothj5@gmail.com>2014-01-11 20:02:35 +0000
commit5a7eba518d4193696051601e77d75dc3d9051567 (patch)
treee2504a672f3b1e25ba0a09e3725b3d14f17e7f44 /src
parent03086c03841d2f1b44d086d4d17838abf5fb1e4c (diff)
downloadprofani-tty-5a7eba518d4193696051601e77d75dc3d9051567.tar.gz
Show contacts fingerprint on /otr theirfp
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c2
-rw-r--r--src/otr.c15
2 files changed, 14 insertions, 3 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 4eb8a645..a7bf7087 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2313,7 +2313,7 @@ cmd_otr(gchar **args, struct cmd_help_t help)
         return TRUE;
     } else if (strcmp(args[0], "myfp") == 0) {
         char *fingerprint = otr_get_my_fingerprint();
-        cons_show("Your fingerprint: %s", fingerprint);
+        ui_current_print_line("Your OTR fingerprint: %s", fingerprint);
         free(fingerprint);
         return TRUE;
     } else if (strcmp(args[0], "theirfp") == 0) {
diff --git a/src/otr.c b/src/otr.c
index 52ce6540..a0274e3a 100644
--- a/src/otr.c
+++ b/src/otr.c
@@ -345,8 +345,17 @@ otr_get_my_fingerprint(void)
 char *
 otr_get_their_fingerprint(char *recipient)
 {
-    char *fingerprint = "1234 5678";
-    return strdup(fingerprint);
+    ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
+        0, NULL, NULL, NULL);
+
+    if (context != NULL) {
+        Fingerprint *fingerprint = context->active_fingerprint;
+        char readable[45];
+        otrl_privkey_hash_to_human(readable, fingerprint->fingerprint);
+        return strdup(readable);
+    } else {
+        return NULL;
+    }
 }
 
 char *
@@ -386,6 +395,7 @@ otr_decrypt_message(const char * const from, const char * const message)
 
     // internal libotr message, ignore
     if (result == 1) {
+        cons_debug("Internal message.");
         return NULL;
 
     // message was decrypted, return to user
@@ -395,6 +405,7 @@ otr_decrypt_message(const char * const from, const char * const message)
 
     // normal non OTR message
     } else {
+        cons_debug("Non OTR message.");
         return strdup(message);
     }
 }