source: subversion/trunk/roundcubemail/program/steps/mail/getunread.inc @ 5781

Last change on this file since 5781 was 5781, checked in by thomasb, 16 months ago

Merged devel-framework branch (r5746:5779) back into trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/mail/getunread.inc                                      |
6 |                                                                       |
7 | This file is part of the Roundcube Webmail client                     |
8 | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
9 | Licensed under the GNU GPL                                            |
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 = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail');
23
24if (!empty($a_folders))
25{
26  $current = $RCMAIL->storage->get_folder();
27  $inbox = ($current == 'INBOX');
28  $check_all = (bool)$RCMAIL->config->get('check_all_folders');
29
30  foreach ($a_folders as $mbox_row) {
31    $unseen_old = rcmail_get_unseen_count($mbox_row);
32
33    if (!$check_all && $unseen_old !== null && $mbox_row != $current)
34      $unseen = $unseen_old;
35    else
36      $unseen = $RCMAIL->storage->count($mbox_row, 'UNSEEN', $unseen_old === null);
37
38    if ($unseen || $unseen_old === null) {
39      $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX');
40    }
41
42    rcmail_set_unseen_count($mbox_row, $unseen);
43  }
44}
45
46$OUTPUT->send();
47
48
Note: See TracBrowser for help on using the repository browser.