[Rt-commit] r9827 - rt/branches/3.7-RTIR-RELENG/lib/RT/Crypt

ruz at bestpractical.com ruz at bestpractical.com
Wed Dec 5 14:26:34 EST 2007


Author: ruz
Date: Wed Dec  5 14:26:34 2007
New Revision: 9827

Modified:
   rt/branches/3.7-RTIR-RELENG/lib/RT/Crypt/GnuPG.pm

Log:
* add UseKeyForSigning and use it

Modified: rt/branches/3.7-RTIR-RELENG/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/branches/3.7-RTIR-RELENG/lib/RT/Crypt/GnuPG.pm	Wed Dec  5 14:26:34 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