Changeset 5424 in subversion
- Timestamp:
- Nov 15, 2011 3:23:24 AM (19 months ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r5423 r5424 2 2 =========================== 3 3 4 - Fix listing of folders in hidden namespaces (#1486796) 4 5 - Don't consider \Noselect flag when building folders tree (#1488004) 5 6 - Fix sorting autocomplete results (#1488084) -
trunk/roundcubemail/program/include/rcube_imap.php
r5416 r5424 3005 3005 3006 3006 /** 3007 * Private method for mailbox listing 3007 * Private method for mailbox listing (LSUB) 3008 3008 * 3009 3009 * @param string $root Optional root folder … … 3012 3012 * @param string $rights Optional ACL requirements 3013 3013 * 3014 * @return array List of mailboxes/folders3014 * @return array List of subscribed folders 3015 3015 * @see rcube_imap::list_mailboxes() 3016 3016 * @access private … … 3115 3115 else { 3116 3116 // retrieve list of folders from IMAP server 3117 $a_mboxes = $this-> conn->listMailboxes($root, $name);3117 $a_mboxes = $this->_list_unsubscribed($root, $name); 3118 3118 } 3119 3119 … … 3146 3146 3147 3147 return $a_mboxes; 3148 } 3149 3150 3151 /** 3152 * Private method for mailbox listing (LIST) 3153 * 3154 * @param string $root Optional root folder 3155 * @param string $name Optional name pattern 3156 * 3157 * @return array List of folders 3158 * @see rcube_imap::list_unsubscribed() 3159 */ 3160 private function _list_unsubscribed($root='', $name='*') 3161 { 3162 $result = $this->conn->listMailboxes($root, $name); 3163 3164 if (!is_array($result)) { 3165 return array(); 3166 } 3167 3168 // #1486796: some server configurations doesn't 3169 // return folders in all namespaces, we'll try to detect that situation 3170 // and ask for these namespaces separately 3171 if ($root == '' && $name = '*') { 3172 $delim = $this->get_hierarchy_delimiter(); 3173 $namespace = $this->get_namespace(); 3174 $search = array(); 3175 3176 // build list of namespace prefixes 3177 foreach ((array)$namespace as $ns) { 3178 if (is_array($ns)) { 3179 foreach ($ns as $ns_data) { 3180 if ($len = strlen($ns_data[0])) { 3181 $search = array('len' => $len, 'prefix' => $ns_data[0]); 3182 } 3183 } 3184 } 3185 } 3186 3187 if (!empty($search)) { 3188 // go through all folders detecting namespace usage 3189 foreach ($list as $folder) { 3190 foreach ($search as $idx => $s) { 3191 if ($s['prefix'] == substr($folder, 0, $s['len'])) { 3192 unset($search[$idx]); 3193 } 3194 } 3195 if (empty($search)) { 3196 break; 3197 } 3198 } 3199 3200 // get folders in hidden namespaces and add to the result 3201 foreach ($search as $s) { 3202 $list = $this->conn->listMailboxes($s['prefix'], $name); 3203 3204 if (!empty($list)) { 3205 $result = array_merge($result, $list); 3206 } 3207 } 3208 } 3209 } 3210 3211 return $result; 3148 3212 } 3149 3213
Note: See TracChangeset
for help on using the changeset viewer.
