From b61560c27d0c537fe9a5c509f758881f3e1d0482 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 27 Jan 2010 12:35:11 -0700 Subject: [PATCH] Fix Horde_Imap_Client::fetch() with changedsince parameter. For a whole mailbox search with caching, filter out all entries that have do not fit changedsince criteria. Previously, all non-criteria matching entities still had an entry in the return array containing the UID of the message. --- framework/Imap_Client/lib/Horde/Imap/Client/Base.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php index 78f67d05c..220f3d903 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php @@ -2162,7 +2162,16 @@ abstract class Horde_Imap_Client_Base /* If given sequence numbers, we need to switch to UIDs for caching * purposes. Also, we need UID #'s now if searching the entire - * mailbox. */ + * mailbox. However, if we are doing a changedsince since we need to + * do that component of the search first to determine exactly what + * UIDs we need to fetch. */ + if (!empty($options['changedsince'])) { + if (!($res = $this->_fetch(array(Horde_Imap_Client::FETCH_UID => 1), $options))) { + return array(); + } + $options['ids'] = array_keys($res); + } + if ($seq || empty($options['ids'])) { $res_seq = $this->_getSeqUIDLookup(empty($options['ids']) ? null : $options['ids'], $seq); $uids = $res_seq['uids']; -- 2.11.0