[Svn] r2143 - in trunk/roundcubemail: . config program/include program/lib
trac at roundcube.net
trac at roundcube.net
Thu Dec 11 09:30:00 CET 2008
Author: alec
Date: 2008-12-11 02:30:00 -0600 (Thu, 11 Dec 2008)
New Revision: 2143
Modified:
trunk/roundcubemail/CHANGELOG
trunk/roundcubemail/UPGRADING
trunk/roundcubemail/config/main.inc.php.dist
trunk/roundcubemail/program/include/rcmail.php
trunk/roundcubemail/program/lib/imap.inc
Log:
- Performance: allow setting imap rootdir and delimiter before connect (#1485172)
Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG 2008-12-10 19:22:22 UTC (rev 2142)
+++ trunk/roundcubemail/CHANGELOG 2008-12-11 08:30:00 UTC (rev 2143)
@@ -1,6 +1,10 @@
CHANGELOG RoundCube Webmail
---------------------------
+2008/12/11 (alec)
+----------
+- Performance: allow setting imap rootdir and delimiter before connect (#1485172)
+
2008/12/06 (alec)
----------
- Fix sorting of folders with more than 2 levels (#1485569)
Modified: trunk/roundcubemail/UPGRADING
===================================================================
--- trunk/roundcubemail/UPGRADING 2008-12-10 19:22:22 UTC (rev 2142)
+++ trunk/roundcubemail/UPGRADING 2008-12-11 08:30:00 UTC (rev 2143)
@@ -18,6 +18,7 @@
open http://url-to-roundcube/installer/ in a browser. To enable
the latter one, you have to temporary set 'enable_installer' to true
in your local config/main.inc.php file.
+ WARNING: If you don't know what is IMAP root directory, set imap_root option to NULL
3. Let the update script/installer check your configuration and
update your config files as suggested by the updater.
4. If suggested by the update script, run all commands in
Modified: trunk/roundcubemail/config/main.inc.php.dist
===================================================================
--- trunk/roundcubemail/config/main.inc.php.dist 2008-12-10 19:22:22 UTC (rev 2142)
+++ trunk/roundcubemail/config/main.inc.php.dist 2008-12-11 08:30:00 UTC (rev 2143)
@@ -61,6 +61,12 @@
// Optional, defaults to "check"
$rcmail_config['imap_auth_type'] = null;
+// If you know your imap's root directory and its folder delimiter,
+// you can specify them here. Otherwise they will be determined
+// during every imap connection.
+$rcmail_config['imap_root'] = null;
+$rcmail_config['imap_delimiter'] = null;
+
// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
@@ -152,9 +158,6 @@
// use this name to compose page titles
$rcmail_config['product_name'] = 'RoundCube Webmail';
-// only list folders within this path
-$rcmail_config['imap_root'] = '';
-
// store draft message is this mailbox
// leave blank if draft messages should not be stored
$rcmail_config['drafts_mbox'] = 'Drafts';
Modified: trunk/roundcubemail/program/include/rcmail.php
===================================================================
--- trunk/roundcubemail/program/include/rcmail.php 2008-12-10 19:22:22 UTC (rev 2142)
+++ trunk/roundcubemail/program/include/rcmail.php 2008-12-11 08:30:00 UTC (rev 2143)
@@ -515,10 +515,6 @@
{
$this->imap->set_charset($this->config->get('default_charset', RCMAIL_CHARSET));
- // set root dir from config
- if ($imap_root = $this->config->get('imap_root')) {
- $this->imap->set_rootdir($imap_root);
- }
if ($default_folders = $this->config->get('default_imap_folders')) {
$this->imap->set_default_mailboxes($default_folders);
}
Modified: trunk/roundcubemail/program/lib/imap.inc
===================================================================
--- trunk/roundcubemail/program/lib/imap.inc 2008-12-10 19:22:22 UTC (rev 2142)
+++ trunk/roundcubemail/program/lib/imap.inc 2008-12-11 08:30:00 UTC (rev 2143)
@@ -73,6 +73,8 @@
- fix iil_C_FetchPartHeader() in some cases by use of iil_C_HandlePartBody()
- allow iil_C_HandlePartBody() to fetch whole message
- optimize iil_C_FetchHeaders() to use only one FETCH command
+ - added 4th argument to iil_Connect()
+ - allow setting rootdir and delimiter before connect
********************************************************/
@@ -196,7 +198,7 @@
}
function iil_PutLine($fp, $string, $endln=true) {
-// console('C: '. rtrim($string));
+ console('C: '. rtrim($string));
return fputs($fp, $string . ($endln ? "\r\n" : ''));
}
@@ -476,15 +478,16 @@
function iil_C_NameSpace(&$conn) {
global $my_prefs;
+
+ if (isset($my_prefs['rootdir']) && is_string($my_prefs['rootdir'])) {
+ $conn->rootdir = $my_prefs['rootdir'];
+ return true;
+ }
if (!iil_C_GetCapability($conn, 'NAMESPACE')) {
return false;
}
- if ($my_prefs["rootdir"]) {
- return true;
- }
-
iil_PutLine($conn->fp, "ns1 NAMESPACE");
do {
$line = iil_ReadLine($conn->fp, 1024);
@@ -510,12 +513,13 @@
$conn->rootdir = $first_userspace[0];
$conn->delimiter = $first_userspace[1];
- $my_prefs["rootdir"] = substr($conn->rootdir, 0, -1);
+ $my_prefs['rootdir'] = substr($conn->rootdir, 0, -1);
+ $my_prefs['delimiter'] = $conn->delimiter;
return true;
}
-function iil_Connect($host, $user, $password) {
+function iil_Connect($host, $user, $password, $options=null) {
global $iil_error, $iil_errornum;
global $ICL_SSL, $ICL_PORT;
global $IMAP_NO_CACHE;
@@ -523,18 +527,23 @@
$iil_error = '';
$iil_errornum = 0;
-
- //set auth method
- $auth_method = 'plain';
- if (func_num_args() >= 4) {
- $auth_array = func_get_arg(3);
- if (is_array($auth_array)) {
- $auth_method = $auth_array['imap'];
- }
- if (empty($auth_method)) {
- $auth_method = "plain";
- }
+
+ // set some imap options
+ if (is_array($options)) {
+ foreach($options as $optkey => $optval) {
+ if ($optkey == 'imap') {
+ $auth_method = $optval;
+ } else if ($optkey == 'rootdir') {
+ $my_prefs['rootdir'] = $optval;
+ } else if ($optkey == 'delimiter') {
+ $my_prefs['delimiter'] = $optval;
+ }
+ }
}
+
+ if (empty($auth_method))
+ $auth_method = 'plain';
+
$message = "INITIAL: $auth_method\n";
$result = false;
@@ -2138,9 +2147,15 @@
* @see iil_Connect()
*/
function iil_C_GetHierarchyDelimiter(&$conn) {
+
+ global $my_prefs;
+
if ($conn->delimiter) {
- return $conn->delimiter;
+ return $conn->delimiter;
}
+ if (!empty($my_prefs['delimiter'])) {
+ return ($conn->delimiter = $my_prefs['delimiter']);
+ }
$fp = $conn->fp;
$delimiter = false;
_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn
More information about the Svn
mailing list