[Rt-commit] [svn] r1933 - in rt/branches/3.3-TESTING: . lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon Nov 22 14:44:45 EST 2004


Author: jesse
Date: Mon Nov 22 14:44:43 2004
New Revision: 1933

Modified:
   rt/branches/3.3-TESTING/   (props changed)
   rt/branches/3.3-TESTING/lib/RT/Attachment_Overlay.pm
Log:
 r9335 at tinbook:  jesse | 2004-11-22T19:44:48.685300Z
  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.3-TESTING/lib/RT/Attachment_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Attachment_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Attachment_Overlay.pm	Mon Nov 22 14:44:43 2004
@@ -383,19 +383,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]+/);
     }
@@ -418,10 +415,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);
+
 }
 
 
@@ -520,7 +516,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