[Rt-commit] [svn] r1927 - in rt/branches/3.2-RELEASE: . lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon Nov 22 14:21:36 EST 2004


Author: jesse
Date: Mon Nov 22 14:21:36 2004
New Revision: 1927

Modified:
   rt/branches/3.2-RELEASE/   (props changed)
   rt/branches/3.2-RELEASE/lib/RT/Attachment_Overlay.pm
Log:
 r9328 at tinbook:  jesse | 2004-11-22T19:23:06.663299Z
 RT-Ticket: 6187
 RT-Status: resolved
 RT-Update: correspond
 
 Refactored RT's core attachment processing logic to be a bit less baroque and to use new convenience methods. ths should prevent some mail header display strangeness folks were seeing.
 
 


Modified: rt/branches/3.2-RELEASE/lib/RT/Attachment_Overlay.pm
==============================================================================
--- rt/branches/3.2-RELEASE/lib/RT/Attachment_Overlay.pm	(original)
+++ rt/branches/3.2-RELEASE/lib/RT/Attachment_Overlay.pm	Mon Nov 22 14:21:36 2004
@@ -398,19 +398,16 @@
 
 =head2 NiceHeaders
 
-Returns the To, From, Cc, Date and Subject headers.
-
-It is a known issue that this breaks if any of these headers are not
-properly unfolded.
+Returns a multi-line string of the To, From, Cc, Date and Subject headers.
 
 =cut
 
 sub NiceHeaders {
     my $self = shift;
     my $hdrs = "";
-    my @hdrs = split(/\n/,$self->Headers);
+    my @hdrs = $self->_SplitHeaders;
     while (my $str = shift @hdrs) {
-	    next unless $str =~ /^(To|From|RT-Send-Cc|Cc|Bcc:Date|Subject): /i;
+	    next unless $str =~ /^(To|From|RT-Send-Cc|Cc|Bcc|Date|Subject):/i;
 	    $hdrs .= $str . "\n";
 	    $hdrs .= shift( @hdrs ) . "\n" while ($hdrs[0] =~ /^[ \t]+/);
     }
@@ -433,10 +430,9 @@
 sub Headers {
     my $self = shift;
     my $hdrs="";
-    for ($self->_SplitHeaders) {
-	    $hdrs.="$_\n" unless /^(RT-Send-Bcc):/i
-    }
-    return $hdrs;
+    my @headers =  grep { !/^RT-Send-Bcc/i } $self->_SplitHeaders;
+    return join("\n", at headers);
+
 }
 
 
@@ -535,7 +531,7 @@
 =head2 _SplitHeaders
 
 Returns an array of this attachment object's headers, with one header 
-per array entry. multiple lines are folded
+per array entry. multiple lines are folded.
 
 =begin testing
 


More information about the Rt-commit mailing list