[dev] Patch: imp/lib/Message.php
Marc Jauvin
marc at register4less.com
Thu Jun 19 19:06:54 PDT 2003
This fixes the bug when the mailbox is overquota and the user wants to
move deleted mail to a Trash Folder... In case this happens, the patched code
now deletes the mail and expunges the folder automatically.
This was only tested with Cyrus IMAP server...
--
Marc Jauvin
450-441-5458
http://register4less.com
-------------- next part --------------
Index: imp/lib/Message.php
===================================================================
RCS file: /repository/imp/lib/Message.php,v
retrieving revision 1.121
diff -u -r1.121 Message.php
--- imp/lib/Message.php 16 Jun 2003 13:56:53 -0000 1.121
+++ imp/lib/Message.php 20 Jun 2003 02:01:51 -0000
@@ -189,8 +189,20 @@
}
if (!@imap_mail_copy($imp['stream'], $msgIdxs, $trash, CP_UID | CP_MOVE)) {
- $notification->push(sprintf(_("There was an error moving messages to the trash. This is what the server said")) . ': ' .
imap_last_error(), 'horde.error');
- $return_value = false;
+ // handles the case when the mailbox is overquota (moving msg to trash would fail)
+ $last_error = imap_last_error();
+ if (preg_match('/over quota/i', $last_error)) {
+ if (!@imap_delete($imp['stream'], $msgIdxs, FT_UID)) {
+ $notification->push(sprintf(_("There was an error deleting messages from the folder \"%s\". This is what the ser
ver said"), IMP::displayFolder($folder)) . ': ' . imap_last_error(), 'horde.error');
+ $return_value = false;
+ } else {
+ @imap_expunge($imp['stream']);
+ $return_value = true;
+ }
+ } else {
+ $notification->push(sprintf(_("There was an error moving messages to the trash. This is what the server said")) . ':
' . $last_error, 'horde.error');
+ $return_value = false;
+ }
} else {
@imap_expunge($imp['stream']);
}
More information about the dev
mailing list