alecpl
2010-10-25 2b42838427c887c8704afd033e5f17172216f82f
- Simplify some code, add some comments


2 files modified
61 ■■■■■ changed files
program/include/rcube_imap.php 5 ●●●●● patch | view | raw | blame | history
program/include/rcube_imap_generic.php 56 ●●●●● patch | view | raw | blame | history
program/include/rcube_imap.php
@@ -163,8 +163,9 @@
            }
            // get server properties
            if (!empty($this->conn->rootdir))
                $this->set_rootdir($this->conn->rootdir);
            $rootdir = $this->conn->getRootDir();
            if (!empty($rootdir))
                $this->set_rootdir($rootdir);
            if (empty($this->delimiter))
                $this->get_hierarchy_delimiter();
program/include/rcube_imap_generic.php
@@ -86,8 +86,6 @@
    public $error;
    public $errornum;
    public $message;
    public $rootdir;
    public $delimiter;
    public $data = array();
    public $flags = array(
        'SEEN'     => '\\Seen',
@@ -128,6 +126,14 @@
    {
    }
    /**
     * Send simple (one line) command to the connection stream
     *
     * @param string $string Command string
     * @param bool   $endln  True if CRLF need to be added at the end of command
     *
     * @param int Number of bytes sent, False on error
     */
    function putLine($string, $endln=true)
    {
        if (!$this->fp)
@@ -147,7 +153,15 @@
        return $res;
    }
    // $this->putLine replacement with Command Continuation Requests (RFC3501 7.5) support
    /**
     * Send command to the connection stream with Command Continuation
     * Requests (RFC3501 7.5) and LITERAL+ (RFC2088) support
     *
     * @param string $string Command string
     * @param bool   $endln  True if CRLF need to be added at the end of command
     *
     * @param int Number of bytes sent, False on error
     */
    function putLineC($string, $endln=true)
    {
        if (!$this->fp)
@@ -534,11 +548,15 @@
        return $code;
    }
    /**
     * Gets the root directory and delimiter (of personal namespace)
     *
     * @return mixed A root directory name, or false.
     */
    function getRootDir()
    {
        if (isset($this->prefs['rootdir']) && is_string($this->prefs['rootdir'])) {
            $this->rootdir = $this->prefs['rootdir'];
            return true;
            return $this->prefs['rootdir'];
        }
        if (!is_array($data = $this->getNamespace())) {
@@ -555,12 +573,11 @@
            return false;
        }
        $this->rootdir            = $first_userspace[0];
        $this->delimiter          = $first_userspace[1];
        $this->prefs['rootdir']   = substr($this->rootdir, 0, -1);
        $this->prefs['delimiter'] = $this->delimiter;
        $rootdir                  = $first_userspace[0];
        $this->prefs['delimiter'] = $first_userspace[1];
        $this->prefs['rootdir']   = $rootdir ? substr($rootdir, 0, -1) : '';
        return true;
        return $this->prefs['rootdir'];
    }
    /**
@@ -574,11 +591,11 @@
     */
    function getHierarchyDelimiter()
    {
        if ($this->delimiter) {
            return $this->delimiter;
        if ($this->prefs['delimiter']) {
            return $this->prefs['delimiter'];
        }
        if (!empty($this->prefs['delimiter'])) {
            return ($this->delimiter = $this->prefs['delimiter']);
            return $this->prefs['delimiter'];
        }
        // try (LIST "" ""), should return delimiter (RFC2060 Sec 6.3.8)
@@ -590,8 +607,7 @@
            $delimiter = $args[3];
            if (strlen($delimiter) > 0) {
                $this->delimiter = $delimiter;
                return $delimiter;
                return ($this->prefs['delimiter'] = $delimiter);
            }
        }
@@ -614,7 +630,7 @@
        }
        // extract delimiter
        return $this->delimiter = $first_userspace[1];
        return $this->prefs['delimiter'] = $first_userspace[1];
    }
    /**
@@ -1845,11 +1861,11 @@
        if (empty($mailbox)) {
            $mailbox = '*';
        }
        if (empty($ref) && $this->rootdir) {
            $ref = $this->rootdir;
/*
        if (empty($ref) && $this->prefs['rootdir']) {
            $ref = $this->prefs['rootdir'];
        }
*/
        $args = array($this->escape($ref), $this->escape($mailbox));
        if (!empty($status_opts) && $this->getCapability('LIST-STATUS')) {