From ac0fc383fd43e8955b0ab22f70463159b14c74b0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 23 Dec 2013 11:33:41 +0100 Subject: Fix so message flags modified by another client are applied on the list on refresh (#1485186) --- program/lib/Roundcube/rcube_imap.php | 35 +++++++++++++++++++++++++++++++++ program/lib/Roundcube/rcube_storage.php | 12 +++++++++++ 2 files changed, 47 insertions(+) (limited to 'program/lib') diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index f1363caf7..4c3bf6fcd 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -679,6 +679,41 @@ class rcube_imap extends rcube_storage } + /** + * Public method for listing message flags + * + * @param string $folder Folder name + * @param array $uids Message UIDs + * @param int $mod_seq Optional MODSEQ value (of last flag update) + * + * @return array Indexed array with message flags + */ + public function list_flags($folder, $uids, $mod_seq = null) + { + if (!strlen($folder)) { + $folder = $this->folder; + } + + if (!$this->check_connection()) { + return array(); + } + + // @TODO: when cache was synchronized in this request + // we might already have asked for flag updates, use it. + + $flags = $this->conn->fetch($folder, $uids, true, array('FLAGS'), $mod_seq); + $result = array(); + + if (!empty($flags)) { + foreach ($flags as $message) { + $result[$message->uid] = $message->flags; + } + } + + return $result; + } + + /** * Public method for listing headers * diff --git a/program/lib/Roundcube/rcube_storage.php b/program/lib/Roundcube/rcube_storage.php index e697b2c73..ca65af1cb 100644 --- a/program/lib/Roundcube/rcube_storage.php +++ b/program/lib/Roundcube/rcube_storage.php @@ -359,6 +359,18 @@ abstract class rcube_storage abstract function count($folder = null, $mode = 'ALL', $force = false, $status = true); + /** + * Public method for listing message flags + * + * @param string $folder Folder name + * @param array $uids Message UIDs + * @param int $mod_seq Optional MODSEQ value + * + * @return array Indexed array with message flags + */ + abstract function list_flags($folder, $uids, $mod_seq = null); + + /** * Public method for listing headers. * -- cgit v1.2.3