Return result on OTR message sending

This commit is contained in:
James Booth
2015-04-29 22:59:44 +01:00
parent 0df8b8beff
commit 665c34414d
11 changed files with 75 additions and 50 deletions

View File

@@ -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
}

View File

@@ -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);

View File

@@ -40,7 +40,7 @@ ui_ev_focus_win(ProfWin *win)
ui_switch_win(win);
}
ProfWin*
ProfChatWin*
ui_ev_new_chat_win(const char * const barejid)
{
return ui_new_chat_win(barejid);

View File

@@ -36,6 +36,6 @@
#define UI_EVENTS_H
void ui_ev_focus_win(ProfWin *win);
ProfWin* ui_ev_new_chat_win(const char * const barejid);
ProfChatWin* ui_ev_new_chat_win(const char * const barejid);
#endif