[geary/wip/721828-undo-2] Messages marked for removal aren't reported with "email-removed"
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/721828-undo-2] Messages marked for removal aren't reported with "email-removed"
- Date: Fri, 6 Feb 2015 00:54:44 +0000 (UTC)
commit 887f4b581241917c50209dcdafbeccfe48e61b9b
Author: Jim Nelson <jim yorba org>
Date: Thu Feb 5 16:54:03 2015 -0800
Messages marked for removal aren't reported with "email-removed"
Need to know if another client removes them, so use internal signal
that notifies when messages marked for removal are removed
.../imap-engine/imap-engine-minimal-folder.vala | 25 +++++++++++++++++--
.../imap-engine/imap-engine-revokable-move.vala | 2 +
2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 1e2985a..c117fc8 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -62,6 +62,19 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
*/
public signal void closing(Gee.List<ReplayOperation> final_ops);
+ /**
+ * Fired when an { link EmailIdentifier} that was marked for removal is actually reported as
+ * removed (expunged) from the server.
+ *
+ * Marked messages are reported as removed when marked in the database, to make the operation
+ * appear speedy to the caller. When the message is finally acknowledged as removed by the
+ * server, "email-removed" is not fired to avoid double-reporting.
+ *
+ * Some internal code (especially Revokables) mark messages for removal but delay the network
+ * operation. They need to know if the message is removed by another client, however.
+ */
+ public signal void marked_email_removed(Gee.Collection<Geary.EmailIdentifier> removed);
+
public MinimalFolder(GenericAccount account, Imap.Account remote, ImapDB.Account local,
ImapDB.Folder local_folder, SpecialFolderType special_folder_type) {
_account = account;
@@ -1239,9 +1252,15 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
err.message);
}
- // notify of change
- if (!marked && owned_id != null)
- notify_email_removed(Geary.iterate<Geary.EmailIdentifier>(owned_id).to_array_list());
+ // notify of change ... use "marked-email-removed" for marked email to allow internal code
+ // to be notified when a removed email is "really" removed
+ if (owned_id != null) {
+ Gee.List<EmailIdentifier> removed =
Geary.iterate<Geary.EmailIdentifier>(owned_id).to_array_list();
+ if (!marked)
+ notify_email_removed(removed);
+ else
+ marked_email_removed(removed);
+ }
if (!marked)
notify_email_count_changed(reported_remote_count, CountChangeReason.REMOVED);
diff --git a/src/engine/imap-engine/imap-engine-revokable-move.vala
b/src/engine/imap-engine/imap-engine-revokable-move.vala
index 80991ce..edcef32 100644
--- a/src/engine/imap-engine/imap-engine-revokable-move.vala
+++ b/src/engine/imap-engine/imap-engine-revokable-move.vala
@@ -32,12 +32,14 @@ private class Geary.ImapEngine.RevokableMove : Revokable {
account.folders_available_unavailable.connect(on_folders_available_unavailable);
source.email_removed.connect(on_source_email_removed);
+ source.marked_email_removed.connect(on_source_email_removed);
source.closing.connect(on_source_closing);
}
~RevokableMove() {
account.folders_available_unavailable.disconnect(on_folders_available_unavailable);
source.email_removed.disconnect(on_source_email_removed);
+ source.marked_email_removed.disconnect(on_source_email_removed);
source.closing.disconnect(on_source_closing);
// if still valid, schedule operation so its executed
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]