X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fspool.inc.php;h=ace19f7277dde077404d0aba500faba7a184384c;hb=16800641247adf482c6a8bc3b60707eac2bfe345;hp=074a758a4c76b9e556b33f8ab64fd0e9fdfda151;hpb=8575148f767c35d84122edf39f9a416010d9e532;p=banana.git diff --git a/banana/spool.inc.php b/banana/spool.inc.php index 074a758..ace19f7 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -54,28 +54,19 @@ class BananaSpoolHead */ public function __construct($id, array &$message) { + list($name, $from) = BananaMessage::extractMail($message['from']); $this->id = $id; $this->msgid = @$message['message-id']; $this->date = $message['date']; $this->subject = @$message['subject']; $this->from = $message['from']; - $this->color = sprintf('#%06x', abs(crc32($this->from) % 0xffffff)); + $this->color = sprintf('#%06x', abs(crc32($from) % 0xffffff)); $this->desc = 1; $this->isread = true; $this->descunread = 0; - if (preg_match("/^([^ ]+@[^ ]+) \((.*)\)$/", $this->from, $regs)) { - $this->name = $regs[2]; - } - if (preg_match("/^\"?([^<>\"]+)\"? +<(.+@.+)>$/", $this->from, $regs)) { - $this->name = preg_replace("/^'(.*)'$/", '\1', $regs[1]); - $this->name = stripslashes($this->name); - } - if ($this->name) { - $this->name = preg_replace("/\\\(\(|\))/","\\1", $this->name); - } else if (preg_match("/([^< ]+)@([^> ]+)/", $this->from, $regs)) { - $this->name = $regs[1]; - } else { - $this->name = 'Anonymous'; + $this->name = $name; + if ($name === $from) { + $this->name = 'Anonymous'; } } }