Workaround broken RFC 3462 messages.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 02:11:32 +0000 (19:11 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 02:11:32 +0000 (19:11 -0700)
framework/Mime/lib/Horde/Mime/Viewer/Report.php

index 3ec86ce..9703bb4 100644 (file)
@@ -21,13 +21,21 @@ class Horde_Mime_Viewer_Report extends Horde_Mime_Viewer_Driver
     protected function _getViewer()
     {
         if (!($type = $this->_mimepart->getContentTypeParameter('report-type'))) {
-            return false;
+            /* This is a broken RFC 3462 message, since 'report-type' is
+             * mandatory. Try to determine the report-type by looking at the
+             * sub-type of the second body part. */
+            $parts = $this->_mimepart->getParts();
+            if (!isset($parts[1])) {
+                return false;
+            }
+            $type = $parts[1]->getSubType();
         }
 
         $viewer = Horde_Mime_Viewer::factory($this->_mimepart, 'message/' . Horde_String::lower($type));
         if ($viewer) {
             $viewer->setParams($this->_params);
         }
+
         return $viewer;
     }
 }