multiple collections support for GetItemEstimate - patch from tfu
parent
5ceddc213e
commit
9160e34134
|
@ -1127,6 +1127,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
id currentCollection;
|
||||
NSMutableString *s;
|
||||
NSData *d;
|
||||
NSArray *allCollections;
|
||||
int j;
|
||||
|
||||
SOGoMicrosoftActiveSyncFolderType folderType;
|
||||
int status, count;
|
||||
|
@ -1135,7 +1137,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
status = 1;
|
||||
count = 0;
|
||||
|
||||
collectionId = [[(id)[theDocumentElement getElementsByTagName: @"CollectionId"] lastObject] textValue];
|
||||
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
|
||||
[s appendString: @"<!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\">"];
|
||||
[s appendString: @"<GetItemEstimate xmlns=\"GetItemEstimate:\">"];
|
||||
|
||||
allCollections = (id)[theDocumentElement getElementsByTagName: @"Collection"];
|
||||
|
||||
for (j = 0; j < [allCollections count]; j++)
|
||||
{
|
||||
collectionId = [[(id)[[allCollections objectAtIndex: j] getElementsByTagName: @"CollectionId"] lastObject] textValue];
|
||||
realCollectionId = [collectionId realCollectionIdWithFolderType: &folderType];
|
||||
|
||||
if (folderType == ActiveSyncMailFolder)
|
||||
|
@ -1161,7 +1171,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
NSCalendarDate *filter;
|
||||
NSArray *uids;
|
||||
|
||||
filter = [NSCalendarDate dateFromFilterType: [[(id)[theDocumentElement getElementsByTagName: @"FilterType"] lastObject] textValue]];
|
||||
filter = [NSCalendarDate dateFromFilterType: [[(id)[[allCollections objectAtIndex: j] getElementsByTagName: @"FilterType"] lastObject] textValue]];
|
||||
|
||||
notDeletedQualifier = [EOQualifier qualifierWithQualifierFormat:
|
||||
@"(not (flags = %@))",
|
||||
|
@ -1180,21 +1190,30 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
// Add the number of UIDs expected to "soft delete"
|
||||
count += [self _softDeleteCountWithFilter: filter collectionId: nameInCache];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
count = [[currentCollection toOneRelationshipKeys] count];
|
||||
}
|
||||
|
||||
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
|
||||
[s appendString: @"<!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\">"];
|
||||
[s appendFormat: @"<GetItemEstimate xmlns=\"GetItemEstimate:\"><Response><Status>%d</Status><Collection>", status];
|
||||
|
||||
[s appendString: @"<Response>"];
|
||||
[s appendFormat: @"<Status>%d</Status><Collection>", status];
|
||||
|
||||
if (folderType == ActiveSyncMailFolder)
|
||||
[s appendString: @"<Class>Email</Class>"];
|
||||
else if (folderType == ActiveSyncContactFolder)
|
||||
[s appendString: @"<Class>Contacts</Class>"];
|
||||
else if (folderType == ActiveSyncEventFolder)
|
||||
[s appendString: @"<Class>Calendar</Class>"];
|
||||
else if (folderType == ActiveSyncTaskFolder)
|
||||
[s appendString: @"<Class>Tasks</Class>"];
|
||||
|
||||
[s appendFormat: @"<CollectionId>%@</CollectionId>",collectionId];
|
||||
[s appendFormat: @"<Estimate>%d</Estimate>", count];
|
||||
[s appendFormat: @"<Estimate>%d</Estimate></Collection></Response>", count];
|
||||
}
|
||||
|
||||
[s appendString: @"</Collection></Response></GetItemEstimate>"];
|
||||
[s appendString: @"</GetItemEstimate>"];
|
||||
|
||||
d = [[s dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml];
|
||||
|
||||
|
@ -2543,7 +2562,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// If the MS-ASProtocolVersion header is set to "12.1", the body of the SendMail request is
|
||||
// is a "message/rfc822" payload - otherwise, it's a WBXML blob.
|
||||
//
|
||||
if ([cmdName caseInsensitiveCompare: @"SendMail"] == NSOrderedSame &&
|
||||
if ([cmdName caseInsensitiveCompare: @"SendMail"] == NSOrderedSame ||
|
||||
[[theRequest headerForKey: @"content-type"] caseInsensitiveCompare: @"message/rfc822"] == NSOrderedSame)
|
||||
{
|
||||
NSString *s, *xml;
|
||||
|
@ -2563,6 +2582,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
xml = [NSString stringWithFormat: @"<?xml version=\"1.0\"?><!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\"><SendMail xmlns=\"ComposeMail:\"><SaveInSentItems/><MIME>%@</MIME></SendMail>", [s stringByEncodingBase64]];
|
||||
|
||||
|
||||
d = [xml dataUsingEncoding: NSASCIIStringEncoding];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue