X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Fmime%2FAddressStructure.class.php;h=fb1e5f3cf6f34906b3859ca72a904d861b0d2755;hp=96524e340fb01d6a8a32ece44330d25f2ee38b50;hb=2131e73eac2f52fcfef5015a4632dffc4226ee90;hpb=9f37489122fa5e7c8ede3f4898dc955015895dc8 diff --git a/class/mime/AddressStructure.class.php b/class/mime/AddressStructure.class.php index 96524e34..fb1e5f3c 100644 --- a/class/mime/AddressStructure.class.php +++ b/class/mime/AddressStructure.class.php @@ -6,7 +6,7 @@ * This file contains functions needed to extract email address headers from * mime messages. * - * @copyright © 2003-2005 The SquirrelMail Project Team + * @copyright © 2003-2009 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -60,20 +60,20 @@ class AddressStructure { : $this->mailbox); $personal = trim($this->personal); $is_encoded = false; - if (preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(.*)/Ui',$personal,$reg)) { + if (preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(.*)/i',$personal,$reg)) { $is_encoded = true; } if ($personal) { if ($encoded && !$is_encoded) { $personal_encoded = encodeHeader($personal); if ($personal !== $personal_encoded) { - $personal = $personal_encoded; + $personal = '"' . $personal_encoded . '"'; } else { - $personal = '"'.$this->personal.'"'; + $personal = '"' . $this->personal . '"'; } } else { if (!$is_encoded) { - $personal = '"'.$this->personal.'"'; + $personal = '"' . $this->personal . '"'; } } $addr = ($email ? $personal . ' <' .$email.'>' @@ -97,6 +97,17 @@ class AddressStructure { function getEncodedAddress() { return $this->getAddress(true, true); } + + /** + * Return just the email portion of this address + * @return string + * @since 1.5.2 + */ + function getEmail () { + $r = ''; + if (is_object($this)) { + $r = $this->host ? $this->mailbox.'@'.$this->host : $this->mailbox; + } + return $r; + } } - -?> \ No newline at end of file