Pārlūkot izejas kodu

modified sqimap_expunge to return the number of expunged messages and to
give and optional id range to expunge.

stekkel 23 gadi atpakaļ
vecāks
revīzija
7a28df6a9e
1 mainītis faili ar 17 papildinājumiem un 3 dzēšanām
  1. 17 3
      functions/imap_mailbox.php

+ 17 - 3
functions/imap_mailbox.php

@@ -147,9 +147,23 @@ function isSpecialMailbox( $box ) {
 }
 }
 
 
 /* Expunges a mailbox */
 /* 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 */
 /* Checks whether or not the specified mailbox exists */