From 4e6e5d2d339f027a24afb23933016f29720cff6b Mon Sep 17 00:00:00 2001 From: cigamit Date: Fri, 25 Mar 2005 06:00:45 +0000 Subject: [PATCH] Update message copy and move functions to allow for custom handling / ignoring of the error messages. 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 | 2 ++ functions/imap_messages.php | 14 ++++++++------ plugins/filters/filters.php | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82068bb1..36afc1b2 100644 --- 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 -------------------- diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 7f461487..84f9e634 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -20,11 +20,12 @@ * @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; diff --git a/plugins/filters/filters.php b/plugins/filters/filters.php index 51823f0d..8f94a719 100644 --- a/plugins/filters/filters.php +++ b/plugins/filters/filters.php @@ -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); } } } -- 2.25.1