- improve Content-type header parsing

release-0.6
alecpl 15 years ago
parent 640d305d8d
commit 7fc0b94450

@ -1592,14 +1592,11 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false, $bo
$result[$id]->encoding = $string; $result[$id]->encoding = $string;
break; break;
case 'content-type': case 'content-type':
$ctype_parts = explode(";", $string); $ctype_parts = preg_split('/[; ]/', $string);
$result[$id]->ctype = array_shift($ctype_parts); $result[$id]->ctype = array_shift($ctype_parts);
foreach ($ctype_parts as $ctype_add) { if (preg_match('/charset\s*=\s*"?([a-z0-9\-\.\_]+)"?/i', $string, $regs)) {
if (preg_match('/charset="?([a-z0-9\-\.\_]+)"?/i',
$ctype_add, $regs)) {
$result[$id]->charset = $regs[1]; $result[$id]->charset = $regs[1];
} }
}
break; break;
case 'in-reply-to': case 'in-reply-to':
$result[$id]->in_reply_to = preg_replace('/[\n<>]/', '', $string); $result[$id]->in_reply_to = preg_replace('/[\n<>]/', '', $string);

Loading…
Cancel
Save