commit | author | age
|
15a9d1
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/check_recent.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 |
| Check for recent messages | |
|
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 |
|
5e3512
|
25 |
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) |
15a9d1
|
26 |
{ |
T |
27 |
$count = $IMAP->messagecount(); |
5e3512
|
28 |
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE); |
15a9d1
|
29 |
|
T |
30 |
$commands = sprintf("this.set_unread_count('%s', %d, true);\n", addslashes($mbox), $unread_count); |
|
31 |
$commands .= sprintf("this.set_env('messagecount', %d);\n", $count); |
|
32 |
$commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text()); |
58e360
|
33 |
$commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota()); |
T |
34 |
|
15a9d1
|
35 |
// add new message headers to list |
T |
36 |
$a_headers = array(); |
|
37 |
for ($i=$recent_count, $id=$count-$recent_count+1; $i>0; $i--, $id++) |
|
38 |
$a_headers[] = $IMAP->get_headers($id, NULL, FALSE); |
|
39 |
|
|
40 |
$commands .= rcmail_js_message_list($a_headers, TRUE); |
|
41 |
} |
|
42 |
|
|
43 |
if (strtoupper($mbox)!='INBOX' && $IMAP->messagecount('INBOX', 'RECENT')) |
|
44 |
$commands = sprintf("this.set_unread_count('INBOX', %d);\n", $IMAP->messagecount('INBOX', 'UNSEEN')); |
|
45 |
|
|
46 |
|
|
47 |
rcube_remote_response($commands); |
58e360
|
48 |
?> |