From e6f484250561b6e9c8fe72cde0f1a633e88103ae Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Fri, 04 Sep 2009 09:00:36 -0400 Subject: [PATCH] - remove test code --- program/include/rcube_imap.php | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-) diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index b271245..6940bd1 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -36,7 +36,7 @@ * * @package Mail * @author Thomas Bruederli <roundcube@gmail.com> - * @version 1.40 + * @version 1.5 * @link http://ilohamail.org */ class rcube_imap @@ -107,16 +107,20 @@ raise_error(array('code' => 403, 'type' => 'imap', 'file' => __FILE__, 'message' => 'Open SSL not available;'), TRUE, FALSE); $port = 143; - } + } $ICL_PORT = $port; $IMAP_USE_INTERNAL_DATE = false; - $data = rcmail::get_instance()->plugins->exec_hook('imap_connect', array('host' => $host, 'user' => $user)); - if (!empty($data['pass'])) - $pass = $data['pass']; + $attempt = 0; + do { + $data = rcmail::get_instance()->plugins->exec_hook('imap_connect', array('host' => $host, 'user' => $user, 'attempt' => ++$attempt)); + if (!empty($data['pass'])) + $pass = $data['pass']; - $this->conn = iil_Connect($data['host'], $data['user'], $pass, $this->options); + $this->conn = iil_Connect($data['host'], $data['user'], $pass, $this->options); + } while(!$this->conn && $data['retry']); + $this->host = $data['host']; $this->user = $data['user']; $this->pass = $pass; @@ -594,7 +598,7 @@ // retrieve headers from IMAP $a_msg_headers = array(); - if ($this->get_capability('sort') && ($msg_index = iil_C_Sort($this->conn, $mailbox, $this->sort_field, $this->skip_deleted ? 'UNDELETED' : ''))) + if (!$this->get_capability('sort') && ($msg_index = iil_C_Sort($this->conn, $mailbox, $this->sort_field, $this->skip_deleted ? 'UNDELETED' : ''))) { list($begin, $end) = $this->_get_message_range(count($msg_index), $page); $max = max($msg_index); @@ -609,7 +613,7 @@ else { $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, "1:*", $this->sort_field, $this->skip_deleted); - + if (empty($a_index)) return array(); @@ -2886,7 +2890,7 @@ private function _change_subscription($a_mboxes, $mode) { $updated = FALSE; - + if (is_array($a_mboxes)) foreach ($a_mboxes as $i => $mbox_name) { @@ -2894,15 +2898,12 @@ $a_mboxes[$i] = $mailbox; if ($mode=='subscribe') - $result = iil_C_Subscribe($this->conn, $mailbox); + $updated = iil_C_Subscribe($this->conn, $mailbox); else if ($mode=='unsubscribe') - $result = iil_C_UnSubscribe($this->conn, $mailbox); - - if ($result>=0) - $updated = TRUE; + $updated = iil_C_UnSubscribe($this->conn, $mailbox); } - - // get cached mailbox list + + // get cached mailbox list if ($updated) { $a_mailbox_cache = $this->get_cache('mailboxes'); @@ -2914,7 +2915,7 @@ $a_mailbox_cache = array_merge($a_mailbox_cache, $a_mboxes); else if ($mode=='unsubscribe') $a_mailbox_cache = array_diff($a_mailbox_cache, $a_mboxes); - + // write mailboxlist to cache $this->update_cache('mailboxes', $this->_sort_mailbox_list($a_mailbox_cache)); } -- Gitblit v1.9.1