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 | |
f11541
|
8 |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
15a9d1
|
9 |
| Licensed under the GNU GPL | |
T |
10 |
| | |
|
11 |
| PURPOSE: | |
c8c1e0
|
12 |
| Check for recent messages, in all mailboxes | |
15a9d1
|
13 |
| | |
T |
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
c8c1e0
|
18 |
$Id: check_recent.inc 233 2006-06-26 17:31:20Z richs $ |
15a9d1
|
19 |
|
T |
20 |
*/ |
|
21 |
|
c8c1e0
|
22 |
$a_mailboxes = $IMAP->list_mailboxes(); |
S |
23 |
|
|
24 |
foreach ($a_mailboxes as $mbox_name) |
15a9d1
|
25 |
{ |
c8c1e0
|
26 |
if ($mbox_name == $IMAP->get_mailbox_name()) |
S |
27 |
{ |
|
28 |
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) |
|
29 |
{ |
110748
|
30 |
// refresh saved search set |
T |
31 |
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) |
|
32 |
$_SESSION['search'][$search_request] = $IMAP->refresh_search(); |
|
33 |
|
|
34 |
$count_all = $IMAP->messagecount(NULL, 'ALL', TRUE); |
c8c1e0
|
35 |
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE); |
S |
36 |
|
110748
|
37 |
$OUTPUT->set_env('messagecount', $IMAP->messagecount()); |
095d05
|
38 |
$OUTPUT->set_env('pagesize', $IMAP->page_size); |
A |
39 |
$OUTPUT->set_env('pagecount', ceil($IMAP->messagecount()/$IMAP->page_size)); |
cf1f0f
|
40 |
$OUTPUT->command('set_unread_count', $mbox_name, $unread_count, ($mbox_name == 'INBOX')); |
f11541
|
41 |
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text()); |
6d2714
|
42 |
$OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota())); |
c8c1e0
|
43 |
|
06343d
|
44 |
if (rcmail::get_instance()->config->get('focus_on_new_message',true)) |
A |
45 |
$OUTPUT->command('new_message_focus'); |
|
46 |
|
c8c1e0
|
47 |
// add new message headers to list |
S |
48 |
$a_headers = array(); |
110748
|
49 |
for ($i=$recent_count, $id=$count_all-$recent_count+1; $i>0; $i--, $id++) |
c4e7e4
|
50 |
{ |
110748
|
51 |
// skip message if it does not match the current search |
T |
52 |
if (!$IMAP->in_searchset($id)) |
|
53 |
continue; |
|
54 |
|
c4e7e4
|
55 |
$header = $IMAP->get_headers($id, NULL, FALSE); |
T |
56 |
if ($header->recent) |
|
57 |
$a_headers[] = $header; |
|
58 |
} |
c8c1e0
|
59 |
|
f11541
|
60 |
rcmail_js_message_list($a_headers, TRUE); |
c8c1e0
|
61 |
} |
S |
62 |
} |
|
63 |
else |
|
64 |
{ |
|
65 |
if ($IMAP->messagecount($mbox_name, 'RECENT')) |
f11541
|
66 |
$OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN')); |
c8c1e0
|
67 |
} |
15a9d1
|
68 |
} |
T |
69 |
|
f11541
|
70 |
$OUTPUT->send(); |
T |
71 |
|
58e360
|
72 |
?> |