/**
* If this MIME part can contain embedded MIME part(s), and those part(s)
* exist, return a representation of that data.
*
* @return mixed A Horde_Mime_Part object representing the embedded data.
* Returns null if no embedded MIME part(s) exist.
*/
protected function _getEmbeddedMimeParts()
{
/* Get the data from the attachment. */
try {
if (!($tnef = $this->getConfigParam('tnef'))) {
$tnef = Horde_Compress::factory('Tnef');
$this->setConfigParam('tnef', $tnef);
}
$tnefData = $tnef->decompress($this->_mimepart->getContents());
} catch (Horde_Compress_Exception $e) {
$tnefData = array();
}
if (!count($tnefData)) {
return null;
}
$mixed = new Horde_Mime_Part();
$mixed->setType('multipart/mixed');
reset($tnefData);
while (list(, $data) = each($tnefData)) {
$temp_part = new Horde_Mime_Part();
$temp_part->setName($data['name']);
$temp_part->setDescription($data['name']);
$temp_part->setContents($data['stream']);
/* Short-circuit MIME-type guessing for winmail.dat parts;
* we're showing enough entries for them already. */
$type = $data['type'] . '/' . $data['subtype'];
if (in_array($type, array('application/octet-stream', 'application/base64'))) {
$type = Horde_Mime_Magic::filenameToMIME($data['name']);
}
$temp_part->setType($type);
$mixed->addPart($temp_part);
}
return $mixed;
}