thomascube
2006-01-13 be2380fb47b05a222ec5b22deff36d5156a8c943
commit | author | age
15a9d1 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/mail/folders.inc                                        |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
8  | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Implement folder operations line EXPUNGE and Clear                  |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
18  $Id$
19
20 */
21
22 $REMOTE_REQUEST = TRUE;
23 $mbox = $IMAP->get_mailbox_name();
24
25
26 // send EXPUNGE command
27 if ($_action=='expunge')
28   {
29   $success = $IMAP->expunge();
30
31   // reload message list if current mailbox  
32   if ($success && $_GET['_reload'])
33     {
34     rcube_remote_response('this.clear_message_list();', TRUE);
35     $_action = 'list';
36     return;
37     }
38   else
39     $commands = "// expunged: $success\n";
40   }
41
42 // clear mailbox
43 else if ($_action=='purge')
44   {
45   $success = $IMAP->clear_mailbox();
46   
47   if ($success && $_GET['_reload'])
48     {
49     $commands = "this.set_env('messagecount', 0);\n";
50     $commands .= "this.set_env('pagecount', 0);\n";
51     $commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text());
52     $commands .= sprintf("this.set_unread_count('%s', 0);\n", addslashes($mbox));
53     }
54   else
55     $commands = "// purged: $success";
56   }
57
58
59
60 rcube_remote_response($commands);
61 ?>