/**
* Determines if a MIME type is an attachment.
* For our purposes, an attachment is any MIME part that can be
* downloaded by itself (i.e. all the data needed to view the part is
* contained within the download data).
*
* @param string $id The MIME Id for the part we are checking.
* @param string $mime_type The MIME type.
*
* @return boolean True if an attachment.
* @todo Pass a single mime part as parameter.
*/
public function isAttachment($id, $mime_type)
{
switch ($mime_type) {
case 'text/plain':
if (!($this->_base->findBody('plain') == $id)) {
return true;
}
return false;
case 'text/html':
if (!($this->_base->findBody('html') == $id)) {
return true;
}
return false;
case 'application/pkcs7-signature':
case 'application/x-pkcs7-signature':
return false;
}
if ($this->_base->getPart($id)->getDisposition() == 'attachment') {
return true;
}
list($ptype, ) = explode('/', $mime_type, 2);
switch ($ptype) {
case 'message':
return in_array($mime_type, array('message/rfc822', 'message/disposition-notification'));
case 'multipart':
return false;
default:
return true;
}
}