From 53a1764c22a313d7f88a77b48a90aef92cb12edc Mon Sep 17 00:00:00 2001 From: C Robert Date: Fri, 3 Oct 2008 21:05:53 +0000 Subject: [PATCH] Fixed a bug that duplicated messages on move (in trash folder) Monotone-Parent: 93e3ee8d7dc1f21a4f8a7f576b722c8b564aecde Monotone-Revision: 717b1106bd82a838188f97c4b88f9caa35e59586 Monotone-Author: crobert@inverse.ca Monotone-Date: 2008-10-03T21:05:53 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailFolder.m | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index 1bca568d7..f4b3b4a8a 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -438,11 +438,22 @@ static NSString *spoolFolder = nil; inContext: (id) localContext { id result; + NGImap4Client *client; + + client = [[self imap4Connection] client]; + result = [self copyUIDs: uids toFolder: destinationFolder inContext: localContext]; - if ( ![result isNotNull] ) - result = [self deleteUIDs: uids inContext: localContext]; - + if ( ![result isNotNull] ) { + result = [client storeFlags: [NSArray arrayWithObject: @"Deleted"] + forUIDs: uids addOrRemove: YES]; + if ([[result valueForKey: @"result"] boolValue]) + { + [self markForExpunge]; + result = nil; + } + } + return result; }