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
}