[Rt-commit] r8828 - rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface

ruz at bestpractical.com ruz at bestpractical.com
Wed Aug 29 17:55:48 EDT 2007


Author: ruz
Date: Wed Aug 29 17:55:47 2007
New Revision: 8828

Modified:
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm

Log:
* add InReplyTo argument to SendEmailUsingTemplate function

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	Wed Aug 29 17:55:47 2007
@@ -506,6 +506,7 @@
         To => undef,
         Cc => undef,
         Bcc => undef,
+        InReplyTo => undef,
         @_
     );
 
@@ -515,6 +516,24 @@
     $msg->head->set( $_ => $args{ $_ } )
         foreach grep defined $args{$_}, qw(To Cc Bcc);
 
+    if ( $args{'InReplyTo'} ) {
+        my @id = $args{'InReplyTo'}->head->get('Message-ID');
+        my @in_reply_to = $args{'InReplyTo'}->head->get('In-Reply-To');
+        my @references = $args{'InReplyTo'}->head->get('References');
+
+        $msg->head->set( 'In-Reply-To' => join ' ', @id ) if @id;
+        my @new_references;
+        if ( @references ) {
+            @new_references = (@references, @id);
+        } else {
+            @new_references = (@in_reply_to, @id);
+        }
+        @new_references = splice @new_references, 4, -6
+            if @new_references > 10;
+
+        $msg->head->set( 'References' => join ' ', @new_references );
+    }
+
     return SendEmail( Entity => $msg );
 }
 


More information about the Rt-commit mailing list