From 1b28e5b941d480249d4dd637138a3781d6f9cd05 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 30 Oct 2013 14:58:13 +0800 Subject: Bug 892615: update requestnagging to suport securemail --- extensions/SecureMail/Extension.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'extensions/SecureMail') diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index 8fd09510d..a4a23a2cd 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -261,8 +261,14 @@ sub mailer_before_send { my $is_passwordmail = !$is_bugmail && ($body =~ /cfmpw.*cxlpw/s); my $is_test_email = $email->header('X-Bugzilla-Type') =~ /securemail-test/ ? 1 : 0; my $is_whine_email = $email->header('X-Bugzilla-Type') eq 'whine' ? 1 : 0; - - if ($is_bugmail || $is_passwordmail || $is_test_email || $is_whine_email) { + my $encrypt_header = $email->header('X-Bugzilla-Encrypt') ? 1 : 0; + + if ($is_bugmail + || $is_passwordmail + || $is_test_email + || $is_whine_email + || $encrypt_header + ) { # Convert the email's To address into a User object my $login = $email->header('To'); my $emailsuffix = Bugzilla->params->{'emailsuffix'}; @@ -329,6 +335,11 @@ sub mailer_before_send { # comes from the whine settings. $make_secure = _should_secure_whine($email) ? SECURE_BODY : SECURE_NONE; } + elsif ($encrypt_header) { + # Templates or code may set the X-Bugzilla-Encrypt header to + # trigger encryption of emails. Remove that header from the email. + $email->header_set('X-Bugzilla-Encrypt'); + } # If finding the user fails for some reason, but we determine we # should be encrypting, we want to make the mail safe. An empty key -- cgit v1.2.3-24-g4f1b