}
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 {
public function hasXFace()
{
- return Banana::$msgshow_xface && isset($this->headers['x-face']);
+ return Banana::$msgshow_xface &&
+ ((function_exists('hook_hasxface') && hook_hasXFace($this->headers))
+ || isset($this->headers['x-face']));
}
public function getXFace()
{
+ if (function_exists('hook_getxface') && hook_getXFace($this->headers)) {
+ return;
+ }
header('Content-Type: image/gif');
$xface = $this->headers['x-face'];
passthru('echo ' . escapeshellarg($xface)
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: