From b8ec18ef15e123c78598dcc5934967391de0487c Mon Sep 17 00:00:00 2001 From: stekkel Date: Thu, 6 Feb 2003 19:36:09 +0000 Subject: [PATCH] added RECENT response to result array of sqimap_get_status in order to remove an expensive select call in the newmail plugin. Probably the influences on speed when the newmail plugin is disabled are minimal. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4504 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_general.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/imap_general.php b/functions/imap_general.php index 4ff96041..12174f51 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -510,9 +510,9 @@ function sqimap_unseen_messages ($imap_stream, $mailbox) { * Returns the number of unseen/total messages in this folder */ function sqimap_status_messages ($imap_stream, $mailbox) { - $read_ary = sqimap_run_command ($imap_stream, "STATUS \"$mailbox\" (MESSAGES UNSEEN)", false, $result, $message); + $read_ary = sqimap_run_command ($imap_stream, "STATUS \"$mailbox\" (MESSAGES UNSEEN RECENT)", false, $result, $message); $i = 0; - $messages = $unseen = false; + $messages = $unseen = $recent = false; $regs = array(false,false); while (isset($read_ary[$i])) { if (preg_match('/UNSEEN\s+([0-9]+)/i', $read_ary[$i], $regs)) { @@ -521,9 +521,12 @@ function sqimap_status_messages ($imap_stream, $mailbox) { if (preg_match('/MESSAGES\s+([0-9]+)/i', $read_ary[$i], $regs)) { $messages = $regs[1]; } + if (preg_match('/RECENT\s+([0-9]+)/i', $read_ary[$i], $regs)) { + $recent = $regs[1]; + } $i++; } - return array('MESSAGES' => $messages, 'UNSEEN'=>$unseen); + return array('MESSAGES' => $messages, 'UNSEEN'=>$unseen, 'RECENT' => $recent); } -- 2.25.1