Changeset 2143 in subversion


Ignore:
Timestamp:
Dec 11, 2008 3:30:00 AM (4 years ago)
Author:
alec
Message:
  • Performance: allow setting imap rootdir and delimiter before connect (#1485172)
Location:
trunk/roundcubemail
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r2132 r2143  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42008/12/11 (alec) 
     5---------- 
     6- Performance: allow setting imap rootdir and delimiter before connect (#1485172) 
    37 
    482008/12/06 (alec) 
  • trunk/roundcubemail/UPGRADING

    r2024 r2143  
    1919   the latter one, you have to temporary set 'enable_installer' to true 
    2020   in your local config/main.inc.php file. 
     21   WARNING: If you don't know what is IMAP root directory, set imap_root option to NULL 
    21223. Let the update script/installer check your configuration and 
    2223   update your config files as suggested by the updater. 
  • trunk/roundcubemail/config/main.inc.php.dist

    r2115 r2143  
    6262$rcmail_config['imap_auth_type'] = null; 
    6363 
     64// If you know your imap's root directory and its folder delimiter, 
     65// you can specify them here. Otherwise they will be determined 
     66// during every imap connection. 
     67$rcmail_config['imap_root'] = null; 
     68$rcmail_config['imap_delimiter'] = null; 
     69 
    6470// Automatically add this domain to user names for login 
    6571// Only for IMAP servers that require full e-mail addresses for login 
     
    152158// use this name to compose page titles 
    153159$rcmail_config['product_name'] = 'RoundCube Webmail'; 
    154  
    155 // only list folders within this path 
    156 $rcmail_config['imap_root'] = ''; 
    157160 
    158161// store draft message is this mailbox 
  • trunk/roundcubemail/program/include/rcmail.php

    r2060 r2143  
    516516    $this->imap->set_charset($this->config->get('default_charset', RCMAIL_CHARSET)); 
    517517 
    518     // set root dir from config 
    519     if ($imap_root = $this->config->get('imap_root')) { 
    520       $this->imap->set_rootdir($imap_root); 
    521     } 
    522518    if ($default_folders = $this->config->get('default_imap_folders')) { 
    523519      $this->imap->set_default_mailboxes($default_folders); 
  • trunk/roundcubemail/program/lib/imap.inc

    r2096 r2143  
    7474                - allow iil_C_HandlePartBody() to fetch whole message 
    7575                - optimize iil_C_FetchHeaders() to use only one FETCH command 
     76                - added 4th argument to iil_Connect() 
     77                - allow setting rootdir and delimiter before connect 
    7678 
    7779********************************************************/ 
     
    197199 
    198200function iil_PutLine($fp, $string, $endln=true) { 
    199 //      console('C: '. rtrim($string)); 
     201      console('C: '. rtrim($string)); 
    200202        return fputs($fp, $string . ($endln ? "\r\n" : '')); 
    201203} 
     
    477479function iil_C_NameSpace(&$conn) { 
    478480        global $my_prefs; 
     481 
     482        if (isset($my_prefs['rootdir']) && is_string($my_prefs['rootdir'])) { 
     483                $conn->rootdir = $my_prefs['rootdir']; 
     484                return true; 
     485        } 
    479486         
    480487        if (!iil_C_GetCapability($conn, 'NAMESPACE')) { 
    481488            return false; 
    482         } 
    483      
    484         if ($my_prefs["rootdir"]) { 
    485             return true; 
    486489        } 
    487490     
     
    511514        $conn->rootdir       = $first_userspace[0]; 
    512515        $conn->delimiter     = $first_userspace[1]; 
    513         $my_prefs["rootdir"] = substr($conn->rootdir, 0, -1); 
     516        $my_prefs['rootdir'] = substr($conn->rootdir, 0, -1); 
     517        $my_prefs['delimiter'] = $conn->delimiter; 
    514518         
    515519        return true; 
    516520} 
    517521 
    518 function iil_Connect($host, $user, $password) {  
     522function iil_Connect($host, $user, $password, $options=null) {   
    519523        global $iil_error, $iil_errornum; 
    520524        global $ICL_SSL, $ICL_PORT; 
     
    524528        $iil_error = ''; 
    525529        $iil_errornum = 0; 
    526          
    527         //set auth method 
    528         $auth_method = 'plain'; 
    529         if (func_num_args() >= 4) { 
    530                 $auth_array = func_get_arg(3); 
    531                 if (is_array($auth_array)) { 
    532                         $auth_method = $auth_array['imap']; 
    533                 } 
    534                 if (empty($auth_method)) { 
    535                         $auth_method = "plain"; 
    536                 } 
    537         } 
     530 
     531        // set some imap options 
     532        if (is_array($options)) { 
     533                foreach($options as $optkey => $optval) { 
     534                        if ($optkey == 'imap') { 
     535                                $auth_method = $optval; 
     536                        } else if ($optkey == 'rootdir') { 
     537                                $my_prefs['rootdir'] = $optval; 
     538                        } else if ($optkey == 'delimiter') { 
     539                                $my_prefs['delimiter'] = $optval; 
     540                        } 
     541                } 
     542        } 
     543 
     544        if (empty($auth_method)) 
     545                $auth_method = 'plain'; 
     546                 
    538547        $message = "INITIAL: $auth_method\n"; 
    539548                 
     
    21392148 */ 
    21402149function iil_C_GetHierarchyDelimiter(&$conn) { 
     2150 
     2151        global $my_prefs; 
     2152         
    21412153        if ($conn->delimiter) { 
    2142         return $conn->delimiter; 
     2154                return $conn->delimiter; 
     2155        } 
     2156        if (!empty($my_prefs['delimiter'])) { 
     2157            return ($conn->delimiter = $my_prefs['delimiter']); 
    21432158        } 
    21442159     
Note: See TracChangeset for help on using the changeset viewer.