]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/steps/mail/folders.inc
Imported Upstream version 0.2~stable
[roundcube.git] / program / steps / mail / folders.inc
index d0825ffac891fb2e8539a217507ec919661c93b4..88e48b2116f6376fb2d93b658934cdb0920bf034 100644 (file)
@@ -15,7 +15,7 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: folders.inc 1344 2008-04-30 08:21:42Z thomasb $
+ $Id: folders.inc 1570 2008-06-24 13:04:57Z alec $
 */
 
 $mbox_name = $IMAP->get_mailbox_name();
@@ -39,8 +39,13 @@ if ($RCMAIL->action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_
 // clear mailbox
 else if ($RCMAIL->action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
 {
-  // we should only be purging trash and junk
-  if($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']) 
+  $delimiter = $IMAP->get_hierarchy_delimiter();
+  $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
+  $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/';                    
+
+  // we should only be purging trash and junk (or their subfolders)
+  if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
+    || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox))
   {
     $success = $IMAP->clear_mailbox($mbox);