[Rt-commit] rt branch, 4.0/mime-head-add-fix, created. rt-4.0.1rc1-5-gd54b01b

? sunnavy sunnavy at bestpractical.com
Fri May 27 01:49:06 EDT 2011


The branch, 4.0/mime-head-add-fix has been created
        at  d54b01b60699113c26ee8f587af98459a4814f74 (commit)

- Log -----------------------------------------------------------------
commit d54b01b60699113c26ee8f587af98459a4814f74
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 26 14:34:50 2011 +0800

    MIME::Head->add fix: we meant "replace" in some cases
    
    ->add always adds new occurences instead of overwriting existing ones.

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index bbdb475..f6b1685 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -329,8 +329,8 @@ sub EmailDashboard {
         Subject => $subject,
     );
 
-    $entity->head->add('X-RT-Dashboard-Id', $dashboard->Id);
-    $entity->head->add('X-RT-Dashboard-Subscription-Id', $subscription->Id);
+    $entity->head->replace('X-RT-Dashboard-Id', $dashboard->Id);
+    $entity->head->replace('X-RT-Dashboard-Subscription-Id', $subscription->Id);
 
     $RT::Logger->debug('Mailing dashboard "'.$dashboard->Name.'" to user '.$currentuser->Name." <$email>");
 
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 620ca60..233e5d1 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1787,7 +1787,7 @@ sub _HandleMachineGeneratedMail {
     # Squelch replies if necessary
     # Don't let the user stuff the RT-Squelch-Replies-To header.
     if ( $head->get('RT-Squelch-Replies-To') ) {
-        $head->add(
+        $head->replace(
             'RT-Relocated-Squelch-Replies-To',
             $head->get('RT-Squelch-Replies-To')
         );
@@ -1802,8 +1802,8 @@ sub _HandleMachineGeneratedMail {
         # to the scrip. We might want to notify nobody. Or just
         # the RT Owner. Or maybe all Privileged watchers.
         my ( $Sender, $junk ) = ParseSenderAddressFromHead($head);
-        $head->add( 'RT-Squelch-Replies-To',    $Sender );
-        $head->add( 'RT-DetectedAutoGenerated', 'true' );
+        $head->replace( 'RT-Squelch-Replies-To',    $Sender );
+        $head->replace( 'RT-DetectedAutoGenerated', 'true' );
     }
     return ( 1, $ErrorsTo, "Handled machine detection", $IsALoop );
 }
diff --git a/lib/RT/Interface/Email/Auth/GnuPG.pm b/lib/RT/Interface/Email/Auth/GnuPG.pm
index 25b8f10..eb2cddc 100644
--- a/lib/RT/Interface/Email/Auth/GnuPG.pm
+++ b/lib/RT/Interface/Email/Auth/GnuPG.pm
@@ -88,7 +88,7 @@ sub GetCurrentUser {
         Entity => $args{'Message'}, AddStatus => 1,
     );
     if ( $status && !@res ) {
-        $args{'Message'}->head->add(
+        $args{'Message'}->head->replace(
             'X-RT-Incoming-Encryption' => 'Not encrypted'
         );
 
@@ -112,7 +112,7 @@ sub GetCurrentUser {
         Data        => ${ $args{'RawMessageRef'} },
     );
 
-    $args{'Message'}->head->add( 'X-RT-Privacy' => 'PGP' );
+    $args{'Message'}->head->replace( 'X-RT-Privacy' => 'PGP' );
 
     foreach my $part ( $args{'Message'}->parts_DFS ) {
         my $decrypted;
@@ -124,14 +124,14 @@ sub GetCurrentUser {
                     $decrypted = 1;
                 }
                 if ( $_->{Operation} eq 'Verify' && $_->{Status} eq 'DONE' ) {
-                    $part->head->add(
+                    $part->head->replace(
                         'X-RT-Incoming-Signature' => $_->{UserString}
                     );
                 }
             }
         }
 
-        $part->head->add(
+        $part->head->replace(
             'X-RT-Incoming-Encryption' => 
                 $decrypted ? 'Success' : 'Not encrypted'
         );
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 597f728..e0944da 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1291,7 +1291,7 @@ sub CreateTicket {
     }
 
     foreach my $argument (qw(Encrypt Sign)) {
-        $MIMEObj->head->add(
+        $MIMEObj->head->replace(
             "X-RT-$argument" => Encode::encode_utf8( $ARGS{$argument} )
         ) if defined $ARGS{$argument};
     }
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 85228c2..a00e257 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -2212,12 +2212,12 @@ sub _RecordNote {
             my $addresses = join ', ', (
                 map { RT::User->CanonicalizeEmailAddress( $_->address ) }
                     Email::Address->parse( $args{ $type . 'MessageTo' } ) );
-            $args{'MIMEObj'}->head->add( 'RT-Send-' . $type, Encode::encode_utf8( $addresses ) );
+            $args{'MIMEObj'}->head->replace( 'RT-Send-' . $type, Encode::encode_utf8( $addresses ) );
         }
     }
 
     foreach my $argument (qw(Encrypt Sign)) {
-        $args{'MIMEObj'}->head->add(
+        $args{'MIMEObj'}->head->replace(
             "X-RT-$argument" => Encode::encode_utf8( $args{ $argument } )
         ) if defined $args{ $argument };
     }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list