[Rt-commit] r11980 - in rt/branches/3.8-TESTING: . lib/RT/Interface

jesse at bestpractical.com jesse at bestpractical.com
Wed Apr 30 16:08:22 EDT 2008


Author: jesse
Date: Wed Apr 30 16:08:22 2008
New Revision: 11980

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/lib/RT/EmailParser.pm
   rt/branches/3.8-TESTING/lib/RT/Interface/Email.pm

Log:
 r30277 at 31b:  jesse | 2008-04-30 14:15:17 -0400
 * Finally killed code duplicated between RT::EmailParser and RT::InterfaceEmail
 


Modified: rt/branches/3.8-TESTING/lib/RT/EmailParser.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/EmailParser.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/EmailParser.pm	Wed Apr 30 16:08:22 2008
@@ -319,81 +319,6 @@
 
 
 
-=head2 ParseSenderAddressFromHead
-
-Takes a MIME::Header object. Returns a tuple: (user at host, friendly name) 
-of the From (evaluated in order of Reply-To:, From:, Sender)
-
-=cut
-
-sub ParseSenderAddressFromHead {
-    my $self = shift;
-
-    #Figure out who's sending this message.
-    my $From = $self->Head->get('Reply-To')
-      || $self->Head->get('From')
-      || $self->Head->get('Sender');
-    return ( $self->ParseAddressFromHeader($From) );
-}
-
-
-
-=head2 ParseErrorsToAddressFromHead
-
-Takes a MIME::Header object. Return a single value : user at host
-of the From (evaluated in order of Errors-To:,Reply-To:, From:, Sender)
-
-=cut
-
-sub ParseErrorsToAddressFromHead {
-    my $self = shift;
-
-    #Figure out who's sending this message.
-
-    foreach my $header ( 'Errors-To', 'Reply-To', 'From', 'Sender' ) {
-
-        # If there's a header of that name
-        my $headerobj = $self->Head->get($header);
-        if ($headerobj) {
-            my ( $addr, $name ) = $self->ParseAddressFromHeader($headerobj);
-
-            # If it's got actual useful content...
-            return ($addr) if ($addr);
-        }
-    }
-}
-
-
-
-=head2 ParseAddressFromHeader ADDRESS
-
-Takes an address from $self->Head->get('Line') and returns a tuple: user at host, friendly name
-
-=cut
-
-sub ParseAddressFromHeader {
-    my $self = shift;
-    my $Addr = shift;
-
-    # Perl 5.8.0 breaks when doing regex matches on utf8
-    Encode::_utf8_off($Addr) if $] == 5.008;
-    my @Addresses = Mail::Address->parse($Addr);
-
-    my $AddrObj = $Addresses[0];
-
-    unless ( ref($AddrObj) ) {
-        return ( undef, undef );
-    }
-
-    my $Name = ( $AddrObj->phrase || $AddrObj->comment || $AddrObj->address );
-
-    #Lets take the from and load a user object.
-    my $Address = $AddrObj->address;
-
-    return ( $Address, $Name );
-}
-
-
 
 =head2 IsRTaddress ADDRESS
 

Modified: rt/branches/3.8-TESTING/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Interface/Email.pm	Wed Apr 30 16:08:22 2008
@@ -192,38 +192,6 @@
     return ( $ReturnPath =~ /<>/ );
 }
 
-=head2 IsRTAddress ADDRESS
-
-Takes a single parameter, an email address.
-Returns true if that address matches the C<RTAddressRegexp> config option.
-Returns false, otherwise.
-
-=cut
-
-sub IsRTAddress {
-    my $address = shift || '';
-
-    # Example: the following rule would tell RT not to Cc
-    #   "tickets at noc.example.com"
-    my $re_address = RT->Config->Get('RTAddressRegexp');
-    if ( $re_address && $address =~ /$re_address/i ) {
-        return 1;
-    }
-    return undef;
-}
-
-
-
-=head2 CullRTAddresses ARRAY
-
-Takes a single argument, an array of email addresses.
-Returns the same array with any IsRTAddress()es weeded out.
-
-=cut
-
-sub CullRTAddresses {
-    return grep !IsRTAddress($_), @_;
-}
 
 =head2 MailError PARAM HASH
 
@@ -869,7 +837,7 @@
         next if lc $args{'CurrentUser'}->EmailAddress   eq $address;
         next if lc $args{'QueueObj'}->CorrespondAddress eq $address;
         next if lc $args{'QueueObj'}->CommentAddress    eq $address;
-        next if IsRTAddress( $address );
+        next if RT::EmailParser->IsRTAddress( $address );
 
         push @res, $address;
     }


More information about the Rt-commit mailing list