source: github/program/steps/mail/getunread.inc @ 7fe3811

HEADcourier-fixdev-browser-capabilitiespdorelease-0.8
Last change on this file since 7fe3811 was 7fe3811, checked in by thomascube <thomas@…>, 17 months ago

Changed license to GNU GPLv3+ with exceptions for skins and plugins

  • Property mode set to 100644
File size: 1.9 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 |                                                                       |
10 | Licensed under the GNU General Public License version 3 or            |
11 | any later version with exceptions for skins & plugins.                |
12 | See the README file for a full license statement.                     |
13 |                                                                       |
14 | PURPOSE:                                                              |
15 |   Check all mailboxes for unread messages and update GUI              |
16 |                                                                       |
17 +-----------------------------------------------------------------------+
18 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
19 +-----------------------------------------------------------------------+
20
21 $Id$
22
23*/
24
25$a_folders = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail');
26
27if (!empty($a_folders))
28{
29  $current = $RCMAIL->storage->get_folder();
30  $inbox = ($current == 'INBOX');
31  $check_all = (bool)$RCMAIL->config->get('check_all_folders');
32
33  foreach ($a_folders as $mbox_row) {
34    $unseen_old = rcmail_get_unseen_count($mbox_row);
35
36    if (!$check_all && $unseen_old !== null && $mbox_row != $current)
37      $unseen = $unseen_old;
38    else
39      $unseen = $RCMAIL->storage->count($mbox_row, 'UNSEEN', $unseen_old === null);
40
41    if ($unseen || $unseen_old === null) {
42      $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX');
43    }
44
45    rcmail_set_unseen_count($mbox_row, $unseen);
46  }
47}
48
49$OUTPUT->send();
50
51
Note: See TracBrowser for help on using the repository browser.