summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-18 16:20:52 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-18 16:20:52 -0400
commit1f8040ce2fbd08f0bd2ab439b5a1895cce3ebc93 (patch)
treec8774adfc687bfa18153174b863a5fb0aa834c0c
parent91cac6495c8ed08ddf98e82d7b9d5342e86e2d76 (diff)
better type logic
darcs-hash:20080718202052-84dde-cf788df7bcf76f971229d18041823a9483a164cc.gz
-rwxr-xr-xmaildaemon.php19
1 files changed, 6 insertions, 13 deletions
diff --git a/maildaemon.php b/maildaemon.php
index dcd4b2d30..185f6609c 100755
--- a/maildaemon.php
+++ b/maildaemon.php
@@ -123,10 +123,10 @@ class MailerDaemon {
}
$from = $parsed->headers['from'];
$to = $parsed->headers['to'];
+
+ $type = $parsed->ctype_primary . '/' . $parsed->ctype_secondary;
- switch ($parsed->ctype_primary) {
- case 'multitype':
- # try and find a text/plain in the mix
+ if ($parsed->ctype_primary == 'multitype') {
foreach ($parsed->parts as $part) {
if ($part->ctype_primary == 'text' &&
$part->ctype_secondary == 'plain') {
@@ -134,16 +134,9 @@ class MailerDaemon {
break;
}
}
- break;
- case 'text':
- switch ($parsed->ctype_secondary) {
- case 'plain':
- $msg = $parsed->body;
- break;
- default:
- $this->unsupported_type($parsed);
- }
- default:
+ } else if ($type == 'text/plain') {
+ $msg = $parsed->body;
+ } else {
$this->unsupported_type($parsed);
}