From d42310bdcc5172640b392525b8d8a61c74a3547b Mon Sep 17 00:00:00 2001 From: stekkel Date: Fri, 18 Oct 2002 10:50:12 +0000 Subject: [PATCH] speed improvements mailbox_list. Need testing before we release! git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3908 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index b220ee6f..7a41b92c 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -76,6 +76,8 @@ function sortSpecialMbx($a, $b) { } function find_mailbox_name ($mailbox) { + if (preg_match('/\*.+\"([^\r\n\"]*)\"[\s\r\n]*$/', $mailbox, $regs)) + return $regs[1]; if (ereg(" *\"([^\r\n\"]*)\"[ \r\n]*$", $mailbox, $regs)) return $regs[1]; ereg(" *([^ \r\n\"]*)[ \r\n]*$",$mailbox,$regs); @@ -402,6 +404,8 @@ function sqimap_mailbox_parse ($line, $line_lsub) { function user_strcasecmp($a, $b) { global $delimiter; + return strnatcasecmp($a, $b); + /* Calculate the length of some strings. */ $a_length = strlen($a); $b_length = strlen($b); @@ -409,8 +413,7 @@ function user_strcasecmp($a, $b) { $delimiter_length = strlen($delimiter); /* Set the initial result value. */ - $result = 0; - + $result = 0; /* Check the strings... */ for ($c = 0; $c < $min_length; ++$c) { $a_del = substr($a, $c, $delimiter_length); @@ -508,10 +511,11 @@ function sqimap_mailbox_list($imap_stream) { if (isset($sorted_lsub_ary)) { usort($sorted_lsub_ary, 'user_strcasecmp'); } - + $sorted_list_ary = $sorted_lsub_ary; /* LIST array */ - $sorted_list_ary = array(); - for ($i=0; $i < count($sorted_lsub_ary); $i++) { +// $sorted_list_ary = array(); +// for ($i=0; $i < count($sorted_lsub_ary); $i++) { + if (false) { if (substr($sorted_lsub_ary[$i], -1) == $delimiter) { $mbx = substr($sorted_lsub_ary[$i], 0, strlen($sorted_lsub_ary[$i])-1); } @@ -544,12 +548,12 @@ function sqimap_mailbox_list($imap_stream) { $inbox_in_list = true; } } - +// $inbox_in_list = true; /* * Just in case they're not subscribed to their inbox, * we'll get it for them anyway */ - if (!$inbox_subscribed || !$inbox_in_list) { + if (!$inbox_subscribed) {// || !$inbox_in_list) { $inbox_ary = sqimap_run_command ($imap_stream, "LIST \"\" \"INBOX\"", true, $response, $message); /* Another workaround for EIMS */ -- 2.25.1