better type logic

darcs-hash:20080718202052-84dde-cf788df7bcf76f971229d18041823a9483a164cc.gz
This commit is contained in:
Evan Prodromou 2008-07-18 16:20:52 -04:00
parent 91cac6495c
commit 1f8040ce2f

View File

@ -124,9 +124,9 @@ class MailerDaemon {
$from = $parsed->headers['from']; $from = $parsed->headers['from'];
$to = $parsed->headers['to']; $to = $parsed->headers['to'];
switch ($parsed->ctype_primary) { $type = $parsed->ctype_primary . '/' . $parsed->ctype_secondary;
case 'multitype':
# try and find a text/plain in the mix if ($parsed->ctype_primary == 'multitype') {
foreach ($parsed->parts as $part) { foreach ($parsed->parts as $part) {
if ($part->ctype_primary == 'text' && if ($part->ctype_primary == 'text' &&
$part->ctype_secondary == 'plain') { $part->ctype_secondary == 'plain') {
@ -134,16 +134,9 @@ class MailerDaemon {
break; break;
} }
} }
break; } else if ($type == 'text/plain') {
case 'text':
switch ($parsed->ctype_secondary) {
case 'plain':
$msg = $parsed->body; $msg = $parsed->body;
break; } else {
default:
$this->unsupported_type($parsed);
}
default:
$this->unsupported_type($parsed); $this->unsupported_type($parsed);
} }