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

ruz at bestpractical.com ruz at bestpractical.com
Wed Apr 25 23:09:14 EDT 2007


Author: ruz
Date: Wed Apr 25 23:09:12 2007
New Revision: 7704

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

Log:
 r5152 at cubic-pc:  cubic | 2007-04-26 06:40:59 +0400
 * store original message if we sign or encrypt


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	Wed Apr 25 23:09:12 2007
@@ -102,9 +102,37 @@
 sub Commit {
     my $self = shift;
 
-    my ($ret) = $self->SendMessage( $self->TemplateObj->MIMEObj );
+    my $message = $self->TemplateObj->MIMEObj;
+
+    my $orig_message;
+    if ( RT->Config->Get('RecordOutgoingEmail') ) {
+        # it's hacky, but we should know if we're going to crypt things
+        my $attachment = $self->TransactionObj->Attachments->First;
+
+        my %crypt;
+        foreach my $argument ( qw(Sign Encrypt) ) {
+            if ( $attachment && defined $attachment->GetHeader("X-RT-$argument") ) {
+                $crypt{$argument} = $attachment->GetHeader("X-RT-$argument");
+            } else {
+                $crypt{$argument} = $self->TicketObj->QueueObj->$argument();
+            }
+        }
+        if ( $crypt{'Sign'} || $crypt{'Encrypt'} ) {
+            $orig_message = $message->dup;
+        }
+    }
+
+
+    my ($ret) = $self->SendMessage( $message );
     if ( $ret > 0 && RT->Config->Get('RecordOutgoingEmail') ) {
-        $self->RecordOutgoingMailTransaction( $self->TemplateObj->MIMEObj )
+        if ( $orig_message ) {
+            $message->attach(
+                Type        => 'application/x-rt-original-message',
+                Disposition => 'inline',
+                Data        => $orig_message->as_string,
+            );
+        }
+        $self->RecordOutgoingMailTransaction( $message );
     }
     return (abs $ret);
 }


More information about the Rt-commit mailing list