about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/command/command.c4
-rw-r--r--src/command/commands.c4
-rw-r--r--src/xmpp/message.c1
3 files changed, 8 insertions, 1 deletions
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;
 }
-