Phpdocumentor update - sed is your friend for these kinds of things ;)
[squirrelmail.git] / class / mime / AddressStructure.class.php
CommitLineData
19d470aa 1<?php
2
3/**
4 * AddressStructure.class.php
5 *
82d304a0 6 * Copyright (c) 2003-2004 The SquirrelMail Project Team
19d470aa 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This contains functions needed to handle mime messages.
10 *
883d9cd3 11 * @version $Id$
2b646597 12 * @package squirrelmail
19d470aa 13 */
14
2b646597 15/**
16 * Undocumented class
17 * @package squirrelmail
18 */
19d470aa 19class AddressStructure {
20 var $personal = '',
21 $adl = '',
22 $mailbox = '',
23 $host = '',
24 $group = '';
25
2c9ecd11 26 function getAddress($full = true, $encoded = false) {
19d470aa 27 $result = '';
19d470aa 28 if (is_object($this)) {
53bd5aa2 29 $email = ($this->host ? $this->mailbox.'@'.$this->host
340d67c2 30 : $this->mailbox);
2c9ecd11 31 $personal = trim($this->personal);
340d67c2 32 $is_encoded = false;
cdafbbc5 33 if (preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(.*)/Ui',$personal,$reg)) {
340d67c2 34 $is_encoded = true;
35 }
2c9ecd11 36 if ($personal) {
340d67c2 37 if ($encoded && !$is_encoded) {
2c9ecd11 38 $personal_encoded = encodeHeader($personal);
39 if ($personal !== $personal_encoded) {
40 $personal = $personal_encoded;
41 } else {
42 $personal = '"'.$this->personal.'"';
43 }
44 } else {
340d67c2 45 if (!$is_encoded) {
46 $personal = '"'.$this->personal.'"';
47 }
2c9ecd11 48 }
340d67c2 49 $addr = ($email ? $personal . ' <' .$email.'>'
50 : $this->personal);
19d470aa 51 $best_dpl = $this->personal;
52 } else {
53 $addr = $email;
54 $best_dpl = $email;
55 }
56 $result = ($full ? $addr : $best_dpl);
57 }
58 return $result;
59 }
2c9ecd11 60
61 function getEncodedAddress() {
62 return $this->getAddress(true, true);
63 }
19d470aa 64}
65
66?>