From 5933d98c8cdee9ef4b04eaf680a7d29cb4928cfc Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 10 May 2010 07:20:52 -0400
Subject: [PATCH] - it_IT update (#1486724)

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

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 9facb32..6e4d989 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -92,7 +92,7 @@
      */
     function connect($host, $user, $pass, $port=143, $use_ssl=null)
     {
-        // check for Open-SSL support in PHP build
+        // check for OpenSSL support in PHP build
         if ($use_ssl && extension_loaded('openssl'))
             $this->options['ssl_mode'] = $use_ssl == 'imaps' ? 'ssl' : $use_ssl;
         else if ($use_ssl) {
@@ -1589,7 +1589,7 @@
             if ($headers->uid && $headers->id)
                 $this->uid_id_map[$mailbox][$headers->uid] = $headers->id;
 
-            $this->add_message_cache($mailbox.'.msg', $headers->id, $headers, NULL, true);
+            $this->add_message_cache($mailbox.'.msg', $headers->id, $headers, NULL);
         }
 
         return $headers;
@@ -2482,10 +2482,10 @@
         $a_out = array();
         $a_mboxes = $this->_list_mailboxes($root, $filter);
 
-        foreach ($a_mboxes as $mbox_row) {
-            $name = $this->mod_mailbox($mbox_row, 'out');
-            if (strlen($name))
+        foreach ($a_mboxes as $idx => $mbox_row) {
+            if ($name = $this->mod_mailbox($mbox_row, 'out'))
                 $a_out[] = $name;
+            unset($a_mboxes[$idx]);
         }
 
         // INBOX should always be available
@@ -2554,10 +2554,15 @@
         $a_mboxes = $this->conn->listMailboxes($this->mod_mailbox($root), '*');
 
         // modify names with root dir
-        foreach ($a_mboxes as $mbox_name) {
+        foreach ($a_mboxes as $idx => $mbox_name) {
             if ($name = $this->mod_mailbox($mbox_name, 'out'))
                 $a_folders[] = $name;
+            unset($a_mboxes[$idx]);
         }
+
+        // INBOX should always be available
+        if (!in_array('INBOX', $a_folders))
+            array_unshift($a_folders, 'INBOX');
 
         // filter folders and sort them
         $a_folders = $this->_sort_mailbox_list($a_folders);
@@ -2708,7 +2713,7 @@
             foreach ($a_mboxes as $mbox_name) {
                 $mailbox = $this->mod_mailbox($mbox_name);
                 $sub_mboxes = $this->conn->listMailboxes($this->mod_mailbox(''),
-	            $mbox_name . $this->delimiter . '*');
+	                $mbox_name . $this->delimiter . '*');
 
                 // unsubscribe mailbox before deleting
                 $this->conn->unsubscribe($mailbox);
@@ -2769,14 +2774,19 @@
             if ($mbox_name == 'INBOX')
                 return true;
 
+            $key = $subscription ? 'subscribed' : 'existing';
+            if (is_array($this->icache[$key]) && in_array($mbox_name, $this->icache[$key]))
+                return true;
+
             if ($subscription) {
-                if ($a_folders = $this->conn->listSubscribed($this->mod_mailbox(''), $mbox_name))
-                    return true;
+                $a_folders = $this->conn->listSubscribed($this->mod_mailbox(''), $mbox_name);
             }
             else {
                 $a_folders = $this->conn->listMailboxes($this->mod_mailbox(''), $mbox_name);
-	
-	        if (is_array($a_folders) && in_array($this->mod_mailbox($mbox_name), $a_folders))
+	        }
+	        
+            if (is_array($a_folders) && in_array($this->mod_mailbox($mbox_name), $a_folders)) {
+                $this->icache[$key][] = $mbox_name;
                 return true;
             }
         }
@@ -3150,7 +3160,7 @@
         if (!$this->caching_enabled)
             return;
     
-        // check for an existing record (probly headers are cached but structure not)
+        // check for an existing record (probably headers are cached but structure not)
         if (!$force) {
             $sql_result = $this->db->query(
                 "SELECT message_id".

--
Gitblit v1.9.1