[Rt-commit] r7690 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Wed Apr 25 09:49:13 EDT 2007
Author: ruz
Date: Wed Apr 25 09:49:10 2007
New Revision: 7690
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
Log:
r5134 at cubic-pc: cubic | 2007-04-25 13:43:40 +0400
* SignEncrypt now supports Recipients and Signer arguments
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm Wed Apr 25 09:49:10 2007
@@ -118,12 +118,27 @@
=cut
sub SignEncrypt {
+ my %args = (@_);
+
+ my $entity = $args{'Entity'};
+ if ( $args{'Sign'} && !defined $args{'Signer'} ) {
+ $args{'Signer'} = (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
+ }
+ if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
+ my %seen;
+ $args{'Recipients'} = [
+ grep $_ && !$seen{ $_ }++, map $_->address,
+ map Mail::Address->parse( $entity->head->get( $_ ) ),
+ qw(To Cc Bcc)
+ ];
+ }
+
my $format = lc RT->Config->Get('GnuPG')->{'OutgoingMessagesFormat'} || 'RFC';
if ( $format eq 'inline' ) {
- return SignEncryptInline( @_ );
+ return SignEncryptInline( %args );
} else {
- return SignEncryptRFC3156( @_ );
+ return SignEncryptRFC3156( %args );
}
}
@@ -275,36 +290,21 @@
}
sub SignEncryptInline {
- my %args = (@_);
-
- my $entity = $args{'Entity'};
- if ( $args{'Sign'} && !defined $args{'Signer'} ) {
- $args{'Signer'} = (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
- }
- if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
- my %seen;
- $args{'Recipients'} = [
- grep $_ && !$seen{ $_ }++, map $_->address,
- map Mail::Address->parse( $entity->head->get( $_ ) ),
- qw(To Cc Bcc)
- ];
- }
my %res;
-
$entity->make_singlepart;
if ( $entity->is_multipart ) {
foreach ( $entity->parts ) {
- %res = SignEncryptInline( %args, Entity => $_ );
+ %res = SignEncryptInline( @_, Entity => $_ );
return %res if $res{'exit_code'};
}
return %res;
}
- return _SignEncryptTextInline( %args )
+ return _SignEncryptTextInline( @_ )
if $entity->effective_type =~ /^text\//i;
- return _SignEncryptAttachmentInline( %args );
+ return _SignEncryptAttachmentInline( @_ );
}
sub _SignEncryptTextInline {
More information about the Rt-commit
mailing list