From 1ceca892965189b6f8751f40bd5e58e83d0f7baa Mon Sep 17 00:00:00 2001 From: lightb Date: Sat, 19 Apr 2014 05:08:33 -0400 Subject: Added some otr policy functionality, if policy is set to "always" if otr_is_secure fails, the message will not be sent. Changed both cmd_msg and cmd_execute_default --- src/command/command.c | 4 ++++ src/command/commands.c | 4 ++++ src/xmpp/message.c | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/command/command.c b/src/command/command.c index 31a481b7..902ef19a 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1328,6 +1328,10 @@ cmd_execute_default(const char * const inp) ui_current_print_line("You are not currently connected."); } else { #ifdef HAVE_LIBOTR + if ((strcmp(prefs_get_string(PREF_OTR_POLICY), "always") == 0) && !otr_is_secure(recipient)) { + cons_show_error("Failed to send message. Please check OTR policy"); + return TRUE; + } if (otr_is_secure(recipient)) { char *encrypted = otr_encrypt_message(recipient, inp); if (encrypted != NULL) { diff --git a/src/command/commands.c b/src/command/commands.c index e92bbe1d..8d5893c7 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -946,6 +946,10 @@ cmd_msg(gchar **args, struct cmd_help_t help) } if (msg != NULL) { #ifdef HAVE_LIBOTR + if ((strcmp(prefs_get_string(PREF_OTR_POLICY), "always") == 0) && !otr_is_secure(usr_jid)) { + cons_show_error("Failed to send message. Please check OTR policy"); + return TRUE; + } if (otr_is_secure(usr_jid)) { char *encrypted = otr_encrypt_message(usr_jid, msg); if (encrypted != NULL) { diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 6da2b367..4fc71f63 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -522,4 +522,3 @@ message_init_module(void) message_send_inactive = _message_send_inactive; message_send_gone = _message_send_gone; } - -- cgit 1.4.1-2-gfad0