[geary/wip/768422-namespace-support] Further Imap.Account API tweaks.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/768422-namespace-support] Further Imap.Account API tweaks.
- Date: Sat, 4 Nov 2017 22:41:56 +0000 (UTC)
commit e361dc649af748ccd23ea79ea7d42ff349c2c130
Author: Michael James Gratton <mike vee net>
Date: Fri Nov 3 13:41:36 2017 +1100
Further Imap.Account API tweaks.
* src/engine/imap/api/imap-account.vala
(Account:list_child_folders_async): Renamed to
fetch_child_folders_async to match other remote-y methods, make returb
value non-null since nulls suck. Fix call site.
.../imap-engine/imap-engine-generic-account.vala | 32 ++++++++++----------
src/engine/imap/api/imap-account.vala | 8 ++---
2 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 86ae9c5..fb381d0 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -464,9 +464,9 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
results_suspect = false;
check_open();
- Gee.List<Imap.Folder>? remote_children = null;
+ Gee.List<Imap.Folder> remote_children = null;
try {
- remote_children = yield remote.list_child_folders_async(parent, cancellable);
+ remote_children = yield remote.fetch_child_folders_async(parent, cancellable);
} catch (Error err) {
// ignore everything but I/O and IMAP errors (cancellation is an IOError)
if (err is IOError || err is ImapError)
@@ -475,25 +475,25 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
(parent != null ? parent.to_string() : "root"), err.message);
results_suspect = true;
}
-
+
Gee.HashMap<FolderPath, Imap.Folder> result = new Gee.HashMap<FolderPath, Imap.Folder>();
- if (remote_children != null) {
- foreach (Imap.Folder remote_child in remote_children) {
- result.set(remote_child.path, remote_child);
- if (remote_child.properties.has_children.is_possible()) {
- bool recursive_results_suspect;
- Collection.map_set_all<FolderPath, Imap.Folder>(result,
- yield enumerate_remote_folders_async(
- remote_child.path, out recursive_results_suspect, cancellable));
- if (recursive_results_suspect)
- results_suspect = true;
- }
+ foreach (Imap.Folder remote_child in remote_children) {
+ result.set(remote_child.path, remote_child);
+ if (remote_child.properties.has_children.is_possible()) {
+ bool recursive_results_suspect;
+ Collection.map_set_all<FolderPath, Imap.Folder>(
+ result, yield enumerate_remote_folders_async(
+ remote_child.path, out recursive_results_suspect, cancellable
+ )
+ );
+ if (recursive_results_suspect)
+ results_suspect = true;
}
}
-
+
return result;
}
-
+
public override Geary.ContactStore get_contact_store() {
return local.contact_store;
}
diff --git a/src/engine/imap/api/imap-account.vala b/src/engine/imap/api/imap-account.vala
index 00251b5..ef115ec 100644
--- a/src/engine/imap/api/imap-account.vala
+++ b/src/engine/imap/api/imap-account.vala
@@ -187,17 +187,15 @@ private class Geary.Imap.Account : BaseObject {
* This method will perform a pipe-lined IMAP SELECT for all
* folders found, and hence should be used with care.
*/
- public async Gee.List<Imap.Folder>? list_child_folders_async(FolderPath? parent, Cancellable?
cancellable)
+ public async Gee.List<Imap.Folder> fetch_child_folders_async(FolderPath? parent, Cancellable?
cancellable)
throws Error {
ClientSession session = yield claim_session_async(cancellable);
-
+ Gee.List<Imap.Folder> children = new Gee.ArrayList<Imap.Folder>();
Gee.List<MailboxInformation> mailboxes = yield send_list_async(session, parent, true, cancellable);
if (mailboxes.size == 0) {
- return null;
+ return children;
}
- Gee.List<Imap.Folder> children = new Gee.ArrayList<Imap.Folder>();
-
// Work out which folders need a STATUS and send them all
// pipe-lined to minimise network and server latency.
Gee.Map<MailboxSpecifier, MailboxInformation> info_map = new Gee.HashMap<
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]