fix listcommands template for Send form changes
[squirrelmail.git] / class / mime / AddressStructure.class.php
index 96524e340fb01d6a8a32ece44330d25f2ee38b50..956326dc180d06a7132862498743bd781ee3516c 100644 (file)
@@ -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-2007 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -67,13 +67,13 @@ class AddressStructure {
                 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