From: stekkel Date: Fri, 5 Jul 2002 13:12:56 +0000 (+0000) Subject: modified sqimap_expunge to return the number of expunged messages and to X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=8f6505f601a203963f3256442e9d15b5edc3f29c modified sqimap_expunge to return the number of expunged messages and to give and optional id range to expunge. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3041 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 6bf64d2f..44e14a91 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -147,9 +147,23 @@ function isSpecialMailbox( $box ) { } /* Expunges a mailbox */ -function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true) { - $read = sqimap_run_command($imap_stream, 'EXPUNGE', $handle_errors, - $response, $message); +function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, $id='') { + global $uid_support; + if (isset($id)) { + if (is_array($id)) { + $id = sqimap_message_list_squisher($id); + } + $id = ' '.$id; + } + $read = sqimap_run_command($imap_stream, 'EXPUNGE$id', $handle_errors, + $response, $message, $uid_support); + $cnt = 0; + foreach ($read as $r) { + if (pregmatch('/^\*\s[0-9]+\sEXPUNGE/AUi',$r,$regs)) { + $cnt++; + } + } + return $cnt; } /* Checks whether or not the specified mailbox exists */