[Rt-commit] r7544 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Wed Apr 18 10:51:41 EDT 2007


Author: ruz
Date: Wed Apr 18 10:51:39 2007
New Revision: 7544

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm

Log:
 r4977 at cubic-pc:  cubic | 2007-04-18 18:47:31 +0400
 * DecryptAttachment


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 18 10:51:39 2007
@@ -341,7 +341,7 @@
         } elsif ( $item->{'Format'} eq 'Inline' ) {
             push @res, { DecryptInline( %$item ) };
         } elsif ( $item->{'Format'} eq 'Attachment' ) {
-#            push @res, { DecryptAttachment( %$item ) };
+            push @res, { DecryptAttachment( %$item ) };
 #            if ( $args{'Detach'} ) {
 #                $item->{'Top'}->parts( [ grep "$_" ne $item->{'Signature'}, $item->{'Top'}->parts ] );
 #                $item->{'Top'}->make_singlepart;
@@ -633,6 +633,24 @@
     return %res;
 }
 
+sub DecryptAttachment {
+    my %args = (
+        Top  => undef,
+        Data => undef,
+        Passphrase => undef,
+        @_
+    );
+    my %res = DecryptInline( %args );
+    return %res if $res{'exit_code'};
+
+    my $filename = $args{'Data'}->head->recommended_filename;
+    $filename =~ s/\.pgp$//i;
+    $args{'Data'}->head->mime_attr( $_ => $filename )
+        foreach (qw(Content-Type.name Content-Disposition.filename));
+
+    return %res;
+}
+
 sub GetPassphrase {
     return 'passphrase';
 }


More information about the Rt-commit mailing list