summaryrefslogtreecommitdiff
path: root/program/steps/mail/folders.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-06-24 13:04:57 +0000
committeralecpl <alec@alec.pl>2008-06-24 13:04:57 +0000
commitddd776b2a3a264777233410e4bb311233fd24d3c (patch)
tree15aedb73a344bf4c02e1c89e1f6d5f123f05a842 /program/steps/mail/folders.inc
parent0339e3cc6fcc0df6d0dcd9b434f3dff919adcf7f (diff)
- Allow trash/junk subfolders to be purged (#1485085)
Diffstat (limited to 'program/steps/mail/folders.inc')
-rw-r--r--program/steps/mail/folders.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc
index 69f3c0e4c..7fd1f62cc 100644
--- a/program/steps/mail/folders.inc
+++ b/program/steps/mail/folders.inc
@@ -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);