4 * AddressStructure.class.php
6 * Copyright (c) 2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This contains functions needed to handle mime messages.
14 class AddressStructure
{
21 function getAddress($full = true, $encoded = false) {
23 if (is_object($this)) {
24 $email = ($this->host ?
$this->mailbox
.'@'.$this->host
26 $personal = trim($this->personal
);
28 if (preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(.*)/Ui',$personal,$reg)) {
32 if ($encoded && !$is_encoded) {
33 $personal_encoded = encodeHeader($personal);
34 if ($personal !== $personal_encoded) {
35 $personal = $personal_encoded;
37 $personal = '"'.$this->personal
.'"';
41 $personal = '"'.$this->personal
.'"';
44 $addr = ($email ?
$personal . ' <' .$email.'>'
46 $best_dpl = $this->personal
;
51 $result = ($full ?
$addr : $best_dpl);
56 function getEncodedAddress() {
57 return $this->getAddress(true, true);