diff options
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/client_events.c | 18 | ||||
-rw-r--r-- | src/event/client_events.h | 2 | ||||
-rw-r--r-- | src/event/ui_events.c | 5 | ||||
-rw-r--r-- | src/event/ui_events.h | 2 |
4 files changed, 17 insertions, 10 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 } diff --git a/src/event/client_events.h b/src/event/client_events.h index fcf26523..c074b230 100644 --- a/src/event/client_events.h +++ b/src/event/client_events.h @@ -38,7 +38,7 @@ jabber_conn_status_t cl_ev_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port); jabber_conn_status_t cl_ev_connect_account(ProfAccount *account); -void cl_ev_send_msg(const char * const barejid, const char * const msg); +void cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg); void cl_ev_send_muc_msg(const char * const roomjid, const char * const msg); void cl_ev_send_priv_msg(const char * const fulljid, const char * const msg); diff --git a/src/event/ui_events.c b/src/event/ui_events.c index c079c0e6..2ad7562d 100644 --- a/src/event/ui_events.c +++ b/src/event/ui_events.c @@ -40,9 +40,8 @@ ui_ev_focus_win(ProfWin *win) ui_switch_win(win); } -void +ProfChatWin* ui_ev_new_chat_win(const char * const barejid) { - ProfWin *win = ui_new_chat_win(barejid); - ui_switch_win(win); + return ui_new_chat_win(barejid); } \ No newline at end of file diff --git a/src/event/ui_events.h b/src/event/ui_events.h index 77017d2c..b7075e61 100644 --- a/src/event/ui_events.h +++ b/src/event/ui_events.h @@ -36,6 +36,6 @@ #define UI_EVENTS_H void ui_ev_focus_win(ProfWin *win); -void ui_ev_new_chat_win(const char * const barejid); +ProfChatWin* ui_ev_new_chat_win(const char * const barejid); #endif \ No newline at end of file |