[Rt-commit] r13708 - in rt/3.8/trunk: . lib/RT lib/RT/Crypt lib/RT/Interface sbin share/html/Elements

elacour at bestpractical.com elacour at bestpractical.com
Tue Jul 1 10:12:10 EDT 2008


Author: elacour
Date: Tue Jul  1 10:12:05 2008
New Revision: 13708

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/Action/Notify.pm
   rt/3.8/trunk/lib/RT/Action/SendEmail.pm
   rt/3.8/trunk/lib/RT/Attachment_Overlay.pm
   rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm
   rt/3.8/trunk/lib/RT/EmailParser.pm
   rt/3.8/trunk/lib/RT/Interface/Email.pm
   rt/3.8/trunk/lib/RT/Interface/Web.pm
   rt/3.8/trunk/lib/RT/Ticket_Overlay.pm
   rt/3.8/trunk/lib/RT/User_Overlay.pm
   rt/3.8/trunk/sbin/rt-test-dependencies.in
   rt/3.8/trunk/share/html/Elements/ShowUser
   rt/3.8/trunk/share/html/Elements/ShowUserVerbose

Log:
 r9822 at datura:  manu | 2008-07-01 16:10:59 +0200
 RT-Ticket: 9660
 RT-Update: correspond
 RT-Status: resolved
 
 * Switch from Mail::Address to Email::Address so AddressesFromHeader don't return
   a broken PseudoTo value, but just skip it.
 * Don't treat the To if it contains the PseudoTo in DeferDigestRecipients so we
   don't remove it.
 


Modified: rt/3.8/trunk/lib/RT/Action/Notify.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Action/Notify.pm	(original)
+++ rt/3.8/trunk/lib/RT/Action/Notify.pm	Tue Jul  1 10:12:05 2008
@@ -54,7 +54,7 @@
 
 use base qw(RT::Action::SendEmail);
 
-use Mail::Address;
+use Email::Address;
 
 =head2 Prepare
 
@@ -89,10 +89,10 @@
 
     if ( $arg =~ /\bOtherRecipients\b/ ) {
         if ( my $attachment = $self->TransactionObj->Attachments->First ) {
-            push @Cc, map { $_->address } Mail::Address->parse(
+            push @Cc, map { $_->address } Email::Address->parse(
                 $attachment->GetHeader('RT-Send-Cc')
             );
-            push @Bcc, map { $_->address } Mail::Address->parse(
+            push @Bcc, map { $_->address } Email::Address->parse(
                 $attachment->GetHeader('RT-Send-Bcc')
             );
         }

Modified: rt/3.8/trunk/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Action/SendEmail.pm	(original)
+++ rt/3.8/trunk/lib/RT/Action/SendEmail.pm	Tue Jul  1 10:12:05 2008
@@ -59,7 +59,7 @@
 
 use RT::EmailParser;
 use RT::Interface::Email;
-use Mail::Address;
+use Email::Address;
 our @EMAIL_RECIPIENT_HEADERS = qw(To Cc Bcc);
 
 
@@ -240,7 +240,7 @@
 
 =head2 To
 
-Returns an array of L<Mail::Address> objects containing all the To: recipients for this notification
+Returns an array of L<Email::Address> objects containing all the To: recipients for this notification
 
 =cut
 
@@ -251,7 +251,7 @@
 
 =head2 Cc
 
-Returns an array of L<Mail::Address> objects containing all the Cc: recipients for this notification
+Returns an array of L<Email::Address> objects containing all the Cc: recipients for this notification
 
 =cut
 
@@ -262,7 +262,7 @@
 
 =head2 Bcc
 
-Returns an array of L<Mail::Address> objects containing all the Bcc: recipients for this notification
+Returns an array of L<Email::Address> objects containing all the Bcc: recipients for this notification
 
 =cut
 
@@ -276,7 +276,7 @@
     my $self      = shift;
     my $field     = shift;
     my $header    = $self->TemplateObj->MIMEObj->head->get($field);
-    my @addresses = Mail::Address->parse($header);
+    my @addresses = Email::Address->parse($header);
 
     return (@addresses);
 }
@@ -635,6 +635,8 @@
     my $digest_hash = {};
 
     foreach my $mailfield (@EMAIL_RECIPIENT_HEADERS) {
+        # If we have a "PseudoTo", the "To" contains it, so we don't need to access it
+        next if ( ( $self->{'PseudoTo'} && @{ $self->{'PseudoTo'} } ) && ( $mailfield eq 'To' ) );
         $RT::Logger->debug( "Working on mailfield $mailfield; recipients are " . join( ',', @{ $self->{$mailfield} } ) );
 
         # Store the 'daily digest' folk in an array.

Modified: rt/3.8/trunk/lib/RT/Attachment_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Attachment_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/Attachment_Overlay.pm	Tue Jul  1 10:12:05 2008
@@ -430,7 +430,7 @@
 Returns a hashref of all addresses related to this attachment.
 The keys of the hash are C<From>, C<To>, C<Cc>, C<Bcc>, C<RT-Send-Cc>
 and C<RT-Send-Bcc>. The values are references to lists of
-L<Mail::Address> objects.
+L<Email::Address> objects.
 
 =cut
 
@@ -445,7 +445,7 @@
         my @Addresses;
         my $line      = $self->GetHeader($hdr);
         
-        foreach my $AddrObj ( Mail::Address->parse( $line )) {
+        foreach my $AddrObj ( Email::Address->parse( $line )) {
             my $address = $AddrObj->address;
             $address = lc RT::User->CanonicalizeEmailAddress($address);
             next if ( $current_user_address eq $address );

Modified: rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm	Tue Jul  1 10:12:05 2008
@@ -274,7 +274,7 @@
 
 =item $Recipient - recipient's identification
 
-=item $AddressObj - L<Mail::Address> object containing recipient's email address
+=item $AddressObj - L<Email::Address> object containing recipient's email address
 
 =back
 
@@ -400,13 +400,13 @@
     my $entity = $args{'Entity'};
     if ( $args{'Sign'} && !defined $args{'Signer'} ) {
         $args{'Signer'} = UseKeyForSigning()
-            || (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
+            || (Email::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
     }
     if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
         my %seen;
         $args{'Recipients'} = [
             grep $_ && !$seen{ $_ }++, map $_->address,
-            map Mail::Address->parse( $entity->head->get( $_ ) ),
+            map Email::Address->parse( $entity->head->get( $_ ) ),
             qw(To Cc Bcc)
         ];
     }
@@ -514,7 +514,7 @@
         $gnupg->options->push_recipients( $_ ) foreach 
             map UseKeyForEncryption($_) || $_,
             grep !$seen{ $_ }++, map $_->address,
-            map Mail::Address->parse( $entity->head->get( $_ ) ),
+            map Email::Address->parse( $entity->head->get( $_ ) ),
             qw(To Cc Bcc);
 
         my ($tmp_fh, $tmp_fn) = File::Temp::tempfile();
@@ -1796,7 +1796,7 @@
     return (
         MainKey      => $main_key_id,
         String       => $user_str,
-        EmailAddress => (map $_->address, Mail::Address->parse( $user_str ))[0],
+        EmailAddress => (map $_->address, Email::Address->parse( $user_str ))[0],
     );
 }
 

Modified: rt/3.8/trunk/lib/RT/EmailParser.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/EmailParser.pm	(original)
+++ rt/3.8/trunk/lib/RT/EmailParser.pm	Tue Jul  1 10:12:05 2008
@@ -54,7 +54,7 @@
 use strict;
 use warnings;
 
-use Mail::Address;
+use Email::Address;
 use MIME::Entity;
 use MIME::Head;
 use MIME::Parser;
@@ -300,8 +300,8 @@
 
     my (@Addresses);
 
-    my @ToObjs = Mail::Address->parse( $self->Head->get('To') );
-    my @CcObjs = Mail::Address->parse( $self->Head->get('Cc') );
+    my @ToObjs = Email::Address->parse( $self->Head->get('To') );
+    my @CcObjs = Email::Address->parse( $self->Head->get('Cc') );
 
     foreach my $AddrObj ( @ToObjs, @CcObjs ) {
         my $Address = $AddrObj->address;

Modified: rt/3.8/trunk/lib/RT/Interface/Email.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Interface/Email.pm	(original)
+++ rt/3.8/trunk/lib/RT/Interface/Email.pm	Tue Jul  1 10:12:05 2008
@@ -51,7 +51,7 @@
 use strict;
 use warnings;
 
-use Mail::Address;
+use Email::Address;
 use MIME::Entity;
 use RT::EmailParser;
 use File::Temp;
@@ -430,7 +430,7 @@
 
         # duplicate head as we want drop Bcc field
         my $head = $args{'Entity'}->head->dup;
-        my @recipients = map $_->address, Mail::Address->parse(
+        my @recipients = map $_->address, Email::Address->parse(
             map $head->get($_), qw(To Cc Bcc)
         );
         $head->delete('Bcc');
@@ -704,7 +704,7 @@
     }
     return 0 unless @bad_recipients;
 
-    $_->{'AddressObj'} = (Mail::Address->parse( $_->{'Recipient'} ))[0]
+    $_->{'AddressObj'} = (Email::Address->parse( $_->{'Recipient'} ))[0]
         foreach @bad_recipients;
 
     foreach my $recipient ( @bad_recipients ) {
@@ -834,7 +834,7 @@
 
     my @recipients =
         map lc $_->address,
-        map Mail::Address->parse( $args{'Head'}->get( $_ ) ),
+        map Email::Address->parse( $args{'Head'}->get( $_ ) ),
         qw(To Cc);
 
     my @res;
@@ -912,7 +912,7 @@
 
     # Some broken mailers send:  ""Vincent, Jesse"" <jesse at fsck.com>. Hate
     $Addr =~ s/\"\"(.*?)\"\"/\"$1\"/g;
-    my @Addresses = Mail::Address->parse($Addr);
+    my @Addresses = Email::Address->parse($Addr);
 
     my ($AddrObj) = grep ref $_, @Addresses;
     unless ( $AddrObj ) {
@@ -941,7 +941,7 @@
     foreach my $field ( qw(To Cc Bcc) ) {
         $head->set( $field =>
             join ', ', map $_->format, grep !$skip{ lc $_->address },
-                Mail::Address->parse( $head->get( $field ) )
+                Email::Address->parse( $head->get( $field ) )
         );
     }
 }

Modified: rt/3.8/trunk/lib/RT/Interface/Web.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Interface/Web.pm	(original)
+++ rt/3.8/trunk/lib/RT/Interface/Web.pm	Tue Jul  1 10:12:05 2008
@@ -447,7 +447,7 @@
 
     my @temp_squelch;
     foreach my $type (qw(Requestor Cc AdminCc)) {
-        push @temp_squelch, map $_->address, Mail::Address->parse( $create_args{ $type } )
+        push @temp_squelch, map $_->address, Email::Address->parse( $create_args{ $type } )
             if grep $_ eq $type || $_ eq ($type.'s'), @{ $ARGS{'SkipNotification'} || [] };
 
     }

Modified: rt/3.8/trunk/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/Ticket_Overlay.pm	Tue Jul  1 10:12:05 2008
@@ -430,7 +430,7 @@
             if ( $watcher =~ /^\d+$/ ) {
                 push @{ $args{$type} }, $watcher;
             } else {
-                my @addresses = Mail::Address->parse( $watcher );
+                my @addresses = Email::Address->parse( $watcher );
                 foreach my $address( @addresses ) {
                     my $user = RT::User->new( $RT::SystemUser );
                     my ($uid, $msg) = $user->LoadOrCreateByEmail( $address );
@@ -1037,7 +1037,7 @@
     return $self->_AddWatcher( %args )
         if $self->CurrentUserHasRight('ModifyTicket');
     if ( $args{'Email'} ) {
-        my ($addr) = Mail::Address->parse( $args{'Email'} );
+        my ($addr) = Email::Address->parse( $args{'Email'} );
         return (0, $self->loc("Couldn't parse address from '[_1]' string", $args{'Email'} ))
             unless $addr;
 
@@ -1601,7 +1601,7 @@
 =head2 TransactionAddresses
 
 Returns a composite hashref of the results of L<RT::Transaction/Addresses> for all this ticket's Create, Comment or Correspond transactions.
-The keys are C<To>, C<Cc> and C<Bcc>. The values are lists of C<Mail::Address> objects.
+The keys are C<To>, C<Cc> and C<Bcc>. The values are lists of C<Email::Address> objects.
 
 NOTE: For performance reasons, this method might want to skip transactions and go straight for attachments. But to make that work right, we're going to need to go and walk around the access control in Attachment.pm's sub _Value.
 
@@ -2119,7 +2119,7 @@
 
             my $addresses = join ', ', (
                 map { RT::User->CanonicalizeEmailAddress( $_->address ) }
-                    Mail::Address->parse( $args{ $type . 'MessageTo' } ) );
+                    Email::Address->parse( $args{ $type . 'MessageTo' } ) );
             $args{'MIMEObj'}->head->add( 'RT-Send-' . $type, $addresses );
         }
     }

Modified: rt/3.8/trunk/lib/RT/User_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/User_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/User_Overlay.pm	Tue Jul  1 10:12:05 2008
@@ -464,7 +464,7 @@
 =head2 LoadOrCreateByEmail ADDRESS
 
 Attempts to find a user who has the provided email address. If that fails, creates an unprivileged user with
-the provided email address and loads them. Address can be provided either as L<Mail::Address> object
+the provided email address and loads them. Address can be provided either as L<Email::Address> object
 or string which is parsed using the module.
 
 Returns a tuple of the user's id and a status message.
@@ -477,7 +477,7 @@
     my $email = shift;
 
     my ($message, $name);
-    if ( UNIVERSAL::isa( $email => 'Mail::Address' ) ) {
+    if ( UNIVERSAL::isa( $email => 'Email::Address' ) ) {
         ($email, $name) = ($email->address, $email->phrase);
     } else {
         ($email, $name) = RT::Interface::Email::ParseAddressFromHeader( $email );

Modified: rt/3.8/trunk/sbin/rt-test-dependencies.in
==============================================================================
--- rt/3.8/trunk/sbin/rt-test-dependencies.in	(original)
+++ rt/3.8/trunk/sbin/rt-test-dependencies.in	Tue Jul  1 10:12:05 2008
@@ -221,6 +221,7 @@
 Locale::Maketext::Fuzzy
 MIME::Entity 5.425
 Mail::Mailer 1.57
+Email::Address
 Text::Wrapper 
 Time::ParseDate
 Time::HiRes 

Modified: rt/3.8/trunk/share/html/Elements/ShowUser
==============================================================================
--- rt/3.8/trunk/share/html/Elements/ShowUser	(original)
+++ rt/3.8/trunk/share/html/Elements/ShowUser	Tue Jul  1 10:12:05 2008
@@ -48,7 +48,7 @@
 %# Released under the terms of version 2 of the GNU Public License
 <%INIT>
 # $User is an RT::User object
-# $Address is Mail::Address object
+# $Address is Email::Address object
 if ( !$User && $Address ) {
     $User = RT::User->new( $session{'CurrentUser'} );
     $User->LoadByEmail( $Address->address );

Modified: rt/3.8/trunk/share/html/Elements/ShowUserVerbose
==============================================================================
--- rt/3.8/trunk/share/html/Elements/ShowUserVerbose	(original)
+++ rt/3.8/trunk/share/html/Elements/ShowUserVerbose	Tue Jul  1 10:12:05 2008
@@ -55,7 +55,7 @@
 $phrase = $User->RealName
     if $User->RealName && lc $User->RealName ne lc $address;
 $comment = $User->Name if lc $User->Name ne lc $address;
- $Address = Mail::Address->new( $phrase, $address, $comment );
+ $Address = Email::Address->new( $phrase, $address, $comment );
 } 
 
 


More information about the Rt-commit mailing list