From 0344b168276f80189e2254c75a762aff5b517b6b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 06:32:57 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 program/lib/Roundcube/rcube_imap.php |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 575d13c..0d92273 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -936,7 +936,7 @@
 
     /**
      * protected method for setting threaded messages flags:
-     * depth, has_children and unread_children
+     * depth, has_children, unread_children, flagged_children
      *
      * @param array               $headers  Reference to headers array indexed by message UID
      * @param rcube_result_thread $threads  Threads data object
@@ -955,8 +955,12 @@
 
             if (!empty($parents)) {
                 $headers[$uid]->parent_uid = end($parents);
-                if (empty($header->flags['SEEN']))
+                if (empty($header->flags['SEEN'])) {
                     $headers[$parents[0]]->unread_children++;
+                }
+                if (!empty($header->flags['FLAGGED'])) {
+                    $headers[$parents[0]]->flagged_children++;
+                }
             }
             array_push($parents, $uid);
 
@@ -2811,7 +2815,7 @@
         }
 
         // INBOX should always be available
-        if ((!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) {
+        if (!strlen($root) && (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) {
             array_unshift($a_mboxes, 'INBOX');
         }
 
@@ -2942,7 +2946,7 @@
         }
 
         // INBOX should always be available
-        if ((!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) {
+        if (!strlen($root) && (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) {
             array_unshift($a_mboxes, 'INBOX');
         }
 
@@ -3304,6 +3308,12 @@
     public function get_special_folders($forced = false)
     {
         $result = parent::get_special_folders();
+        $rcube  = rcube::get_instance();
+
+        // Lock SPECIAL-USE after user preferences change (#4782)
+        if ($rcube->config->get('lock_special_folders')) {
+            return $result;
+        }
 
         if (isset($this->icache['special-use'])) {
             return array_merge($result, $this->icache['special-use']);
@@ -4278,7 +4288,7 @@
             $this->clear_cache('mailboxes', true);
         }
 
-        return $updated == count($folders) ? true : false;
+        return $updated == count($folders);
     }
 
     /**

--
Gitblit v1.9.1