From 18a106538b757ec299f41e6704f68e430a8e1253 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 7 Jul 2014 12:23:47 +0200 Subject: [PATCH] Return the most recent message UID in case there are duplicates --- plugins/libkolab/lib/kolab_storage_cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php index 606c5d54..53b93545 100644 --- a/plugins/libkolab/lib/kolab_storage_cache.php +++ b/plugins/libkolab/lib/kolab_storage_cache.php @@ -917,7 +917,7 @@ class kolab_storage_cache $sql_result = $this->db->query( "SELECT msguid FROM $this->cache_table ". - "WHERE folder_id=? AND uid=?", + "WHERE folder_id=? AND uid=? ORDER BY msguid DESC", $this->folder_id, $uid ); @@ -932,7 +932,7 @@ class kolab_storage_cache $index = $this->imap->search_once($this->folder->name, ($deleted ? '' : 'UNDELETED ') . 'HEADER SUBJECT ' . rcube_imap_generic::escape($uid)); $results = $index->get(); - $this->uid2msg[$uid] = $results[0]; + $this->uid2msg[$uid] = end($results); } return $this->uid2msg[$uid];