4 +-----------------------------------------------------------------------+
5 | program/steps/mail/folders.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Implement folder operations line EXPUNGE and Clear |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: folders.inc 1570 2008-06-24 13:04:57Z alec $
21 $mbox_name = $IMAP->get_mailbox_name();
23 // send EXPUNGE command
24 if ($RCMAIL->action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
26 $success = $IMAP->expunge($mbox);
28 // reload message list if current mailbox
29 if ($success && !empty($_REQUEST['_reload']))
31 $OUTPUT->command('message_list.clear');
32 $RCMAIL->action = 'list';
36 $commands = "// expunged: $success\n";
40 else if ($RCMAIL->action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
42 $delimiter = $IMAP->get_hierarchy_delimiter();
43 $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
44 $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/';
46 // we should only be purging trash and junk (or their subfolders)
47 if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
48 || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox))
50 $success = $IMAP->clear_mailbox($mbox);
52 if ($success && !empty($_REQUEST['_reload']))
54 $OUTPUT->set_env('messagecount', 0);
55 $OUTPUT->set_env('pagecount', 0);
56 $OUTPUT->command('message_list.clear');
57 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
58 $OUTPUT->command('set_unread_count', $mbox_name, 0);
61 $commands = "// purged: $success";
65 $OUTPUT->send($commands);