New function to return only the email address. For use with templates.
[squirrelmail.git] / class / mime / Rfc822Header.class.php
index eb9e3d3fb28f3069f072f6199d5294895078c10e..c5b99d6c6543025aad4fc92bbc8d0287238509f2 100644 (file)
@@ -3,11 +3,10 @@
 /**
  * Rfc822Header.class.php
  *
- * Copyright (c) 2003-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
  * This file contains functions needed to handle headers in mime messages.
  *
+ * @copyright © 2003-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  * @subpackage mime
@@ -89,7 +88,8 @@ class Rfc822Header {
      */
     var $mime = false;
     /**
-     * @var mixed
+     * Content Type object
+     * @var object
      */
     var $content_type = '';
     /**
@@ -107,9 +107,15 @@ class Rfc822Header {
      */
     var $priority = 3;
     /**
+     * Disposition notification for requesting message delivery notification (MDN)
      * @var mixed
      */
     var $dnt = '';
+    /**
+     * Delivery notification (DR)
+     * @var mixed
+     */
+    var $drnt = '';
     /**
      * @var mixed
      */
@@ -157,7 +163,7 @@ class Rfc822Header {
                 }
             }
         }
-        if ($this->content_type == '') {
+        if (!is_object($this->content_type)) {
             $this->parseContentType('text/plain; charset=us-ascii');
         }
     }
@@ -180,7 +186,9 @@ class Rfc822Header {
                         }
                         $result .= $value{$i};
                     }
-                    $result .= $value{$i};
+                    if($i < $cnt) {
+                        $result .= $value{$i};
+                    }
                     break;
                 case '(':
                     $depth = 1;
@@ -258,11 +266,14 @@ class Rfc822Header {
                 $this->references = $value;
                 break;
             case 'x-confirm-reading-to':
-            case 'return-receipt-to':
             case 'disposition-notification-to':
                 $value = $this->stripComments($value);
                 $this->dnt = $this->parseAddress($value);
                 break;
+            case 'return-receipt-to':
+                $value = $this->stripComments($value);
+                $this->drnt = $this->parseAddress($value);
+                break;
             case 'mime-version':
                 $value = $this->stripComments($value);
                 $value = str_replace(' ', '', $value);
@@ -938,5 +949,3 @@ class Rfc822Header {
         return $this->content_type->properties;
     }
 }
-
-?>
\ No newline at end of file