Changeset 4130 in subversion


Ignore:
Timestamp:
Oct 25, 2010 5:11:49 AM (3 years ago)
Author:
alec
Message:
  • Simplify some code, add some comments
Location:
trunk/roundcubemail/program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_imap.php

    r4118 r4130  
    164164 
    165165            // get server properties 
    166             if (!empty($this->conn->rootdir)) 
    167                 $this->set_rootdir($this->conn->rootdir); 
     166            $rootdir = $this->conn->getRootDir(); 
     167            if (!empty($rootdir)) 
     168                $this->set_rootdir($rootdir); 
    168169            if (empty($this->delimiter)) 
    169170                    $this->get_hierarchy_delimiter(); 
  • trunk/roundcubemail/program/include/rcube_imap_generic.php

    r4129 r4130  
    8787    public $errornum; 
    8888        public $message; 
    89         public $rootdir; 
    90         public $delimiter; 
    9189    public $data = array(); 
    9290    public $flags = array( 
     
    129127    } 
    130128 
     129    /** 
     130     * Send simple (one line) command to the connection stream 
     131     * 
     132     * @param string $string Command string 
     133     * @param bool   $endln  True if CRLF need to be added at the end of command 
     134     * 
     135     * @param int Number of bytes sent, False on error 
     136     */ 
    131137    function putLine($string, $endln=true) 
    132138    { 
     
    148154    } 
    149155 
    150     // $this->putLine replacement with Command Continuation Requests (RFC3501 7.5) support 
     156    /** 
     157     * Send command to the connection stream with Command Continuation 
     158     * Requests (RFC3501 7.5) and LITERAL+ (RFC2088) support 
     159     * 
     160     * @param string $string Command string 
     161     * @param bool   $endln  True if CRLF need to be added at the end of command 
     162     * 
     163     * @param int Number of bytes sent, False on error 
     164     */ 
    151165    function putLineC($string, $endln=true) 
    152166    { 
     
    535549    } 
    536550 
     551    /** 
     552     * Gets the root directory and delimiter (of personal namespace) 
     553     * 
     554     * @return mixed A root directory name, or false. 
     555     */ 
    537556    function getRootDir() 
    538557    { 
    539558            if (isset($this->prefs['rootdir']) && is_string($this->prefs['rootdir'])) { 
    540                 $this->rootdir = $this->prefs['rootdir']; 
    541                     return true; 
     559                return $this->prefs['rootdir']; 
    542560            } 
    543561 
     
    552570 
    553571            $first_userspace = $user_space_data[0]; 
    554             if (count($first_userspace) !=2 ) { 
     572            if (count($first_userspace) !=2) { 
    555573                return false; 
    556574            } 
    557575 
    558             $this->rootdir            = $first_userspace[0]; 
    559             $this->delimiter          = $first_userspace[1]; 
    560             $this->prefs['rootdir']   = substr($this->rootdir, 0, -1); 
    561             $this->prefs['delimiter'] = $this->delimiter; 
    562  
    563             return true; 
     576        $rootdir                  = $first_userspace[0]; 
     577            $this->prefs['delimiter'] = $first_userspace[1]; 
     578            $this->prefs['rootdir']   = $rootdir ? substr($rootdir, 0, -1) : ''; 
     579 
     580            return $this->prefs['rootdir']; 
    564581    } 
    565582 
     
    575592    function getHierarchyDelimiter() 
    576593    { 
    577             if ($this->delimiter) { 
    578                 return $this->delimiter; 
     594            if ($this->prefs['delimiter']) { 
     595                return $this->prefs['delimiter']; 
    579596            } 
    580597            if (!empty($this->prefs['delimiter'])) { 
    581             return ($this->delimiter = $this->prefs['delimiter']); 
     598            return $this->prefs['delimiter']; 
    582599            } 
    583600 
     
    591608 
    592609                if (strlen($delimiter) > 0) { 
    593                     $this->delimiter = $delimiter; 
    594                     return $delimiter; 
     610                    return ($this->prefs['delimiter'] = $delimiter); 
    595611                } 
    596612        } 
     
    615631 
    616632            // extract delimiter 
    617             return $this->delimiter = $first_userspace[1]; 
     633            return $this->prefs['delimiter'] = $first_userspace[1]; 
    618634    } 
    619635 
     
    18461862                $mailbox = '*'; 
    18471863            } 
    1848  
    1849             if (empty($ref) && $this->rootdir) { 
    1850                 $ref = $this->rootdir; 
    1851             } 
    1852  
     1864/* 
     1865            if (empty($ref) && $this->prefs['rootdir']) { 
     1866                $ref = $this->prefs['rootdir']; 
     1867            } 
     1868*/ 
    18531869        $args = array($this->escape($ref), $this->escape($mailbox)); 
    18541870 
Note: See TracChangeset for help on using the changeset viewer.