[imp] Alternative MIME parts - patch

Henry Bauer lists.horde.org at henrybauer.com
Fri Jun 27 08:34:57 PDT 2003


Hi, I've been using Horde, IMP, and Turba for a while and love them, exactly
what I need.  However, I've found a minor modification to be very useful to me,
and so I'm sharing it.  I'm currently using Horde 2.2.3 and IMP 3.2.1.

When I receive a message in both text/plain and text/html, 99% of the time I
just want to read the text portion.  However, sometimes I want to read the html
alternative part, but there's no way to do so.  This patch turns the alternative
part into an attachment, (producing the line "Part(s): [url icon] 2 unnamed
text/html 2.08KB [disk icon]") so I can click on it and see it.  Without this, IMP
just seems to ignore the text/html alternative part entirely.

I've attached my patch and a test message.

I'd like to know if anyone else finds this useful.  Thanks!

-Henry
-------------- next part --------------
--- message.php.orig    2003-06-25 10:42:42.000000000 -0400
+++ message.php 2003-06-25 10:45:01.000000000 -0400
@@ -176,7 +176,10 @@
     foreach ($attachments as $ref => $mime) {
         if (!isset($displayParts[$mime->alternative]) || selectAlternativePart($mime, $displayParts[$mime->alternative])) {
             $displayParts[!empty($mime->alternative) ? $mime->alternative : $ref] = $mime;
-        }
+        } else {
+               // Other alternative part; add to the attachments list.
+                $atc .= IMP::partSummary($mime, $index);
+       }
     }

     // now display the parts
-------------- next part --------------
Date: 24 Jun 2003 20:13:23 -0700
To: xxxxx
From: yyyyy
Subject: zzzzz
Content-Type: Multipart/Alternative;boundary=MuLtIpArT_BoUnDaRy
MIME-Version: 1.0


--MuLtIpArT_BoUnDaRy
Content-Type: text/plain;

regular text goes here

--MuLtIpArT_BoUnDaRy
Content-Type: text/html;


regular text with<br /><br />
HTML code<br /><br />
<b>also</b>

  
--MuLtIpArT_BoUnDaRy--



More information about the imp mailing list