functions are only used statically. mark as such.
[squirrelmail.git] / class / mime / Message.class.php
index 2bc35c623689e2bd93f535575a88fa6858cfe954..d41e528eb8435b30509a394eb30689c713649804 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This file contains functions needed to handle mime messages.
  *
- * @copyright 2003-2011 The SquirrelMail Project Team
+ * @copyright 2003-2012 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -292,7 +292,7 @@ class Message {
      * @return object Message object
      * @todo define argument and return types
      */
-    function parseStructure($read, &$i, $sub_msg = '') {
+    static function parseStructure($read, &$i, $sub_msg = '') {
         $msg = Message::parseBodyStructure($read, $i, $sub_msg);
         if($msg) $msg->setEntIds($msg,false,0);
         return $msg;
@@ -342,7 +342,7 @@ class Message {
      * @todo document me
      * @since 1.4.0 (code was part of parseStructure() in 1.3.x)
      */
-    function parseBodyStructure($read, &$i, $sub_msg = '') {
+    static function parseBodyStructure($read, &$i, $sub_msg = '') {
         $arg_no = 0;
         $arg_a  = array();
         if ($sub_msg) {
@@ -363,11 +363,12 @@ class Message {
                                 $hdr->type0 = 'text';
                                 $hdr->type1 = 'plain';
                                 $hdr->encoding = '7bit';
+                                $msg->header = $hdr;
                             } else {
                                 $msg->header->type0 = 'multipart';
                                 $msg->type0 = 'multipart';
                                 while ($read{$i} == '(') {
-                                    $msg->addEntity($msg->parseBodyStructure($read, $i, $msg));
+                                    $msg->addEntity(Message::parseBodyStructure($read, $i, $msg));
                                 }
                             }
                             break;
@@ -402,7 +403,7 @@ class Message {
                                 while (($i < $cnt) && ($read{$i} != '(')) {
                                     ++$i;
                                 }
-                                $msg->addEntity($msg->parseBodyStructure($read, $i,$msg));
+                                $msg->addEntity(Message::parseBodyStructure($read, $i,$msg));
                             }
                             break;
                         case 8:
@@ -461,17 +462,17 @@ class Message {
                     $arg_a[] = $msg->parseLiteral($read, $i);
                     ++$arg_no;
                     break;
-        case '0':
+                case '0':
                 case is_numeric($read{$i}):
                     /* process integers */
                     if ($read{$i} == ' ') { break; }
-            ++$arg_no;
-            if (preg_match('/^([0-9]+).*/',substr($read,$i), $regs)) {
-                $i += strlen($regs[1])-1;
-                $arg_a[] = $regs[1];
-            } else {
-                $arg_a[] = 0;
-            }
+                    ++$arg_no;
+                    if (preg_match('/^([0-9]+).*/',substr($read,$i), $regs)) {
+                        $i += strlen($regs[1])-1;
+                        $arg_a[] = $regs[1];
+                    } else {
+                        $arg_a[] = 0;
+                    }
                     break;
                 case ')':
                     $multipart = (isset($msg->type0) && ($msg->type0 == 'multipart'));