about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-03-07 19:04:33 +0140
committerPaul Fariello <paul@fariello.eu>2019-04-10 16:31:45 +0200
commitb3be504e841be55f917a3841d9cddf4ce076cc04 (patch)
treee71af15a8308cc2dc10007008867f2f89548b0f2 /src/command/cmd_funcs.c
parent55407ee15f0ebdf93c076ae5ea28ec865497b121 (diff)
downloadprofani-tty-b3be504e841be55f917a3841d9cddf4ce076cc04.tar.gz
Add OMEMO fingerprint command
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 5ce9b7f4..70940f17 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -7988,3 +7988,31 @@ cmd_omemo_start(ProfWin *window, const char *const command, gchar **args)
     return TRUE;
 #endif
 }
+
+gboolean
+cmd_omemo_fingerprint(ProfWin *window, const char *const command, gchar **args)
+{
+#ifdef HAVE_OMEMO
+    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();
+    char *formated_fingerprint = omemo_format_fingerprint(fingerprint);
+    cons_show("%s", formated_fingerprint);
+
+    free(fingerprint);
+    free(formated_fingerprint);
+
+    return TRUE;
+#else
+    cons_show("This version of Profanity has not been built with OMEMO support enabled");
+    return TRUE;
+#endif
+}
31 132 133 134 135 136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173