X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Fmime%2FAddressStructure.class.php;h=34193eef94323fdd73c715ad2d3c27adff02845e;hp=d3f6976aaa2f1ee226652cc0c01e87640184ab93;hb=3aaa3214e4a35deff1a5bdfc60e286eec6d75ed2;hpb=91e0dccca7b2452d8b450791cae3aa4125e8889e diff --git a/class/mime/AddressStructure.class.php b/class/mime/AddressStructure.class.php index d3f6976a..34193eef 100644 --- a/class/mime/AddressStructure.class.php +++ b/class/mime/AddressStructure.class.php @@ -3,26 +3,56 @@ /** * AddressStructure.class.php * - * Copyright (c) 2003-2004 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * - * This contains functions needed to handle mime messages. + * This file contains functions needed to extract email address headers from + * mime messages. * + * @copyright © 2003-2007 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail + * @subpackage mime + * @since 1.3.2 */ /** - * Undocumented class + * Class used to work with email address headers * @package squirrelmail + * @subpackage mime + * @since 1.3.2 */ class AddressStructure { - var $personal = '', - $adl = '', - $mailbox = '', - $host = '', - $group = ''; + /** + * Personal information + * @var string + */ + var $personal = ''; + /** + * @todo check use of this variable. var is not used in class. + * @var string + */ + var $adl = ''; + /** + * Mailbox name. + * @var string + */ + var $mailbox = ''; + /** + * Server address. + * @var string + */ + var $host = ''; + /** + * @todo check use of this variable. var is not used in class. + * @var string + */ + var $group = ''; + /** + * 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). + * @return string + */ function getAddress($full = true, $encoded = false) { $result = ''; if (is_object($this)) { @@ -58,9 +88,26 @@ class AddressStructure { return $result; } + /** + * Shorter version of getAddress() function + * Returns full encoded address. + * @return string + * @since 1.4.0 + */ 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