summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcmail.php
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-12-24 14:29:47 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-12-24 14:29:47 +0000
commitd8f9dfdbc04b3fb1b85122a31ff3c81e85fa6791 (patch)
tree1a78e556d4776246ecd9fc591f00ba2fe6afd45f /roundcubemail/program/include/rcmail.php
parent3e3fafb16ed867f82123931de222286bd34a05c3 (diff)
Allow empty strings for imap_root config parameter (was changed in r2143) to remain backward compatible but cache imap root and delimiter in session
git-svn-id: https://svn.roundcube.net/trunk@2188 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcmail.php')
-rw-r--r--roundcubemail/program/include/rcmail.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php
index c7f26d96d..fcd39502b 100644
--- a/roundcubemail/program/include/rcmail.php
+++ b/roundcubemail/program/include/rcmail.php
@@ -352,6 +352,20 @@ class rcmail
// set pagesize from config
$this->imap->set_pagesize($this->config->get('pagesize', 50));
+
+ // Setting root and delimiter before iil_Connect can save time detecting them
+ // using NAMESPACE and LIST
+ $options = array(
+ 'imap' => $this->config->get('imap_auth_type', 'check'),
+ 'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'),
+ );
+
+ if (isset($_SESSION['imap_root']))
+ $options['rootdir'] = $_SESSION['imap_root'];
+ else if ($imap_root = $this->config->get('imap_root'))
+ $options['rootdir'] = $imap_root;
+
+ $this->imap->set_options($options);
// set global object for backward compatibility
$GLOBALS['IMAP'] = $this->imap;
@@ -371,7 +385,7 @@ class rcmail
$conn = false;
if ($_SESSION['imap_host'] && !$this->imap->conn) {
- if (!($conn = $this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl'], rcmail::get_instance()->config->get('imap_auth_type', 'check')))) {
+ if (!($conn = $this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl']))) {
if ($this->output)
$this->output->show_message($this->imap->error_code == -1 ? 'imaperror' : 'sessionerror', 'error');
}
@@ -452,7 +466,7 @@ class rcmail
$username = $user->data['username'];
// exit if IMAP login failed
- if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl, $config['imap_auth_type'])))
+ if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl)))
return false;
// user already registered -> update user's record
@@ -524,6 +538,10 @@ class rcmail
if (isset($_SESSION['page'])) {
$this->imap->set_page($_SESSION['page']);
}
+
+ // cache IMAP root and delimiter in session for performance reasons
+ $_SESSION['imap_root'] = $this->imap->root_dir;
+ $_SESSION['imap_delimiter'] = $this->imap->delimiter;
}