- Performance: allow setting imap rootdir and delimiter before connect (#1485172)

release-0.6
alecpl 16 years ago
parent dee9850abe
commit 030c848b0d

@ -1,6 +1,10 @@
CHANGELOG RoundCube Webmail CHANGELOG RoundCube Webmail
--------------------------- ---------------------------
2008/12/11 (alec)
----------
- Performance: allow setting imap rootdir and delimiter before connect (#1485172)
2008/12/06 (alec) 2008/12/06 (alec)
---------- ----------
- Fix sorting of folders with more than 2 levels (#1485569) - Fix sorting of folders with more than 2 levels (#1485569)

@ -18,6 +18,7 @@ of RoundCube Webmail.
open http://url-to-roundcube/installer/ in a browser. To enable open http://url-to-roundcube/installer/ in a browser. To enable
the latter one, you have to temporary set 'enable_installer' to true the latter one, you have to temporary set 'enable_installer' to true
in your local config/main.inc.php file. 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 3. Let the update script/installer check your configuration and
update your config files as suggested by the updater. update your config files as suggested by the updater.
4. If suggested by the update script, run all commands in 4. If suggested by the update script, run all commands in

@ -61,6 +61,12 @@ $rcmail_config['default_port'] = 143;
// Optional, defaults to "check" // Optional, defaults to "check"
$rcmail_config['imap_auth_type'] = null; $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 // Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses 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 // Specify an array with 'host' => 'domain' values to support multiple hosts
@ -152,9 +158,6 @@ $rcmail_config['useragent'] = 'RoundCube Webmail/0.2-beta';
// use this name to compose page titles // use this name to compose page titles
$rcmail_config['product_name'] = 'RoundCube Webmail'; $rcmail_config['product_name'] = 'RoundCube Webmail';
// only list folders within this path
$rcmail_config['imap_root'] = '';
// store draft message is this mailbox // store draft message is this mailbox
// leave blank if draft messages should not be stored // leave blank if draft messages should not be stored
$rcmail_config['drafts_mbox'] = 'Drafts'; $rcmail_config['drafts_mbox'] = 'Drafts';

@ -515,10 +515,6 @@ class rcmail
{ {
$this->imap->set_charset($this->config->get('default_charset', RCMAIL_CHARSET)); $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')) { if ($default_folders = $this->config->get('default_imap_folders')) {
$this->imap->set_default_mailboxes($default_folders); $this->imap->set_default_mailboxes($default_folders);
} }

@ -73,6 +73,8 @@
- fix iil_C_FetchPartHeader() in some cases by use of iil_C_HandlePartBody() - fix iil_C_FetchPartHeader() in some cases by use of iil_C_HandlePartBody()
- allow iil_C_HandlePartBody() to fetch whole message - allow iil_C_HandlePartBody() to fetch whole message
- optimize iil_C_FetchHeaders() to use only one FETCH command - 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_xor($string, $string2) {
} }
function iil_PutLine($fp, $string, $endln=true) { function iil_PutLine($fp, $string, $endln=true) {
// console('C: '. rtrim($string)); console('C: '. rtrim($string));
return fputs($fp, $string . ($endln ? "\r\n" : '')); return fputs($fp, $string . ($endln ? "\r\n" : ''));
} }
@ -477,12 +479,13 @@ function iil_ParseNamespace2($str, &$i, $len=0, $l) {
function iil_C_NameSpace(&$conn) { function iil_C_NameSpace(&$conn) {
global $my_prefs; global $my_prefs;
if (!iil_C_GetCapability($conn, 'NAMESPACE')) { if (isset($my_prefs['rootdir']) && is_string($my_prefs['rootdir'])) {
return false; $conn->rootdir = $my_prefs['rootdir'];
return true;
} }
if ($my_prefs["rootdir"]) { if (!iil_C_GetCapability($conn, 'NAMESPACE')) {
return true; return false;
} }
iil_PutLine($conn->fp, "ns1 NAMESPACE"); iil_PutLine($conn->fp, "ns1 NAMESPACE");
@ -510,12 +513,13 @@ function iil_C_NameSpace(&$conn) {
$conn->rootdir = $first_userspace[0]; $conn->rootdir = $first_userspace[0];
$conn->delimiter = $first_userspace[1]; $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; return true;
} }
function iil_Connect($host, $user, $password) { function iil_Connect($host, $user, $password, $options=null) {
global $iil_error, $iil_errornum; global $iil_error, $iil_errornum;
global $ICL_SSL, $ICL_PORT; global $ICL_SSL, $ICL_PORT;
global $IMAP_NO_CACHE; global $IMAP_NO_CACHE;
@ -524,17 +528,22 @@ function iil_Connect($host, $user, $password) {
$iil_error = ''; $iil_error = '';
$iil_errornum = 0; $iil_errornum = 0;
//set auth method // set some imap options
$auth_method = 'plain'; if (is_array($options)) {
if (func_num_args() >= 4) { foreach($options as $optkey => $optval) {
$auth_array = func_get_arg(3); if ($optkey == 'imap') {
if (is_array($auth_array)) { $auth_method = $optval;
$auth_method = $auth_array['imap']; } else if ($optkey == 'rootdir') {
$my_prefs['rootdir'] = $optval;
} else if ($optkey == 'delimiter') {
$my_prefs['delimiter'] = $optval;
} }
if (empty($auth_method)) {
$auth_method = "plain";
} }
} }
if (empty($auth_method))
$auth_method = 'plain';
$message = "INITIAL: $auth_method\n"; $message = "INITIAL: $auth_method\n";
$result = false; $result = false;
@ -2138,9 +2147,15 @@ function iil_C_Move(&$conn, $messages, $from, $to) {
* @see iil_Connect() * @see iil_Connect()
*/ */
function iil_C_GetHierarchyDelimiter(&$conn) { function iil_C_GetHierarchyDelimiter(&$conn) {
global $my_prefs;
if ($conn->delimiter) { if ($conn->delimiter) {
return $conn->delimiter; return $conn->delimiter;
} }
if (!empty($my_prefs['delimiter'])) {
return ($conn->delimiter = $my_prefs['delimiter']);
}
$fp = $conn->fp; $fp = $conn->fp;
$delimiter = false; $delimiter = false;

Loading…
Cancel
Save