WIP - OTR support
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -916,6 +916,24 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
||||
usr_jid = usr;
|
||||
}
|
||||
if (msg != NULL) {
|
||||
#ifdef HAVE_LIBOTR
|
||||
char *encrypted = otr_encrypt_message(usr_jid, msg);
|
||||
if (encrypted != NULL) {
|
||||
message_send(encrypted, usr_jid);
|
||||
otr_free_message(encrypted);
|
||||
ui_outgoing_msg("me", usr_jid, msg);
|
||||
|
||||
if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
chat_log_chat(jidp->barejid, usr_jid, msg, PROF_OUT_LOG, NULL);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
} else {
|
||||
cons_show_error("Failed to send message,");
|
||||
}
|
||||
|
||||
#else
|
||||
message_send(msg, usr_jid);
|
||||
ui_outgoing_msg("me", usr_jid, msg);
|
||||
|
||||
@@ -924,7 +942,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
||||
Jid *jidp = jid_create(jid);
|
||||
chat_log_chat(jidp->barejid, usr_jid, msg, PROF_OUT_LOG, NULL);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user