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.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index 70de5f6c..af8b833c 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -37,6 +37,7 @@
 #include "config.h"
 #include "log.h"
 #include "ui/ui.h"
+#include "ui/windows.h"
 #include "xmpp/xmpp.h"
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
@@ -60,14 +61,21 @@ cl_ev_connect_account(ProfAccount *account)
 }
 
 void
-cl_ev_send_msg(const char * const barejid, const char * const msg)
+cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg)
 {
+    chat_state_active(chatwin->state);
+
 #ifdef HAVE_LIBOTR
-    otr_on_message_send(barejid, msg);
+    prof_otrsendres_t res = otr_on_message_send(chatwin->barejid, msg);
+    if (res != PROF_OTRSUCCESS) {
+        char *errmsg = otr_senderror_str(res);
+        // TODO reference passed window
+        ui_current_error_line(errmsg);
+    }
 #else
-    char *id = message_send_chat(barejid, msg);
-    chat_log_msg_out(barejid, msg);
-    ui_outgoing_chat_msg(barejid, msg, id);
+    char *id = message_send_chat(chatwin->barejid, msg);
+    chat_log_msg_out(chatwin->barejid, msg);
+    ui_outgoing_chat_msg(chatwin->barejid, msg, id);
     free(id);
 #endif
 }