Return the most recent message UID in case there are duplicates

This commit is contained in:
Thomas Bruederli 2014-07-07 12:23:47 +02:00
parent f715264956
commit 18a106538b

View file

@ -917,7 +917,7 @@ class kolab_storage_cache
$sql_result = $this->db->query( $sql_result = $this->db->query(
"SELECT msguid FROM $this->cache_table ". "SELECT msguid FROM $this->cache_table ".
"WHERE folder_id=? AND uid=?", "WHERE folder_id=? AND uid=? ORDER BY msguid DESC",
$this->folder_id, $this->folder_id,
$uid $uid
); );
@ -932,7 +932,7 @@ class kolab_storage_cache
$index = $this->imap->search_once($this->folder->name, ($deleted ? '' : 'UNDELETED ') . $index = $this->imap->search_once($this->folder->name, ($deleted ? '' : 'UNDELETED ') .
'HEADER SUBJECT ' . rcube_imap_generic::escape($uid)); 'HEADER SUBJECT ' . rcube_imap_generic::escape($uid));
$results = $index->get(); $results = $index->get();
$this->uid2msg[$uid] = $results[0]; $this->uid2msg[$uid] = end($results);
} }
return $this->uid2msg[$uid]; return $this->uid2msg[$uid];