commit | author | age
|
15a9d1
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/getunread.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
A |
8 |
| Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | |
15a9d1
|
9 |
| Licensed under the GNU GPL | |
T |
10 |
| | |
|
11 |
| PURPOSE: | |
|
12 |
| Check all mailboxes for unread messages and update GUI | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
$a_folders = $IMAP->list_mailboxes(); |
|
23 |
|
|
24 |
if (!empty($a_folders)) |
f11541
|
25 |
{ |
70ee70
|
26 |
$current = $IMAP->get_mailbox_name(); |
A |
27 |
$inbox = ($current == 'INBOX'); |
|
28 |
$check_all = (bool)$RCMAIL->config->get('check_all_folders'); |
|
29 |
|
78925f
|
30 |
foreach ($a_folders as $mbox_row) { |
db1a87
|
31 |
$unseen_old = rcmail_get_unseen_count($mbox_row); |
78925f
|
32 |
|
db1a87
|
33 |
if (!$check_all && $unseen_old !== null && $mbox_row != $current) |
T |
34 |
$unseen = $unseen_old; |
|
35 |
else |
|
36 |
$unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', $unseen_old === null); |
|
37 |
|
|
38 |
if ($unseen || $unseen_old === null) { |
78925f
|
39 |
$OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX'); |
A |
40 |
} |
db1a87
|
41 |
|
T |
42 |
rcmail_set_unseen_count($mbox_row, $unseen); |
78925f
|
43 |
} |
f11541
|
44 |
} |
15a9d1
|
45 |
|
f11541
|
46 |
$OUTPUT->send(); |
78925f
|
47 |
|
b25dfd
|
48 |
|