Update message copy and move functions to allow for custom handling / ignoring of...
authorcigamit <cigamit@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 25 Mar 2005 06:00:45 +0000 (06:00 +0000)
committercigamit <cigamit@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 25 Mar 2005 06:00:45 +0000 (06:00 +0000)
This fixes a bug where users with exceeded quota's could not login when the filter plugin is actively filtering.

Currently user does not get an error if filtering failed (I am working on it) and it continues parsing the next filter even if fails (I have code for this, but don't think its necessary)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9133 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/imap_messages.php
plugins/filters/filters.php

index 82068bb199cc01d4ec59125336bc49c6650576ca..36afc1b29439f7b87a9bcb12a807e79d234b5381 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -273,6 +273,8 @@ Version 1.5.1 -- CVS
   - Strip position:absolute style from HTML mails.
   - Add ability to the Filters plugin to filter on Message Body, or both
     the Headers and the Message Body.
+  - Update the message copy and move functions to allow for error handling.
+  - Fix the filter plugin from halting the login process when copying errors occur
   
 Version 1.5.0
 --------------------
index 7f4614872f8ba91b1f77810e6df169ec4dae7fca..84f9e6341c5e730dc2306d4c3fd7ec94466b9d2b 100755 (executable)
  * @param int $imap_stream The resource ID for the IMAP socket
  * @param string $id The list of messages to copy
  * @param string $mailbox The destination to copy to
- * @return bool
+ * @param bool $handle_errors Show error messages in case of a NO, BAD or BYE response
+ * @return bool If the copy completed without errors  
  */
-function sqimap_msgs_list_copy($imap_stream, $id, $mailbox) {
+function sqimap_msgs_list_copy($imap_stream, $id, $mailbox, $handle_errors = true) {
     $msgs_id = sqimap_message_list_squisher($id);
-    $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, TRUE);
+    $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), $handle_errors, $response, $message, TRUE);
     if ($response == 'OK') {
         return true;
     } else {
@@ -38,11 +39,12 @@ function sqimap_msgs_list_copy($imap_stream, $id, $mailbox) {
  * @param int $imap_stream The resource ID for the IMAP socket
  * @param string $id The list of messages to move
  * @param string $mailbox The destination to move to
- * @return void
+ * @param bool $handle_errors Show error messages in case of a NO, BAD or BYE response
+ * @return bool If the move completed without errors
  */
-function sqimap_msgs_list_move($imap_stream, $id, $mailbox) {
+function sqimap_msgs_list_move($imap_stream, $id, $mailbox, $handle_errors = true) {
     $msgs_id = sqimap_message_list_squisher($id);
-    if (sqimap_msgs_list_copy ($imap_stream, $id, $mailbox)) {
+    if (sqimap_msgs_list_copy ($imap_stream, $id, $mailbox, $handle_errors)) {
         return sqimap_toggle_flag($imap_stream, $id, '\\Deleted', true, true);
     } else {
         return false;
index 51823f0d7e262fb2bce788d30113391971ac159d..8f94a7190261bce5ea88f5c90a2a8c774ba2ff6b 100644 (file)
@@ -323,7 +323,7 @@ function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_
         if ($response == 'OK' && count($ids)) {
             if (sqimap_mailbox_exists($imap_stream, $where_to)) {
                  $should_expunge = true;
-                 sqimap_msgs_list_move ($imap_stream, $ids, $where_to);
+                 sqimap_msgs_list_move ($imap_stream, $ids, $where_to, false);
             }
         }
     }