- // only do the noselect test if !uw, is checked later. FIX ME see conf.pl setting
- if ($imap_server_type != "uw") {
- $noselect = check_is_noselect($lsub_ary[$i]);
- $noinferiors = check_is_noinferiors($lsub_ary[$i]);
- }
- if (substr($mbx, -1) == $delimiter) {
- $mbx = substr($mbx, 0, strlen($mbx) - 1);
- }
- $sorted_lsub_ary[] = array ('mbx' => $mbx, 'noselect' => $noselect, 'noinferiors' => $noinferiors);
- }
- // FIX ME this requires a config setting inside conf.pl instead of checking on server type
- if ($imap_server_type == "uw") {
- $aQuery = array();
- $aTag = array();
- // prepare an array with queries
- foreach ($sorted_lsub_ary as $aMbx) {
- $mbx = stripslashes($aMbx['mbx']);
- sqimap_prepare_pipelined_query('LIST "" ' . sqimap_encode_mailbox_name($mbx), $tag, $aQuery, false);
- $aTag[$tag] = $mbx;
- }
- $sorted_lsub_ary = array();
- // execute all the queries at once
- $aResponse = sqimap_run_pipelined_command ($imap_stream, $aQuery, false, $aServerResponse, $aServerMessage);
- foreach($aTag as $tag => $mbx) {
- if ($aServerResponse[$tag] == 'OK') {
- $sResponse = implode('', $aResponse[$tag]);
- $noselect = check_is_noselect($sResponse);
- $noinferiors = check_is_noinferiors($sResponse);
- $sorted_lsub_ary[] = array ('mbx' => $mbx, 'noselect' => $noselect, 'noinferiors' => $noinferiors);
- }
- }
- $cnt = count($sorted_lsub_ary);
- }
- $sorted_lsub_ary = array_values($sorted_lsub_ary);
- array_multisort($sorted_lsub_ary, SORT_ASC, SORT_REGULAR);
- $boxesnew = sqimap_fill_mailbox_tree($sorted_lsub_ary,false,$imap_stream);
- return $boxesnew;
- }