[Svn] r5946 - trunk/roundcubemail/program/include
trac at roundcube.net
trac at roundcube.net
Fri Mar 2 14:43:45 CET 2012
Author: alec
Date: 2012-03-02 07:43:45 -0600 (Fri, 02 Mar 2012)
New Revision: 5946
Modified:
trunk/roundcubemail/program/include/rcube_imap.php
trunk/roundcubemail/program/include/rcube_imap_generic.php
Log:
- Fix automatic unsubscribe of non-existent folders (with small perf fix)
Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php 2012-03-02 13:09:05 UTC (rev 5945)
+++ trunk/roundcubemail/program/include/rcube_imap.php 2012-03-02 13:43:45 UTC (rev 5946)
@@ -2527,9 +2527,10 @@
NULL, array('SUBSCRIBED'));
// unsubscribe non-existent folders, remove from the list
- if (is_array($a_folders) && $name == '*') {
+ // we can do this only when LIST response is available
+ if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) {
foreach ($a_folders as $idx => $folder) {
- if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder])
+ if (($opts = $this->conn->data['LIST'][$folder])
&& in_array('\\NonExistent', $opts)
) {
$this->conn->unsubscribe($folder);
@@ -2542,11 +2543,12 @@
else {
$a_folders = $this->conn->listSubscribed($root, $name);
- // unsubscribe non-existent folders, remove from the list
- if (is_array($a_folders) && $name == '*') {
+ // unsubscribe non-existent folders, remove them from the list,
+ // we can do this only when LIST response is available
+ if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) {
foreach ($a_folders as $idx => $folder) {
- if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder])
- && in_array('\\Noselect', $opts)
+ if (!isset($this->conn->data['LIST'][$folder])
+ || in_array('\\Noselect', $this->conn->data['LIST'][$folder])
) {
// Some servers returns \Noselect for existing folders
if (!$this->folder_exists($folder)) {
Modified: trunk/roundcubemail/program/include/rcube_imap_generic.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap_generic.php 2012-03-02 13:09:05 UTC (rev 5945)
+++ trunk/roundcubemail/program/include/rcube_imap_generic.php 2012-03-02 13:43:45 UTC (rev 5946)
@@ -1352,12 +1352,16 @@
$folders[$mailbox] = array();
}
- // Add to options array
- if (empty($this->data['LIST'][$mailbox]))
- $this->data['LIST'][$mailbox] = $opts;
- else if (!empty($opts))
- $this->data['LIST'][$mailbox] = array_unique(array_merge(
- $this->data['LIST'][$mailbox], $opts));
+ // store LSUB options only if not empty, this way
+ // we can detect a situation when LIST doesn't return specified folder
+ if (!empty($opts) || $cmd == 'LIST') {
+ // Add to options array
+ if (empty($this->data['LIST'][$mailbox]))
+ $this->data['LIST'][$mailbox] = $opts;
+ else if (!empty($opts))
+ $this->data['LIST'][$mailbox] = array_unique(array_merge(
+ $this->data['LIST'][$mailbox], $opts));
+ }
}
// * STATUS <mailbox> (<result>)
else if ($cmd == 'STATUS') {
_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn
More information about the Svn
mailing list