Fix for bug #2691
parent
633723a470
commit
6a39b48a37
|
@ -868,12 +868,32 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{
|
||||
NSString *srcMessageId, *srcFolderId, *dstFolderId, *dstMessageId;
|
||||
SOGoMicrosoftActiveSyncFolderType srcFolderType, dstFolderType;
|
||||
id <DOMElement> aMoveOperation;
|
||||
NSArray *moveOperations;
|
||||
NSMutableString *s;
|
||||
NSData *d;
|
||||
int i;
|
||||
|
||||
srcMessageId = [[(id)[theDocumentElement getElementsByTagName: @"SrcMsgId"] lastObject] textValue];
|
||||
srcFolderId = [[[(id)[theDocumentElement getElementsByTagName: @"SrcFldId"] lastObject] textValue] realCollectionIdWithFolderType: &srcFolderType];
|
||||
dstFolderId = [[[(id)[theDocumentElement getElementsByTagName: @"DstFldId"] lastObject] textValue] realCollectionIdWithFolderType: &dstFolderType];
|
||||
moveOperations = (id)[theDocumentElement getElementsByTagName: @"Move"];
|
||||
|
||||
// FIXME
|
||||
s = [NSMutableString string];
|
||||
|
||||
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
|
||||
[s appendString: @"<!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\">"];
|
||||
[s appendString: @"<MoveItems xmlns=\"Move:\">"];
|
||||
|
||||
for (i = 0; i < [moveOperations count]; i++)
|
||||
{
|
||||
aMoveOperation = [moveOperations objectAtIndex: i];
|
||||
|
||||
srcMessageId = [[(id)[aMoveOperation getElementsByTagName: @"SrcMsgId"] lastObject] textValue];
|
||||
srcFolderId = [[[(id)[aMoveOperation getElementsByTagName: @"SrcFldId"] lastObject] textValue] realCollectionIdWithFolderType: &srcFolderType];
|
||||
dstFolderId = [[[(id)[aMoveOperation getElementsByTagName: @"DstFldId"] lastObject] textValue] realCollectionIdWithFolderType: &dstFolderType];
|
||||
|
||||
[s appendString: @"<Response>"];
|
||||
|
||||
// FIXME - we should support moving events between calendars, for example, or
|
||||
// or contacts between address books.
|
||||
if (srcFolderType == ActiveSyncMailFolder && dstFolderType == ActiveSyncMailFolder)
|
||||
{
|
||||
NGImap4Client *client;
|
||||
|
@ -884,10 +904,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
currentCollection = [self collectionFromId: srcFolderId type: srcFolderType];
|
||||
|
||||
// [currentFolder lookupName: [NSString stringWithFormat: @"folder%@", srcFolderId]
|
||||
// inContext: context
|
||||
// acquire: NO];
|
||||
|
||||
client = [[currentCollection imap4Connection] client];
|
||||
[client select: srcFolderId];
|
||||
response = [client copyUid: [srcMessageId intValue]
|
||||
|
@ -914,14 +930,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
if (!dstMessageId)
|
||||
{
|
||||
[theResponse setStatus: 500];
|
||||
[theResponse appendContentString: @"Unable to move message"];
|
||||
// FIXME: should we return 1 or 2 here?
|
||||
[s appendFormat: @"<Status>%d</Status>", 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSMutableString *s;
|
||||
NSData *d;
|
||||
|
||||
//
|
||||
// If the MoveItems operation is initiated by an Outlook client, we save the "deviceType+dstMessageId" to use it later in order to
|
||||
// modify the Sync command from "add" to "change" (see SOGoActiveSyncDispatcher+Sync.m: -processSyncGetChanges: ...).
|
||||
|
@ -943,30 +956,28 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
forKey: key];
|
||||
}
|
||||
|
||||
|
||||
// Everything is alright, lets return the proper response. "Status == 3" means success.
|
||||
s = [NSMutableString string];
|
||||
|
||||
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
|
||||
[s appendString: @"<!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\">"];
|
||||
[s appendString: @"<MoveItems xmlns=\"Move:\">"];
|
||||
[s appendString: @"<Response>"];
|
||||
[s appendFormat: @"<SrcMsgId>%@</SrcMsgId>", srcMessageId];
|
||||
[s appendFormat: @"<DstMsgId>%@</DstMsgId>", dstMessageId];
|
||||
[s appendFormat: @"<Status>%d</Status>", 3];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-mail move operations - unsupported for now.
|
||||
[s appendFormat: @"<Status>%d</Status>", 1];
|
||||
}
|
||||
|
||||
[s appendString: @"</Response>"];
|
||||
}
|
||||
|
||||
|
||||
[s appendString: @"</MoveItems>"];
|
||||
|
||||
d = [[s dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml];
|
||||
|
||||
[theResponse setContent: d];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[theResponse setStatus: 500];
|
||||
[theResponse appendContentString: @"Unsupported move operation"];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
1
NEWS
1
NEWS
|
@ -9,6 +9,7 @@ Bug fixes
|
|||
- fixed calling unescapeHTML on null variables to avoid JavaScript exceptions in Contacts module
|
||||
- fixed detection of IMAP flags support on the client side (#2664)
|
||||
- fixed the ActiveSync issue marking all mails as read when downloading them
|
||||
- fixed ActiveSync's move operations not working for multiple selections (#2691)
|
||||
|
||||
2.2.2 (2014-03-21)
|
||||
------------------
|
||||
|
|
Loading…
Reference in New Issue