Changeset 4344 in subversion


Ignore:
Timestamp:
Dec 17, 2010 4:16:47 AM (2 years ago)
Author:
alec
Message:
  • Make possible to overwrite server's namespaces with imap_ns_* options
Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/config/main.inc.php.dist

    r4296 r4344  
    8484// Folders need to be ended with directory separator, e.g. "INBOX." 
    8585// (special directory "~" is an exception to this rule) 
     86// These can be used also to overwrite server's namespaces 
    8687$rcmail_config['imap_ns_personal'] = null; 
    8788$rcmail_config['imap_ns_other']    = null; 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r4340 r4344  
    547547        $imap_delimiter = $config->get('imap_delimiter'); 
    548548 
    549         if ($imap_delimiter) { 
    550             $this->delimiter = $imap_delimiter; 
    551         } 
    552  
    553549        if (!$this->conn) 
    554550            return; 
     
    556552        $ns = $this->conn->getNamespace(); 
    557553 
    558         // NAMESPACE supported 
     554        // Set namespaces (NAMESPACE supported) 
    559555        if (is_array($ns)) { 
    560556            $this->namespace = $ns; 
    561  
    562             if (empty($this->delimiter)) 
    563                 $this->delimiter = $ns['personal'][0][1]; 
    564             if (empty($this->delimiter)) 
    565                 $this->delimiter = $this->conn->getHierarchyDelimiter(); 
    566             if (empty($this->delimiter)) 
    567                 $this->delimiter = '/'; 
    568         } 
    569         // not supported, get namespace from config 
    570         else if ($imap_personal !== null || $imap_shared !== null || $imap_other !== null) { 
    571             if (empty($this->delimiter)) 
    572                 $this->delimiter = $this->conn->getHierarchyDelimiter(); 
    573             if (empty($this->delimiter)) 
    574                 $this->delimiter = '/'; 
    575  
     557        } 
     558        else { 
    576559            $this->namespace = array( 
    577560                'personal' => NULL, 
     
    579562                'shared'   => NULL, 
    580563            ); 
    581  
    582             if ($imap_personal !== null) { 
    583                 foreach ((array)$imap_personal as $dir) { 
    584                     $this->namespace['personal'][] = array($dir, $this->delimiter); 
     564        } 
     565 
     566        if ($imap_delimiter) { 
     567            $this->delimiter = $imap_delimiter; 
     568        } 
     569        if (empty($this->delimiter)) { 
     570            $this->delimiter = $this->namespace['personal'][0][1]; 
     571        } 
     572        if (empty($this->delimiter)) { 
     573            $this->delimiter = $this->conn->getHierarchyDelimiter(); 
     574        } 
     575        if (empty($this->delimiter)) { 
     576            $this->delimiter = '/'; 
     577        } 
     578 
     579        // Overwrite namespaces 
     580        if ($imap_personal !== null) { 
     581            $this->namespace['personal'] = NULL; 
     582            foreach ((array)$imap_personal as $dir) { 
     583                $this->namespace['personal'][] = array($dir, $this->delimiter); 
     584            } 
     585        } 
     586        if ($imap_other !== null) { 
     587            $this->namespace['other'] = NULL; 
     588            foreach ((array)$imap_other as $dir) { 
     589                if ($dir) { 
     590                    $this->namespace['other'][] = array($dir, $this->delimiter); 
    585591                } 
    586592            } 
    587             if ($imap_other !== null) { 
    588                 foreach ((array)$imap_other as $dir) { 
    589                     if ($dir) { 
    590                         $this->namespace['other'][] = array($dir, $this->delimiter); 
    591                     } 
    592                 } 
    593             } 
    594             if ($imap_shared !== null) { 
    595                 foreach ((array)$imap_shared as $dir) { 
    596                     if ($dir) { 
    597                         $this->namespace['shared'][] = array($dir, $this->delimiter); 
    598                     } 
     593        } 
     594        if ($imap_shared !== null) { 
     595            $this->namespace['shared'] = NULL; 
     596            foreach ((array)$imap_shared as $dir) { 
     597                if ($dir) { 
     598                    $this->namespace['shared'][] = array($dir, $this->delimiter); 
    599599                } 
    600600            } 
Note: See TracChangeset for help on using the changeset viewer.