mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
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:
parent
a687e3f6b4
commit
1ceca89296
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -522,4 +522,3 @@ message_init_module(void)
|
||||
message_send_inactive = _message_send_inactive;
|
||||
message_send_gone = _message_send_gone;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user