WIP - OTR support

This commit is contained in:
James Booth
2014-01-10 00:08:49 +00:00
parent 49deb932e6
commit 84f1c4b96f
5 changed files with 109 additions and 31 deletions

View File

@@ -1140,12 +1140,22 @@ cmd_execute_default(const char * const inp)
} else {
#ifdef HAVE_LIBOTR
char *encrypted = otr_encrypt_message(recipient, inp);
message_send(encrypted, recipient);
otr_free_message(encrypted);
if (encrypted != NULL) {
message_send(encrypted, recipient);
otr_free_message(encrypted);
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid();
Jid *jidp = jid_create(jid);
chat_log_chat(jidp->barejid, recipient, inp, PROF_OUT_LOG, NULL);
jid_destroy(jidp);
}
ui_outgoing_msg("me", recipient, inp);
} else {
cons_show_error("Failed to send message.");
}
#else
message_send(inp, recipient);
#endif
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid();
Jid *jidp = jid_create(jid);
@@ -1154,6 +1164,8 @@ cmd_execute_default(const char * const inp)
}
ui_outgoing_msg("me", recipient, inp);
#endif
}
break;