X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Fmime%2FAddressStructure.class.php;h=ecc83507c24ea8fca753228dfe7458fc2be1e868;hp=a4438944eb793e9760710c69073c7f4214f6e1a5;hb=2f8c79ee4f62a50c854141fb0ff2f44d8f5f5b9c;hpb=6b76cffa6afb885fc54c385527ea18e1e7d46dcb diff --git a/class/mime/AddressStructure.class.php b/class/mime/AddressStructure.class.php index a4438944..ecc83507 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-2010 The SquirrelMail Project Team + * @copyright 2003-2011 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -51,9 +51,11 @@ class AddressStructure { * Return address information from mime headers. * @param boolean $full return full address (true) or only personal if it exists, otherwise email (false) * @param boolean $encoded (since 1.4.0) return rfc2047 encoded address (true) or plain text (false). + * @param boolean $unconditionally_quote (since 1.4.21/1.5.2) when TRUE, always quote the personal part, whether or not it is encoded, otherwise quoting is only added if the personal part is not encoded + * * @return string */ - function getAddress($full = true, $encoded = false) { + function getAddress($full = true, $encoded = false, $unconditionally_quote = FALSE) { $result = ''; if (is_object($this)) { $email = ($this->host ? $this->mailbox.'@'.$this->host @@ -69,10 +71,11 @@ class AddressStructure { if ($personal !== $personal_encoded) { $personal = $personal_encoded; } else { + //FIXME: this probably adds quotes around an encoded string which itself is already quoted $personal = '"' . $this->personal . '"'; } } else { - if (!$is_encoded) { + if (!$is_encoded || $unconditionally_quote) { $personal = '"' . $this->personal . '"'; } } @@ -91,11 +94,13 @@ class AddressStructure { /** * Shorter version of getAddress() function * Returns full encoded address. + * @param boolean $unconditionally_quote (since 1.4.21/1.5.2) when TRUE, always quote the personal part, whether or not it is encoded, otherwise quoting is only added if the personal part is not encoded + * * @return string * @since 1.4.0 */ - function getEncodedAddress() { - return $this->getAddress(true, true); + function getEncodedAddress($unconditionally_quote=FALSE) { + return $this->getAddress(true, true, $unconditionally_quote); } /**