about summary refs log tree commit diff stats
path: root/src/event/client_events.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/client_events.c')
-rw-r--r--src/event/client_events.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index 2a1d349a..2aa66d08 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -62,44 +62,14 @@ client_connect_account(ProfAccount *account)
 void
 client_send_msg(const char * const barejid, const char * const msg)
 {
-    char *id = NULL;
-
 #ifdef HAVE_LIBOTR
-    prof_otrpolicy_t policy = otr_get_policy(barejid);
-
-    if (otr_is_secure(barejid)) {
-        char *encrypted = otr_encrypt_message(barejid, msg);
-        if (encrypted != NULL) {
-            id = message_send_chat_encrypted(barejid, encrypted);
-            chat_log_otr_msg_out(barejid, msg);
-            ui_outgoing_chat_msg(barejid, msg, id);
-            otr_free_message(encrypted);
-        } else {
-            cons_show_error("Failed to encrypt and send message.");
-        }
-
-    } else if (policy == PROF_OTRPOLICY_ALWAYS) {
-        cons_show_error("Failed to send message. Please check OTR policy");
-
-    } else if (policy == PROF_OTRPOLICY_OPPORTUNISTIC) {
-        char *otr_tagged_msg = otr_tag_message(msg);
-        id = message_send_chat_encrypted(barejid, otr_tagged_msg);
-        ui_outgoing_chat_msg(barejid, msg, id);
-        chat_log_msg_out(barejid, msg);
-        free(otr_tagged_msg);
-
-    } else {
-        id = message_send_chat(barejid, msg);
-        ui_outgoing_chat_msg(barejid, msg, id);
-        chat_log_msg_out(barejid, msg);
-    }
+    otr_on_message_send(barejid, msg);
 #else
-    id = message_send_chat(barejid, msg);
+    char *id = message_send_chat(barejid, msg);
     chat_log_msg_out(barejid, msg);
     ui_outgoing_chat_msg(barejid, msg, id);
-#endif
-
     free(id);
+#endif
 }
 
 void