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
This commit is contained in:
lightb
2014-04-19 05:08:33 -04:00
parent a687e3f6b4
commit 1ceca89296
3 changed files with 8 additions and 1 deletions

View File

@@ -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) {