Handle window creation for incoming and outgoing OTR sessions

This commit is contained in:
James Booth
2014-01-11 21:44:24 +00:00
parent 5a7eba518d
commit f35e485bd4
6 changed files with 53 additions and 8 deletions

View File

@@ -1141,7 +1141,7 @@ cmd_execute_default(const char * const inp)
ui_current_print_line("You are not currently connected.");
} else {
#ifdef HAVE_LIBOTR
if (ui_current_win_is_otr()) {
if (otr_is_secure(recipient)) {
char *encrypted = otr_encrypt_message(recipient, inp);
if (encrypted != NULL) {
message_send(encrypted, recipient);

View File

@@ -919,7 +919,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
}
if (msg != NULL) {
#ifdef HAVE_LIBOTR
if (ui_current_win_is_otr()) {
if (otr_is_secure(usr_jid)) {
char *encrypted = otr_encrypt_message(usr_jid, msg);
if (encrypted != NULL) {
message_send(encrypted, usr_jid);
@@ -2341,12 +2341,8 @@ cmd_otr(gchar **args, struct cmd_help_t help)
if (!otr_key_loaded()) {
ui_current_print_line("You have not generated or loaded a private key, use '/otr gen'");
} else {
ui_current_print_line("Starting OTR session");
char *recipient = ui_current_recipient();
message_send("?OTR?", recipient);
ui_current_set_otr(TRUE);
// refresh to show OTR in titlebar
ui_switch_win(ui_current_win_index());
}
}
return TRUE;