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

ruz at bestpractical.com ruz at bestpractical.com
Mon Dec 24 18:47:52 EST 2007


Author: ruz
Date: Mon Dec 24 18:47:52 2007
New Revision: 10076

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

Log:
 r9828 at cubic-pc (orig r9827):  ruz | 2007-12-05 22:26:34 +0300
 * add UseKeyForSigning and use it


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	Mon Dec 24 18:47:52 2007
@@ -382,7 +382,8 @@
 
     my $entity = $args{'Entity'};
     if ( $args{'Sign'} && !defined $args{'Signer'} ) {
-        $args{'Signer'} = (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
+        $args{'Signer'} = UseKeyForSigning()
+            || (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
     }
     if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
         my %seen;
@@ -1593,6 +1594,17 @@
     return ();
 } }
 
+{ my $key;
+# no args -> get
+# one arg -> set
+# undef -> clear
+sub UseKeyForSigning {
+    if ( @_ ) {
+        $key = $_[0];
+    }
+    return $key;
+} }
+
 =head2 GetKeysForEncryption
 
 Takes identifier and returns keys suitable for encryption.


More information about the Rt-commit mailing list