From f281242fa41160daca6f2a4775d6f5dedd61a946 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 13 Oct 2009 03:41:31 -0400
Subject: [PATCH] - performance: fix storing of imap_delimiter in session 

---
 program/include/rcube_imap.php |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 9ca1167..a358186 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -112,7 +112,7 @@
 
     $ICL_PORT = $port;
     $IMAP_USE_INTERNAL_DATE = false;
-    
+
     $attempt = 0;
     do {
       $data = rcmail::get_instance()->plugins->exec_hook('imap_connect', array('host' => $host, 'user' => $user, 'attempt' => ++$attempt));
@@ -144,13 +144,13 @@
     // get server properties
     if ($this->conn)
       {
-      if (!empty($this->conn->delimiter))
-        $this->delimiter = $this->conn->delimiter;
       if (!empty($this->conn->rootdir))
         {
         $this->set_rootdir($this->conn->rootdir);
         $this->root_ns = preg_replace('/[.\/]$/', '', $this->conn->rootdir);
         }
+      if (empty($this->delimiter))
+	$this->get_hierarchy_delimiter();
       }
 
     return $this->conn ? TRUE : FALSE;
@@ -1226,17 +1226,15 @@
       else
         $this->struct_charset = $this->_structure_charset($structure);
 
-      /*
-        @TODO: here we can recognize malformed BODYSTRUCTURE and parse
-	the message in other way to create our own message structure.
-	Example of structure for malformed MIME message:
-	("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL)
-
-	if ($headers->ctype != 'text/plain'
-	  && !is_array($structure[0]) && $structure[0] == 'text' 
-	  && !is_array($structure[1]) && $structure[1] == 'plain') 
-	  { }
-      */
+      // Here we can recognize malformed BODYSTRUCTURE and 
+      // 1. [@TODO] parse the message in other way to create our own message structure
+      // 2. or just show the raw message body.
+      // Example of structure for malformed MIME message:
+      // ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL)
+      if ($headers->ctype && $headers->ctype != 'text/plain'
+	  && $structure[0] == 'text' && $structure[1] == 'plain') {
+	return false;  
+	}
 
       $struct = &$this->_structure_part($structure);
       $struct->headers = get_object_vars($headers);

--
Gitblit v1.9.1