{
$msg = new BananaMessage();
$msg->msg_headers = $headers;
- $msg->makeTextPart($body, 'text/plain', '8bits', 'UTF-8', 'fixed');
+ $msg->makeTextPart($body, 'text/plain', '8bits', 'UTF-8', 'flowed');
if (!is_null($file)) {
$msg->addAttachment($file);
}
}
if ($hdr == 'date') {
return strtotime($this->headers['date']);
+ } else if ($hdr == 'references' || $hdr == 'reply-to') {
+ return str_replace('><', '> <', $this->headers[$hdr]);
} else {
return $this->headers[$hdr];
}
static public function formatReferences(array &$refs)
{
if (isset($refs['references'])) {
- $text = str_replace('><', '> <', $refs['references']);
- return preg_split('/\s/', strtr($text, Banana::$spool->ids));
+ $text = preg_split('/\s/', str_replace('><', '> <', $refs['references']));
+ $references = array();
+ foreach ($text as $id=>&$value) {
+ if (isset(Banana::$spool->ids[$value])) {
+ $references[] = Banana::$spool->ids[$value];
+ }
+ }
+ return $references;
} elseif (isset($refs['in-reply-to']) && isset(Banana::$spool->ids[$refs['in-reply-to']])) {
return array(Banana::$spool->ids[$refs['in-reply-to']]);
} else {
if (function_exists('hook_checkcancel')) {
return hook_checkcancel($this->headers);
}
- return Banana::$profile['name'] == $this->headers['from'];
+ return Banana::$profile['headers']['From'] == $this->headers['from'];
}
public function canSend()
{
return Banana::$protocole->canSend();
}
+
+ public function getSignature()
+ {
+ $email = $this->getHeaderValue('from');
+ if (preg_match('/<?([^ <]+@[^ >]+)>?/', $email, $matches)) {
+ $email = $matches[1];
+ }
+ $signature = BananaMimePart::getSignature();
+ if (empty($signature)) {
+ return $signature;
+ } else {
+ foreach ($signature['identity'] as $ident) {
+ if (strpos($ident, "<$email>") !== false) {
+ return $signature;
+ }
+ }
+ $signature['certified'] = false;
+ $signature['certification_error'] = 'mauvaise identité';
+ }
+ return $signature;
+ }
}
// vim:set et sw=4 sts=4 ts=4 enc=utf-8: