rev 1865 - trunk/buscador/lib/Buscador

[prev] [thread] [next] [lurker] [Date index for 2005/02/10]

From: simon
Subject: rev 1865 - trunk/buscador/lib/Buscador
Date: 14:17 on 10 Feb 2005
Author: simon
Date: 2005-02-10 14:17:34 +0000 (Thu, 10 Feb 2005)
New Revision: 1865

Modified:
   trunk/buscador/lib/Buscador/Decorate.pm
Log:
Work with inline html content


Modified: trunk/buscador/lib/Buscador/Decorate.pm
===================================================================
--- trunk/buscador/lib/Buscador/Decorate.pm	2005-02-10 14:15:47 UTC (rev 1864)
+++ trunk/buscador/lib/Buscador/Decorate.pm	2005-02-10 14:17:34 UTC (rev 1865)
@@ -40,13 +40,14 @@
     my $mail = shift;
 
 
+    # NOTE! this needs a lot of work 
+    my $ct = $mail->simple->header('Content-Type') || "";
+    return $mail->simple->body if ($ct =~ m!text/html!i);
     my $html = ($mail->html)[0];
+    return $html->scrubbed if $html;
 
-    return $html->scrubbed if defined $html;
 
-
-    my $body = $mail->body || "";
-
+    my $body = $mail->body;
     my $decorator = Text::Decorator->new($body);
 
     my %seen;
@@ -58,16 +59,18 @@
 
     my @addresses = Email::Store::Entity::Address->retrieve_all;
 
+    unless (defined $html) {
     $decorator->add_filter("Quoted", begin => '<div class="level%i">',
-                                     end   => '</div>');
+                                     end   => '</div>') ;
 
 
-    $decorator->add_filter("URIFind")                             unless $html;
-    $decorator->add_filter("TTBridge" => "html" => "html_entity") unless $html;
-    
+    $decorator->add_filter("URIFind");
+    $decorator->add_filter("TTBridge" => "html" => "html_entity");
+    }
+
     $decorator->add_filter("NamedEntity" => @names) if @names;
     $decorator->add_filter("Addresses" => @addresses) if @addresses;
-    
+
     $decorator->format_as("html");
     
 }

Generated at 15:00 on 10 Feb 2005 by mariachi 0.52