about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-02-26 20:33:06 +0140
committerPaul Fariello <paul@fariello.eu>2019-04-10 16:03:50 +0200
commit0fb27dc4961608eb9b088ca659eb087dd2c1cae7 (patch)
treecaf8fd8ac5d330e98376b98f471115303b8cc523 /src/event
parentb1ae220aa47ff503fe368e4802061be159dfb42b (diff)
downloadprofani-tty-0fb27dc4961608eb9b088ca659eb087dd2c1cae7.tar.gz
Add OMEMO message encryption and decryption
Diffstat (limited to 'src/event')
-rw-r--r--src/event/client_events.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index 3b6218ea..76a38b15 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -54,6 +54,10 @@
 #include "pgp/gpg.h"
 #endif
 
+#ifdef HAVE_OMEMO
+#include "omemo/omemo.h"
+#endif
+
 jabber_conn_status_t
 cl_ev_connect_jid(const char *const jid, const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy)
 {
@@ -203,6 +207,21 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
 #endif
 #endif
 
+#ifdef HAVE_OMEMO
+    if (chatwin->is_omemo) {
+        omemo_on_message_send(chatwin, plugin_msg, request_receipt);
+    } else {
+        char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
+        chat_log_msg_out(chatwin->barejid, plugin_msg);
+        chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
+        free(id);
+    }
+
+    plugins_post_chat_message_send(chatwin->barejid, plugin_msg);
+    free(plugin_msg);
+    return;
+#endif
+
 // OTR unsupported, PGP unsupported
 #ifndef HAVE_LIBOTR
 #ifndef HAVE_LIBGPGME