about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorswirl <swurl@swurl.xyz>2022-05-27 15:25:28 -0400
committerMichael Vetter <jubalh@iodoru.org>2022-05-30 18:04:42 +0200
commit9a9a97868d0366408d7a310de3fa7158a294854e (patch)
tree74641d809f9f8f52b3d3507eb1fcc84b52c6c08a /src/command
parentcf83976b51dd103a17b75dd77f326f64166199bc (diff)
downloadprofani-tty-9a9a97868d0366408d7a310de3fa7158a294854e.tar.gz
implement working OMEMO QR code
TODO: We need to find a way to switch the colors of the QR code, so that
more QR readers can detect it, without "blending" the edges of the QR
code with the surrounding terminal window.

Signed-off-by: swirl <swurl@swurl.xyz>
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_funcs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 29c8a29a..81293c15 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -9039,7 +9039,18 @@ gboolean
 cmd_omemo_qrcode(ProfWin* window, const char* const command, gchar** args)
 {
 #ifdef HAVE_OMEMO
-    cons_show_omemo_qrcode("some text from me");
+    if (connection_get_status() != JABBER_CONNECTED) {
+        cons_show("You must be connected with an account to load OMEMO information.");
+        return TRUE;
+    }
+
+    if (!omemo_loaded()) {
+        win_println(window, THEME_DEFAULT, "!", "You have not generated or loaded a cryptographic materials, use '/omemo gen'");
+        return TRUE;
+    }
+
+    char* fingerprint = omemo_own_fingerprint(TRUE);
+    cons_show_omemo_qrcode(fingerprint);
     return TRUE;
 #else
     cons_show("This version of Profanity has not been built with OMEMO support enabled");
@@ -9767,3 +9778,4 @@ cmd_mood(ProfWin* window, const char* const command, gchar** args)
     }
     return TRUE;
 }
+