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

Last change on this file since 3167 was 3167, checked in by alec, 3 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
RevLine 
[93]1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/mail/getunread.inc                                      |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
[3163]8 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland                 |
[93]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 = $IMAP->list_mailboxes();
23
24if (!empty($a_folders))
[543]25{
[3163]26  $current = $IMAP->get_mailbox_name();
27  $inbox = ($current == 'INBOX');
28  $check_all = (bool)$RCMAIL->config->get('check_all_folders');
29
[2959]30  foreach ($a_folders as $mbox_row) {
[3163]31    if (!$check_all && isset($_SESSION['unseen_count'][$mbox_row]) && $mbox_row != $current)
[3167]32      $unseen = $_SESSION['unseen_count'][$mbox_row];
[3163]33    else
34      $unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', !isset($_SESSION['unseen_count'][$mbox_row]));
[2959]35
[2966]36    if ($unseen || !isset($_SESSION['unseen_count'][$mbox_row])) {
[2959]37      $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX');
38    }
[2966]39    $_SESSION['unseen_count'][$mbox_row] = $unseen;
[2959]40  }
[543]41}
[93]42
[543]43$OUTPUT->send();
[2959]44
[269]45?>
Note: See TracBrowser for help on using the repository browser.