[geary/mjog/invert-folder-class-hierarchy: 36/72] Geary.Folder: Replace fetch_email_async with local-only get_email_by_id
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/invert-folder-class-hierarchy: 36/72] Geary.Folder: Replace fetch_email_async with local-only get_email_by_id
- Date: Wed, 3 Mar 2021 11:52:45 +0000 (UTC)
commit f39f3d6cab83461143e333126af9b275a754c9cd
Author: Michael Gratton <mike vee net>
Date: Tue Feb 16 14:56:03 2021 +1100
Geary.Folder: Replace fetch_email_async with local-only get_email_by_id
Replace with `fetch_email_async` with a local-only `get_email_by_id`
method. Remove `ListFlags` args since the only values that made sense
were related to remote fetching.
Update the `MinimalFolder` to just access the local folder directly and
drop the now-unused `FetchEmail` replay op as a result.
Similarly rename `Geary.App.EmailStore.fetch_email_async` to match as
well.
po/POTFILES.in | 1 -
.../conversation-viewer/conversation-email.vala | 72 +++-------
.../conversation-viewer/conversation-list-box.vala | 3 +-
.../plugin/mail-merge/mail-merge-folder.vala | 9 +-
src/client/plugin/mail-merge/mail-merge.vala | 3 +-
src/engine/api/geary-folder.vala | 61 +++++----
src/engine/app/app-email-store.vala | 9 +-
src/engine/app/app-search-folder.vala | 22 +--
.../app/email-store/app-fetch-operation.vala | 30 ++---
.../imap-engine/imap-engine-minimal-folder.vala | 33 ++---
.../replay-ops/imap-engine-fetch-email.vala | 148 ---------------------
src/engine/meson.build | 1 -
src/engine/outbox/outbox-folder.vala | 45 +++----
src/engine/smtp/smtp-client-service.vala | 4 +-
test/mock/mock-folder.vala | 21 +--
test/mock/mock-remote-folder.vala | 21 +--
16 files changed, 157 insertions(+), 326 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index af6b5824b..b0d440c9e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -297,7 +297,6 @@ src/engine/imap-engine/replay-ops/imap-engine-abstract-list-email.vala
src/engine/imap-engine/replay-ops/imap-engine-copy-email.vala
src/engine/imap-engine/replay-ops/imap-engine-create-email.vala
src/engine/imap-engine/replay-ops/imap-engine-empty-folder.vala
-src/engine/imap-engine/replay-ops/imap-engine-fetch-email.vala
src/engine/imap-engine/replay-ops/imap-engine-list-email-by-id.vala
src/engine/imap-engine/replay-ops/imap-engine-list-email-by-sparse-id.vala
src/engine/imap-engine/replay-ops/imap-engine-mark-email.vala
diff --git a/src/client/conversation-viewer/conversation-email.vala
b/src/client/conversation-viewer/conversation-email.vala
index 17cf85c08..65460d8a5 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -357,20 +357,26 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
if (!loaded) {
this.body_loading_timeout.start();
try {
- this.email = yield this.email_store.fetch_email_async(
+ this.email = yield this.email_store.get_email_by_id(
this.email.id,
REQUIRED_FOR_LOAD,
- LOCAL_ONLY, // Throws an error if not downloaded
this.load_cancellable
);
loaded = true;
this.body_loading_timeout.reset();
} catch (Geary.EngineError.INCOMPLETE_MESSAGE err) {
// Don't have the complete message at the moment, so
- // download it in the background. Don't reset the body
- // load timeout here since this will attempt to fetch
- // from the remote
- this.fetch_remote_body.begin();
+ // wait for it to be downloaded. Don't reset the body
+ // load timeout here since we want it to show up.
+ this.email_store.account.email_complete.connect(
+ this.on_email_complete
+ );
+ this.body_loading_timeout.reset();
+ if (is_online()) {
+ this.primary_message.show_loading_pane();
+ } else {
+ handle_load_offline();
+ }
} catch (GLib.IOError.CANCELLED err) {
this.body_loading_timeout.reset();
throw err;
@@ -617,49 +623,6 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
});
}
- private async void fetch_remote_body() {
- if (is_online()) {
- // XXX Need proper progress reporting here, rather than just
- // doing a pulse
- if (!this.body_loading_timeout.is_running) {
- this.body_loading_timeout.start();
- }
-
- Geary.Email? loaded = null;
- try {
- debug("Downloading remote message: %s", this.email.to_string());
- loaded = yield this.email_store.fetch_email_async(
- this.email.id,
- REQUIRED_FOR_LOAD,
- FORCE_UPDATE,
- this.load_cancellable
- );
- } catch (GLib.IOError.CANCELLED err) {
- // All good
- } catch (GLib.Error err) {
- debug("Remote message download failed: %s", err.message);
- handle_load_failure(err);
- }
-
- this.body_loading_timeout.reset();
-
- if (loaded != null && !this.load_cancellable.is_cancelled()) {
- try {
- this.email = loaded;
- yield update_body();
- } catch (GLib.IOError.CANCELLED err) {
- // All good
- } catch (GLib.Error err) {
- debug("Remote message update failed: %s", err.message);
- handle_load_failure(err);
- }
- }
- } else {
- this.body_loading_timeout.reset();
- handle_load_offline();
- }
- }
-
private async void update_body()
throws GLib.Error {
Geary.RFC822.Message message = this.email.get_message();
@@ -878,6 +841,15 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
this.body_loading_timeout.reset();
}
+ private void on_email_complete(Gee.Collection<Geary.EmailIdentifier> ids) {
+ if (this.email.id in ids) {
+ this.email_store.account.email_complete.disconnect(
+ this.on_email_complete
+ );
+ this.load_body.begin();
+ }
+ }
+
private void on_flag_remote_images() {
activate_email_action(ConversationListBox.ACTION_MARK_LOAD_REMOTE);
}
@@ -957,7 +929,7 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
if (this.message_body_state == FAILED &&
!this.load_cancellable.is_cancelled() &&
is_online()) {
- this.fetch_remote_body.begin();
+ this.load_body.begin();
}
}
diff --git a/src/client/conversation-viewer/conversation-list-box.vala
b/src/client/conversation-viewer/conversation-list-box.vala
index d23654163..46b71b783 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -1153,10 +1153,9 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
// full email here so that ConverationEmail can handle it if
// the full email isn't actually available in the same way as
// any other.
- Geary.Email full_email = yield this.email_store.fetch_email_async(
+ Geary.Email full_email = yield this.email_store.get_email_by_id(
id,
REQUIRED_FIELDS | ConversationEmail.REQUIRED_FOR_CONSTRUCT,
- Geary.Folder.ListFlags.NONE,
this.cancellable
);
diff --git a/src/client/plugin/mail-merge/mail-merge-folder.vala
b/src/client/plugin/mail-merge/mail-merge-folder.vala
index 44bb07fc6..9f78242de 100644
--- a/src/client/plugin/mail-merge/mail-merge-folder.vala
+++ b/src/client/plugin/mail-merge/mail-merge-folder.vala
@@ -191,11 +191,10 @@ public class MailMerge.Folder : Geary.BaseObject,
).to_hash_set();
}
- public async Geary.Email
- fetch_email_async(Geary.EmailIdentifier id,
- Geary.Email.Field required_fields,
- Geary.Folder.ListFlags flags,
- GLib.Cancellable? cancellable = null)
+ /** {@inheritDoc} */
+ public async Geary.Email get_email_by_id(Geary.EmailIdentifier id,
+ Geary.Email.Field required_fields,
+ GLib.Cancellable? cancellable = null)
throws GLib.Error {
var email = this.email.get(id);
if (email == null) {
diff --git a/src/client/plugin/mail-merge/mail-merge.vala b/src/client/plugin/mail-merge/mail-merge.vala
index 1fa7c7c1d..bf66da9a1 100644
--- a/src/client/plugin/mail-merge/mail-merge.vala
+++ b/src/client/plugin/mail-merge/mail-merge.vala
@@ -415,10 +415,9 @@ public class Plugin.MailMerge :
var account_context = this.client_plugins.to_client_account(
plugin.identifier.account
);
- engine = yield account_context.emails.fetch_email_async(
+ engine = yield account_context.emails.get_email_by_id(
engine.id,
global::MailMerge.Processor.REQUIRED_FIELDS,
- Geary.Folder.ListFlags.LOCAL_ONLY,
this.cancellable
);
}
diff --git a/src/engine/api/geary-folder.vala b/src/engine/api/geary-folder.vala
index 4f65eb990..db0d0bd0c 100644
--- a/src/engine/api/geary-folder.vala
+++ b/src/engine/api/geary-folder.vala
@@ -1,6 +1,6 @@
/*
* Copyright 2016 Software Freedom Conservancy Inc.
- * Copyright 2018 Michael Gratton <mike vee net>
+ * Copyright 2018-2021 Michael Gratton <mike vee net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
@@ -18,11 +18,18 @@
* sending), or as a representation of those found in a mailbox on a
* remote mail server, such as those provided by an IMAP server. Email
* messages are represented by the {@link Email} class, and many
- * folder methods will return collections of these.
+ * folder methods return instances of these.
+ *
+ * The set of email in a folder is called the folder's ''vector'', and
+ * contains generally the most recent message in the mailbox at the
+ * upper end, back through to some older message at the start or lower
+ * end of the vector. The ordering of the vector is the ''natural''
+ * ordering, based on the order in which messages were appended to the
+ * folder, not when messages were sent or some other criteria.
*
* Folders that represent a remote folder extend {@link
- * RemoteFolder}. These cache the remote folder's email locally, and
- * the set of cached messages may be a subset of those available in
+ * RemoteFolder}. These cache the remote folder's email locally in the
+ * vector, and these messages may be a subset of those available in
* the mailbox, depending on an account's settings. Email messages may
* be partially cached, in the case of a new message having just
* arrived or a message with many large attachments that was not
@@ -663,6 +670,32 @@ public interface Geary.Folder : GLib.Object, Logging.Source {
GLib.Cancellable? cancellable = null)
throws GLib.Error;
+ /**
+ * Returns email from the folder's vector.
+ *
+ * The returned email object will have its property values set for
+ * at least all requested fields, others may or may not be. If is
+ * good practice for callers request only the fields be loaded
+ * that they actually require, since the time taken to load the
+ * message will be reduced as there will be less data to load from
+ * local storage.
+ *
+ * Note that for remote-backed folders, an email may not have yet
+ * been fully downloaded and hence might exist incomplete in local
+ * storage. If the requested fields are not available, {@link
+ * EngineError.INCOMPLETE_MESSAGE} is thrown. Connect to the
+ * {@link Account.email_complete} signal to be notified of when
+ * email is fully downloaded in this case.
+ *
+ * If the given email identifier is not present in the vector, an
+ * {@link EngineError.NOT_FOUND} error is thrown.
+ */
+ public abstract async Geary.Email get_email_by_id(
+ EmailIdentifier email_id,
+ Email.Field required_fields,
+ GLib.Cancellable? cancellable = null
+ ) throws GLib.Error;
+
/**
* List a number of contiguous emails in the folder's vector.
*
@@ -732,26 +765,6 @@ public interface Geary.Folder : GLib.Object, Logging.Source {
Gee.Collection<Geary.EmailIdentifier> ids, Geary.Email.Field required_fields, ListFlags flags,
Cancellable? cancellable = null) throws Error;
- /**
- * Returns a single email that fulfills the required_fields flag at the ordered position in
- * the folder. If the email_id is invalid for the folder's contents, an EngineError.NOT_FOUND
- * error is thrown. If the requested fields are not available, EngineError.INCOMPLETE_MESSAGE
- * is thrown.
- *
- * Because fetch_email_async() is a form of listing (listing exactly one email), it takes
- * ListFlags as a parameter. See list_email_async() for more information. Note that one
- * flag (ListFlags.EXCLUDING_ID) makes no sense in this context.
- *
- * This method also works like the list variants in that it will not wait for the server to
- * connect if called in the OPENING state. A ListFlag option may be offered in the future to
- * force waiting for the server to connect. Unlike the list variants, if in the OPENING state
- * and the message is not found locally, EngineError.NOT_FOUND is thrown.
- *
- * The Folder must be opened prior to attempting this operation.
- */
- public abstract async Geary.Email fetch_email_async(Geary.EmailIdentifier email_id,
- Geary.Email.Field required_fields, ListFlags flags, Cancellable? cancellable = null) throws Error;
-
/**
* Sets whether this folder has a custom special use.
*
diff --git a/src/engine/app/app-email-store.vala b/src/engine/app/app-email-store.vala
index 92338c873..a280c55c7 100644
--- a/src/engine/app/app-email-store.vala
+++ b/src/engine/app/app-email-store.vala
@@ -75,10 +75,11 @@ public class Geary.App.EmailStore : BaseObject {
/**
* Fetches any EmailIdentifier regardless of what folder it's in.
*/
- public async Geary.Email fetch_email_async(Geary.EmailIdentifier email_id,
- Geary.Email.Field required_fields, Geary.Folder.ListFlags flags,
- Cancellable? cancellable = null) throws Error {
- FetchOperation op = new Geary.App.FetchOperation(required_fields, flags);
+ public async Email get_email_by_id(EmailIdentifier email_id,
+ Email.Field required_fields,
+ GLib.Cancellable? cancellable = null)
+ throws GLib.Error {
+ FetchOperation op = new Geary.App.FetchOperation(required_fields);
yield do_folder_operation_async(op,
Geary.iterate<Geary.EmailIdentifier>(email_id).to_array_list(), cancellable);
diff --git a/src/engine/app/app-search-folder.vala b/src/engine/app/app-search-folder.vala
index 98a686cda..d0cef85fa 100644
--- a/src/engine/app/app-search-folder.vala
+++ b/src/engine/app/app-search-folder.vala
@@ -217,6 +217,17 @@ public class Geary.App.SearchFolder : BaseObject,
).to_hash_set();
}
+ /** {@inheritDoc} */
+ public async Email get_email_by_id(EmailIdentifier fetch,
+ Email.Field required_fields,
+ GLib.Cancellable? cancellable = null)
+ throws GLib.Error {
+ require_id(fetch);
+ return yield this.account.local_fetch_email_async(
+ fetch, required_fields, cancellable
+ );
+ }
+
public async Gee.List<Email>? list_email_by_id_async(
EmailIdentifier? initial_id,
int count,
@@ -326,17 +337,6 @@ public class Geary.App.SearchFolder : BaseObject,
);
}
- public async Email fetch_email_async(EmailIdentifier fetch,
- Email.Field required_fields,
- Folder.ListFlags flags,
- GLib.Cancellable? cancellable = null)
- throws GLib.Error {
- require_id(fetch);
- return yield this.account.local_fetch_email_async(
- fetch, required_fields, cancellable
- );
- }
-
public virtual async void remove_email_async(
Gee.Collection<EmailIdentifier> remove,
GLib.Cancellable? cancellable = null
diff --git a/src/engine/app/email-store/app-fetch-operation.vala
b/src/engine/app/email-store/app-fetch-operation.vala
index 4db6c457c..cf1fc98b3 100644
--- a/src/engine/app/email-store/app-fetch-operation.vala
+++ b/src/engine/app/email-store/app-fetch-operation.vala
@@ -5,26 +5,26 @@
*/
private class Geary.App.FetchOperation : Geary.App.AsyncFolderOperation {
+
public override Type folder_type { get { return typeof(Geary.Folder); } }
- public Geary.Email? result = null;
- public Geary.Email.Field required_fields;
- public Geary.Folder.ListFlags flags;
+ public Email? result { get; private set; default = null; }
+ public Email.Field required_fields;
+
- public FetchOperation(Geary.Email.Field required_fields, Geary.Folder.ListFlags flags) {
+ public FetchOperation(Email.Field required_fields) {
this.required_fields = required_fields;
- this.flags = flags;
}
- public override async Gee.Collection<Geary.EmailIdentifier> execute_async(
- Geary.Folder folder, Gee.Collection<Geary.EmailIdentifier> ids,
- Cancellable? cancellable) throws Error {
- assert(result == null);
- Geary.EmailIdentifier? id = Collection.first(ids);
- assert(id != null);
-
- result = yield folder.fetch_email_async(
- id, required_fields, flags, cancellable);
- return Geary.iterate<Geary.EmailIdentifier>(id).to_array_list();
+ public override async Gee.Collection<EmailIdentifier> execute_async(
+ Folder folder,
+ Gee.Collection<EmailIdentifier> ids,
+ GLib.Cancellable? cancellable
+ ) throws GLib.Error {
+ var id = Collection.first(ids);
+ this.result = yield folder.get_email_by_id(
+ id, required_fields, cancellable
+ );
+ return iterate<EmailIdentifier>(id).to_array_list();
}
}
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index ca28a20f5..1d0d0e418 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -880,6 +880,20 @@ private class Geary.ImapEngine.MinimalFolder : BaseObject,
return yield this.local_folder.contains_identifiers(ids, cancellable);
}
+ /** {@inheritDoc} */
+ public async Email get_email_by_id(EmailIdentifier id,
+ Email.Field required_fields,
+ GLib.Cancellable? cancellable = null)
+ throws GLib.Error {
+ check_id("get_email_by_id", id);
+ return yield this.local_folder.fetch_email_async(
+ (ImapDB.EmailIdentifier) id,
+ required_fields,
+ NONE,
+ cancellable
+ );
+ }
+
//
// list email variants
//
@@ -924,25 +938,6 @@ private class Geary.ImapEngine.MinimalFolder : BaseObject,
return !op.accumulator.is_empty ? op.accumulator : null;
}
- public async Geary.Email fetch_email_async(Geary.EmailIdentifier id,
- Geary.Email.Field required_fields, Geary.Folder.ListFlags flags, Cancellable? cancellable = null)
- throws Error {
- check_flags("fetch_email_async", flags);
- check_id("fetch_email_async", id);
-
- FetchEmail op = new FetchEmail(
- this,
- (ImapDB.EmailIdentifier) id,
- required_fields,
- flags,
- cancellable
- );
- replay_queue.schedule(op);
-
- yield op.wait_for_ready_async(cancellable);
- return op.email;
- }
-
// Helper function for child classes dealing with the
// delete/archive question. This method will mark the message as
// deleted and expunge it.
diff --git a/src/engine/meson.build b/src/engine/meson.build
index c7dc61ea8..92259a1ba 100644
--- a/src/engine/meson.build
+++ b/src/engine/meson.build
@@ -207,7 +207,6 @@ engine_vala_sources = files(
'imap-engine/replay-ops/imap-engine-copy-email.vala',
'imap-engine/replay-ops/imap-engine-create-email.vala',
'imap-engine/replay-ops/imap-engine-empty-folder.vala',
- 'imap-engine/replay-ops/imap-engine-fetch-email.vala',
'imap-engine/replay-ops/imap-engine-list-email-by-id.vala',
'imap-engine/replay-ops/imap-engine-list-email-by-sparse-id.vala',
'imap-engine/replay-ops/imap-engine-mark-email.vala',
diff --git a/src/engine/outbox/outbox-folder.vala b/src/engine/outbox/outbox-folder.vala
index 78a90c720..ac29cb930 100644
--- a/src/engine/outbox/outbox-folder.vala
+++ b/src/engine/outbox/outbox-folder.vala
@@ -216,6 +216,28 @@ public class Geary.Outbox.Folder : BaseObject,
return contains;
}
+ /** {@inheritDoc} */
+ public async Email get_email_by_id(Geary.EmailIdentifier id,
+ Email.Field required_fields,
+ GLib.Cancellable? cancellable = null)
+ throws GLib.Error {
+ EmailIdentifier? outbox_id = id as EmailIdentifier;
+ if (outbox_id == null)
+ throw new EngineError.BAD_PARAMETERS("%s is not outbox EmailIdentifier", id.to_string());
+
+ OutboxRow? row = null;
+ yield db.exec_transaction_async(Db.TransactionType.RO, (cx) => {
+ row = do_fetch_row_by_ordering(cx, outbox_id.ordering, cancellable);
+
+ return Db.TransactionOutcome.DONE;
+ }, cancellable);
+
+ if (row == null)
+ throw new EngineError.NOT_FOUND("No message with ID %s in outbox", id.to_string());
+
+ return row_to_email(row);
+ }
+
public async Gee.List<Email>?
list_email_by_id_async(Geary.EmailIdentifier? _initial_id,
int count,
@@ -327,29 +349,6 @@ public class Geary.Outbox.Folder : BaseObject,
return (list.size > 0) ? list : null;
}
- public async Email
- fetch_email_async(Geary.EmailIdentifier id,
- Geary.Email.Field required_fields,
- Geary.Folder.ListFlags flags,
- GLib.Cancellable? cancellable = null)
- throws GLib.Error {
- EmailIdentifier? outbox_id = id as EmailIdentifier;
- if (outbox_id == null)
- throw new EngineError.BAD_PARAMETERS("%s is not outbox EmailIdentifier", id.to_string());
-
- OutboxRow? row = null;
- yield db.exec_transaction_async(Db.TransactionType.RO, (cx) => {
- row = do_fetch_row_by_ordering(cx, outbox_id.ordering, cancellable);
-
- return Db.TransactionOutcome.DONE;
- }, cancellable);
-
- if (row == null)
- throw new EngineError.NOT_FOUND("No message with ID %s in outbox", id.to_string());
-
- return row_to_email(row);
- }
-
/** {@inheritDoc} */
public void set_used_as_custom(bool enabled)
throws EngineError.UNSUPPORTED {
diff --git a/src/engine/smtp/smtp-client-service.vala b/src/engine/smtp/smtp-client-service.vala
index 6204148e9..841a1da0e 100644
--- a/src/engine/smtp/smtp-client-service.vala
+++ b/src/engine/smtp/smtp-client-service.vala
@@ -254,9 +254,7 @@ public class Geary.Smtp.ClientService : Geary.ClientService {
throw new SmtpError.AUTHENTICATION_FAILED("Credentials not loaded");
}
- Email email = yield this.outbox.fetch_email_async(
- id, Email.Field.ALL, Folder.ListFlags.NONE, cancellable
- );
+ Email email = yield this.outbox.get_email_by_id(id, ALL, cancellable);
if (!email.email_flags.contains(EmailFlags.OUTBOX_SENT)) {
RFC822.Message message = email.get_message();
diff --git a/test/mock/mock-folder.vala b/test/mock/mock-folder.vala
index 43737e1b5..ae00d4840 100644
--- a/test/mock/mock-folder.vala
+++ b/test/mock/mock-folder.vala
@@ -70,6 +70,18 @@ public class Mock.Folder : GLib.Object,
);
}
+ public async Geary.Email get_email_by_id(
+ Geary.EmailIdentifier email_id,
+ Geary.Email.Field required_fields,
+ GLib.Cancellable? cancellable = null
+ ) throws GLib.Error {
+ return yield object_call_async<Geary.Email>(
+ "get_email_by_id",
+ {email_id, box_arg(required_fields), cancellable},
+ new Geary.Email(new Mock.EmailIdentifer(0))
+ );
+ }
+
public async Gee.List<Geary.Email>?
list_email_by_id_async(Geary.EmailIdentifier? initial_id,
int count,
@@ -97,15 +109,6 @@ public class Mock.Folder : GLib.Object,
);
}
- public async Geary.Email
- fetch_email_async(Geary.EmailIdentifier email_id,
- Geary.Email.Field required_fields,
- Geary.Folder.ListFlags flags,
- GLib.Cancellable? cancellable = null)
- throws GLib.Error {
- throw new Geary.EngineError.UNSUPPORTED("Mock method");
- }
-
public void set_used_as_custom(bool enabled)
throws Geary.EngineError.UNSUPPORTED {
throw new Geary.EngineError.UNSUPPORTED("Mock method");
diff --git a/test/mock/mock-remote-folder.vala b/test/mock/mock-remote-folder.vala
index 9255eccf6..1ccc0db80 100644
--- a/test/mock/mock-remote-folder.vala
+++ b/test/mock/mock-remote-folder.vala
@@ -118,6 +118,18 @@ public class Mock.RemoteFolder : GLib.Object,
);
}
+ public async Geary.Email get_email_by_id(
+ Geary.EmailIdentifier email_id,
+ Geary.Email.Field required_fields,
+ GLib.Cancellable? cancellable = null
+ ) throws GLib.Error {
+ return yield object_call_async<Geary.Email>(
+ "get_email",
+ {email_id, box_arg(required_fields), cancellable},
+ new Geary.Email(new Mock.EmailIdentifer(0))
+ );
+ }
+
public async Gee.List<Geary.Email>?
list_email_by_id_async(Geary.EmailIdentifier? initial_id,
int count,
@@ -145,15 +157,6 @@ public class Mock.RemoteFolder : GLib.Object,
);
}
- public async Geary.Email
- fetch_email_async(Geary.EmailIdentifier email_id,
- Geary.Email.Field required_fields,
- Geary.Folder.ListFlags flags,
- GLib.Cancellable? cancellable = null)
- throws GLib.Error {
- throw new Geary.EngineError.UNSUPPORTED("Mock method");
- }
-
public void set_used_as_custom(bool enabled)
throws Geary.EngineError.UNSUPPORTED {
throw new Geary.EngineError.UNSUPPORTED("Mock method");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]