*** php4/pear/Mail/RFC822.php Thu Mar 29 14:11:36 2001 --- /home/nic/RFC822.php Mon Jun 25 14:48:57 2001 *************** *** 272,277 **** --- 272,278 ---- if ($this->hasUnclosedQuotes($string) || $this->hasUnclosedBrackets($string, '<>') || $this->hasUnclosedBrackets($string, '[]') + || $this->hasUnclosedBrackets($string, '()') || substr($string, -1) == '\\') { if (isset($parts[$i + 1])) { $string = $string . $char . $parts[$i + 1]; *************** *** 543,548 **** --- 544,560 ---- // A couple of defaults. $phrase = ''; + // Catch any RFC822 comments and store them separately + ereg("\(.*\)", $mailbox, $regs); + if(is_array($regs)) { + foreach($regs as $string) { + $mailbox = str_replace($string, ' ', $mailbox); + $comment .= substr($string, 1, -1); + } + $mailbox = trim($mailbox); + $comment = trim($comment); + } + // Check for name + route-addr if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') { $parts = explode('<', $mailbox); *************** *** 568,574 **** // Construct the object that will be returned. $mbox = new stdClass(); ! $phrase !== '' ? $mbox->personal = $phrase : ''; if (isset($route_addr)) { $mbox->mailbox = $route_addr['local_part']; --- 580,597 ---- // Construct the object that will be returned. $mbox = new stdClass(); ! ! // If we have a phrase, use that as personal, else use comment ! if (trim($phrase) == '') { ! if (trim($comment) == '') { ! $mbox->personal = ''; ! } else { ! $mbox->personal = $comment; ! } ! } else { ! $mbox->personal = $phrase; ! $mbox->comment = $comment; ! } if (isset($route_addr)) { $mbox->mailbox = $route_addr['local_part'];