[geary/wip/713150-conversations] This was not properly merged when SearchFolder was broken apart
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713150-conversations] This was not properly merged when SearchFolder was broken apart
- Date: Tue, 10 Mar 2015 22:19:45 +0000 (UTC)
commit 60fa3f2f53dd329db9930de81d2fe7cef1df4fa0
Author: Jim Nelson <jim yorba org>
Date: Tue Mar 10 14:25:48 2015 -0700
This was not properly merged when SearchFolder was broken apart
Without this, the ConversationMonitor and the SearchFolder were
fundamentally broken.
.../imap-db/search/imap-db-search-folder.vala | 37 +++++++++++++++----
1 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap-db/search/imap-db-search-folder.vala
b/src/engine/imap-db/search/imap-db-search-folder.vala
index a48631f..f86482e 100644
--- a/src/engine/imap-db/search/imap-db-search-folder.vala
+++ b/src/engine/imap-db/search/imap-db-search-folder.vala
@@ -55,16 +55,37 @@ private class Geary.ImapDB.SearchFolder : Geary.SearchFolder, Geary.FolderSuppor
low = null;
high = null;
+ if (ids.size == 0)
+ return;
+
// This shouldn't require a result_mutex lock since there's no yield.
- Gee.TreeSet<ImapDB.SearchEmailIdentifier> in_folder = Geary.traverse<Geary.EmailIdentifier>(ids)
- .cast_object<ImapDB.SearchEmailIdentifier>()
- .filter(id => id in search_results)
- .to_tree_set();
-
- if (in_folder.size > 0) {
- low = in_folder.first();
- high = in_folder.last();
- }
+
+ // These must be ImapDB.EmailIdentifiers (which may also be SearchEmailIdentifiers) to
+ // xlat them into SearchEmailIdentifiers
+ Gee.HashSet<ImapDB.EmailIdentifier> db_ids = Geary.traverse<Geary.EmailIdentifier>(ids)
+ .cast_object<ImapDB.EmailIdentifier>()
+ .to_hash_set();
+ if (db_ids.size == 0)
+ return;
+
+ // Translate all ImapDB.EmailIdentifiers to the SearchEmailIdentifiers in the search results
+ // ... must do this in order to get the SearchEmailIdentifier's ordering, which is different
+ // than other ImapDB.EmailIdentifiers
+ //
+ // TODO: A dictionary of message_id => SearchEmailIdentifier would be useful here
+ Gee.TreeSet<ImapDB.SearchEmailIdentifier> in_folder = new
Gee.TreeSet<ImapDB.SearchEmailIdentifier>();
+ foreach (ImapDB.EmailIdentifier db_id in db_ids) {
+ foreach (ImapDB.SearchEmailIdentifier search_id in search_results) {
+ if (search_id.message_id == db_id.message_id)
+ in_folder.add(search_id);
+ }
+ }
+
+ if (in_folder.size == 0)
+ return;
+
+ low = in_folder.first();
+ high = in_folder.last();
}
private async void append_new_email_async(Geary.SearchQuery query, Geary.Folder folder,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]