notify_remote_removed_ids can be called at any time: Closes #7435
This was recently changed for the double-archive problem and now these ReplayOperation calls can happen at any time, not just after the location execution, so they need to do null checking every time.
This commit is contained in:
parent
e7baa8cdaa
commit
495f162abb
6 changed files with 32 additions and 29 deletions
|
|
@ -21,6 +21,10 @@ private class Geary.ImapEngine.CopyEmail : Geary.ImapEngine.SendReplayOperation
|
|||
this.cancellable = cancellable;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
to_copy.remove_all(ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_local_async() throws Error {
|
||||
if (to_copy.size == 0)
|
||||
return ReplayOperation.Status.COMPLETED;
|
||||
|
|
@ -30,10 +34,6 @@ private class Geary.ImapEngine.CopyEmail : Geary.ImapEngine.SendReplayOperation
|
|||
return ReplayOperation.Status.CONTINUE;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
to_copy.remove_all(ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_remote_async() throws Error {
|
||||
if (to_copy.size == 0)
|
||||
return ReplayOperation.Status.COMPLETED;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ private class Geary.ImapEngine.ExpungeEmail : Geary.ImapEngine.SendReplayOperati
|
|||
this.cancellable = cancellable;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
if (removed_ids != null)
|
||||
removed_ids.remove_all(ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_local_async() throws Error {
|
||||
if (to_remove.size <= 0)
|
||||
return ReplayOperation.Status.COMPLETED;
|
||||
|
|
@ -45,10 +50,6 @@ private class Geary.ImapEngine.ExpungeEmail : Geary.ImapEngine.SendReplayOperati
|
|||
return ReplayOperation.Status.CONTINUE;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
removed_ids.remove_all(ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_remote_async() throws Error {
|
||||
// Remove from server. Note that this causes the receive replay queue to kick into
|
||||
// action, removing the e-mail but *NOT* firing a signal; the "remove marker" indicates
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ private class Geary.ImapEngine.FetchEmail : Geary.ImapEngine.SendReplayOperation
|
|||
remaining_fields = required_fields;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
remote_removed = ids.contains(id);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_local_async() throws Error {
|
||||
// If forcing an update, skip local operation and go direct to replay_remote()
|
||||
if (flags.is_all_set(Folder.ListFlags.FORCE_UPDATE))
|
||||
|
|
@ -77,10 +81,6 @@ private class Geary.ImapEngine.FetchEmail : Geary.ImapEngine.SendReplayOperation
|
|||
return ReplayOperation.Status.CONTINUE;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
remote_removed = ids.contains(id);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_remote_async() throws Error {
|
||||
if (remote_removed) {
|
||||
throw new EngineError.NOT_FOUND("Unable to fetch %s in %s (removed from remote)",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ private class Geary.ImapEngine.ListEmailBySparseID : Geary.ImapEngine.AbstractLi
|
|||
this.ids.add_all(ids);
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> removed_ids) {
|
||||
ids.remove_all(removed_ids);
|
||||
|
||||
base.notify_remote_removed_ids(removed_ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_local_async() throws Error {
|
||||
if (flags.is_force_update()) {
|
||||
Gee.Set<Imap.UID>? uids = yield owner.local_folder.get_uids_async(ids, ImapDB.Folder.ListFlags.NONE,
|
||||
|
|
@ -74,12 +80,6 @@ private class Geary.ImapEngine.ListEmailBySparseID : Geary.ImapEngine.AbstractLi
|
|||
return ReplayOperation.Status.CONTINUE;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> removed_ids) {
|
||||
ids.remove_all(removed_ids);
|
||||
|
||||
base.notify_remote_removed_ids(removed_ids);
|
||||
}
|
||||
|
||||
public override async void backout_local_async() throws Error {
|
||||
// R/O, nothing to backout
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ private class Geary.ImapEngine.MarkEmail : Geary.ImapEngine.SendReplayOperation
|
|||
this.cancellable = cancellable;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
// don't bother updating on server or backing out locally
|
||||
if (original_flags != null)
|
||||
Collection.map_unset_all_keys<ImapDB.EmailIdentifier, Geary.EmailFlags>(original_flags, ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_local_async() throws Error {
|
||||
if (to_mark.size == 0)
|
||||
return ReplayOperation.Status.COMPLETED;
|
||||
|
|
@ -49,11 +55,6 @@ private class Geary.ImapEngine.MarkEmail : Geary.ImapEngine.SendReplayOperation
|
|||
return ReplayOperation.Status.CONTINUE;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
// don't bother updating on server or backing out locally
|
||||
Collection.map_unset_all_keys<ImapDB.EmailIdentifier, Geary.EmailFlags>(original_flags, ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_remote_async() throws Error {
|
||||
// potentially empty due to writebehind operation
|
||||
if (original_flags.size == 0)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,13 @@ private class Geary.ImapEngine.MoveEmail : Geary.ImapEngine.SendReplayOperation
|
|||
this.destination = destination;
|
||||
this.cancellable = cancellable;
|
||||
}
|
||||
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
// don't bother updating on server or backing out locally
|
||||
if (moved_ids != null)
|
||||
moved_ids.remove_all(ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_local_async() throws Error {
|
||||
if (to_move.size <= 0)
|
||||
return ReplayOperation.Status.COMPLETED;
|
||||
|
|
@ -47,11 +53,6 @@ private class Geary.ImapEngine.MoveEmail : Geary.ImapEngine.SendReplayOperation
|
|||
return ReplayOperation.Status.CONTINUE;
|
||||
}
|
||||
|
||||
public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
|
||||
// don't bother updating on server or backing out locally
|
||||
moved_ids.remove_all(ids);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_remote_async() throws Error {
|
||||
if (moved_ids.size > 0) {
|
||||
yield engine.remote_folder.move_email_async(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue