[imp] IMP 3.2.2 and multipart - simple patch

Henry Bauer lists.horde.org at henrybauer.com
Sun Dec 28 10:40:58 PST 2003


I read the mailing list archives and it seems people have the same problem I do
- messages that are sent as both text and HTML get displayed as one or the
other, with no way to see the other representation.  I also understand this is
fixed(?) in CVS HEAD, but I haven't gotten around to checking that out.

However, I thought I'd share my simple (4 line) fix to this problem for people
who want to stick with 3.2.2.  It does not affect which multipart gets
displayed, but instead of ignoring the other multiparts, it shows them as
attachments.  Simple and effective.  It applied to 3.2 cleanly; I don't know
about older versions, but if it doesn't apply, you should be able to backport
it with little trouble.

I've been using it for several months, but only with one user (myself).  Caveat
emptor.

I've attached the patch and a sample message.

With standard 3.2.2 code, the sample message displays as a one-line email that
says "HTML Message - Happy Holidays!", with no way to view the HTML version. 
With my patch, the email looks the same, but you get a little link to the HTML
version.  Click on it, and you get the HTML email as intended.

Hope this is useful!

Henry
-------------- next part --------------
--- message.php.orig    2003-06-25 10:42:42.000000000 -0400
+++ message.php         2003-12-27 11:28:56.000000000 -0500
@@ -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 --------------
A non-text attachment was scrubbed...
Name: samplemessage.txt.gz
Type: application/gzip
Size: 2342 bytes
Desc: not available
Url : http://lists.horde.org/archives/imp/attachments/20031228/39cbd985/samplemessage.txt.bin


More information about the imp mailing list