From d7fb79381e1a1e20a7e3c92d38f00ddd463045fb Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 26 Oct 2015 10:15:35 -0400 Subject: [PATCH] (feat) we now save the supported elements in EAS collections --- ActiveSync/SOGoActiveSyncDispatcher+Sync.m | 29 +++++++++++++++++++++- ActiveSync/SOGoActiveSyncDispatcher.m | 3 +++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index 9f617d51d..836d9ee79 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -192,6 +192,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [[o properties] removeObjectForKey: @"DateCache"]; [[o properties] removeObjectForKey: @"MoreAvailable"]; [[o properties] removeObjectForKey: @"BodyPreferenceType"]; + [[o properties] removeObjectForKey: @"SupportedElements"]; [[o properties] removeObjectForKey: @"SuccessfulMoveItemsOps"]; [[o properties] removeObjectForKey: @"InitialLoadSequence"]; @@ -1399,11 +1400,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { NSString *collectionId, *realCollectionId, *syncKey, *davCollectionTag, *bodyPreferenceType, *mimeSupport, *lastServerKey, *syncKeyInCache, *folderKey; NSMutableDictionary *folderMetadata, *folderOptions; + NSMutableArray *supportedElements, *supportedElementNames; NSMutableString *changeBuffer, *commandsBuffer; id collection, value; SOGoMicrosoftActiveSyncFolderType folderType; - unsigned int windowSize, v, status; + unsigned int windowSize, v, status, i; BOOL getChanges, first_sync; changeBuffer = [NSMutableString string]; @@ -1466,6 +1468,30 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. davCollectionTag = @"-1"; first_sync = YES; *changeDetected = YES; + + supportedElementNames = [[[NSMutableArray alloc] init] autorelease]; + value = [theDocumentElement getElementsByTagName: @"Supported"]; + + if ([value count]) + { + supportedElements = (id)[[value lastObject] childNodes]; + + if ([supportedElements count]) + { + for (i = 0; i < [supportedElements count]; i++) + { + if ([[supportedElements objectAtIndex: i] nodeType] == DOM_ELEMENT_NODE) + [supportedElementNames addObject: [[supportedElements objectAtIndex: i] tagName]]; + } + } + + [folderMetadata setObject: supportedElementNames forKey: @"SupportedElements"]; + + [self _setFolderMetadata: folderMetadata forKey: folderKey]; + + if (debugOn) + [self logWithFormat: @"EAS - %d %@: supportedElements saved: %@", [supportedElements count], [collection nameInContainer], supportedElementNames]; + } } else if ((![syncKey isEqualToString: @"-1"]) && !([folderMetadata objectForKey: @"SyncCache"])) { @@ -1526,6 +1552,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [context setObject: bodyPreferenceType forKey: @"BodyPreferenceType"]; [context setObject: mimeSupport forKey: @"MIMESupport"]; + [context setObject: [folderMetadata objectForKey: @"SupportedElements"] forKey: @"SupportedElements"]; // // We process the commands from the request diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 31b7cb300..daa1999da 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -953,6 +953,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [[o properties] removeObjectForKey: @"DateCache"]; [[o properties] removeObjectForKey: @"MoreAvailable"]; [[o properties] removeObjectForKey: @"BodyPreferenceType"]; + [[o properties] removeObjectForKey: @"SupportedElements"]; [[o properties] removeObjectForKey: @"SuccessfulMoveItemsOps"]; [[o properties] removeObjectForKey: @"InitialLoadSequence"]; [o save]; @@ -1041,6 +1042,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [[o properties] removeObjectForKey: @"DateCache"]; [[o properties] removeObjectForKey: @"MoreAvailable"]; [[o properties] removeObjectForKey: @"BodyPreferenceType"]; + [[o properties] removeObjectForKey: @"SupportedElements"]; [[o properties] removeObjectForKey: @"SuccessfulMoveItemsOps"]; [[o properties] removeObjectForKey: @"InitialLoadSequence"]; } @@ -1065,6 +1067,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [[o properties] removeObjectForKey: @"DateCache"]; [[o properties] removeObjectForKey: @"MoreAvailable"]; [[o properties] removeObjectForKey: @"BodyPreferenceType"]; + [[o properties] removeObjectForKey: @"SupportedElements"]; [[o properties] removeObjectForKey: @"SuccessfulMoveItemsOps"]; [[o properties] removeObjectForKey: @"InitialLoadSequence"]; }