From b6da0b76afb5697685c35b8584631294cfc7b12f Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Wed, 07 Dec 2011 05:41:15 -0500 Subject: [PATCH] - Remove deprecated global $IMAP variable usage (#1488148) --- program/steps/mail/getunread.inc | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc index a035f52..39880b9 100644 --- a/program/steps/mail/getunread.inc +++ b/program/steps/mail/getunread.inc @@ -5,7 +5,7 @@ | program/steps/mail/getunread.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | + | Copyright (C) 2005-2009, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -19,24 +19,27 @@ */ -$a_folders = $IMAP->list_mailboxes(); +$a_folders = $RCMAIL->imap->list_mailboxes('', '*', 'mail'); if (!empty($a_folders)) { - $current = $IMAP->get_mailbox_name(); + $current = $RCMAIL->imap->get_mailbox_name(); $inbox = ($current == 'INBOX'); $check_all = (bool)$RCMAIL->config->get('check_all_folders'); foreach ($a_folders as $mbox_row) { - if (!$check_all && isset($_SESSION['unseen_count'][$mbox_row]) && $mbox_row != $current) - $unseen = $_SESSION['unseen_count'][$mbox_row]; - else - $unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', !isset($_SESSION['unseen_count'][$mbox_row])); + $unseen_old = rcmail_get_unseen_count($mbox_row); - if ($unseen || !isset($_SESSION['unseen_count'][$mbox_row])) { + if (!$check_all && $unseen_old !== null && $mbox_row != $current) + $unseen = $unseen_old; + else + $unseen = $RCMAIL->imap->messagecount($mbox_row, 'UNSEEN', $unseen_old === null); + + if ($unseen || $unseen_old === null) { $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX'); } - $_SESSION['unseen_count'][$mbox_row] = $unseen; + + rcmail_set_unseen_count($mbox_row, $unseen); } } -- Gitblit v1.9.1