about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorlightb <lightb@bigfoot>2014-04-19 05:08:33 -0400
committerlightb <lightb@bigfoot>2014-04-19 05:08:33 -0400
commit1ceca892965189b6f8751f40bd5e58e83d0f7baa (patch)
tree57b76f8c39f1c5a20c9ba27881a1caba80be7951 /src
parenta687e3f6b4abe5e5917d25fea9f9d0bfb0c3a98d (diff)
downloadprofani-tty-1ceca892965189b6f8751f40bd5e58e83d0f7baa.tar.gz
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
Diffstat (limited to 'src')
-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;
 }
-