Fix return from getBodyPart()
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 21:11:19 +0000 (15:11 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 21:11:19 +0000 (15:11 -0600)
imp/lib/Contents.php

index a623674..1e8fc49 100644 (file)
@@ -203,8 +203,10 @@ class IMP_Contents
      *            DEFAULT: No
      * </pre>
      *
-     * @return mixed  The text of the part, or a stream resource if 'stream'
-     *                is true.
+     * @return mixed  The text of the part, a stream resource if 'stream'
+     *                is true and 'mimeheaders' is false, or an array of
+     *                header text and a body stream resource if 'stream' is
+     *                true and 'mimeheaders' is true.
      */
     public function getBodyPart($id, $options = array())
     {
@@ -241,7 +243,9 @@ class IMP_Contents
                 }
                 return $res[$this->_index]['bodypart'][$id];
             } else {
-                return $res[$this->_index]['mimeheader'][$id] . $res[$this->_index]['bodypart'][$id];
+                return empty($options['stream'])
+                    ? $res[$this->_index]['mimeheader'][$id] . $res[$this->_index]['bodypart'][$id]
+                    : array($res[$this->_index]['mimeheader'][$id], $res[$this->_index]['bodypart'][$id]);
             }
         } catch (Horde_Imap_Client_Exception $e) {
             return '';