From b07913d66d4a47919e09cbcd0c41d92bd97ea0a3 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 22 Dec 2014 08:36:55 -0500 Subject: [PATCH] See NEWS file --- ActiveSync/NGVCard+ActiveSync.m | 3 +- ActiveSync/SOGoActiveSyncDispatcher+Sync.m | 36 ++++++++++++++++------ ActiveSync/SOGoActiveSyncDispatcher.m | 2 +- NEWS | 9 ++++++ 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/ActiveSync/NGVCard+ActiveSync.m b/ActiveSync/NGVCard+ActiveSync.m index aaf6c8581..3f246c8d1 100644 --- a/ActiveSync/NGVCard+ActiveSync.m +++ b/ActiveSync/NGVCard+ActiveSync.m @@ -193,11 +193,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if ((o = [self note])) { + // It is very important here to NOT set 0 in the response, + // otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details. o = [o activeSyncRepresentationInContext: context]; [s appendString: @""]; [s appendFormat: @"%d", 1]; [s appendFormat: @"%d", [o length]]; - [s appendFormat: @"%d", 0]; [s appendFormat: @"%@", o]; [s appendString: @""]; } diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index db70bde32..1f317cfde 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -1333,6 +1333,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [output appendString: @""]; [output appendString: @""]; [output appendString: @""]; + + // + // We don't support yet empty Sync requests. See: http://msdn.microsoft.com/en-us/library/ee203280(v=exchg.80).aspx + // We return '13' - see http://msdn.microsoft.com/en-us/library/gg675457(v=exchg.80).aspx + // + if (!theDocumentElement || [[(id)[theDocumentElement getElementsByTagName: @"Partial"] lastObject] textValue]) + { + [output appendString: @"13"]; + [output appendString: @""]; + d = [[output dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml]; + [theResponse setContent: d]; + return; + } defaults = [SOGoSystemDefaults sharedSystemDefaults]; heartbeatInterval = [[[(id)[theDocumentElement getElementsByTagName: @"HeartbeatInterval"] lastObject] textValue] intValue]; @@ -1378,21 +1391,24 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } - // We always return the last generated response. - // If we only return , - // iOS powered devices will simply crash. - [output appendString: s]; + // Only send a response if there are changes otherwise send an empty response. + if (changeDetected) + { + // We always return the last generated response. + // If we only return , + // iOS powered devices will simply crash. + [output appendString: s]; - [output appendString: @""]; + [output appendString: @""]; + + d = [output dataUsingEncoding: NSUTF8StringEncoding]; + d = [d xml2wbxml]; + [theResponse setContent: d]; + } // Avoid overloading the autorelease pool here, as Sync command can // generate fairly large responses. - d = [output dataUsingEncoding: NSUTF8StringEncoding]; RELEASE(output); - - d = [d xml2wbxml]; - - [theResponse setContent: d]; } @end diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 9ac964b0e..9d71f8687 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -2480,7 +2480,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { // We check if it's a Ping command with no body. // See http://msdn.microsoft.com/en-us/library/ee200913(v=exchg.80).aspx for details - if ([cmdName caseInsensitiveCompare: @"Ping"] != NSOrderedSame && [cmdName caseInsensitiveCompare: @"GetAttachment"] != NSOrderedSame) + if ([cmdName caseInsensitiveCompare: @"Ping"] != NSOrderedSame && [cmdName caseInsensitiveCompare: @"GetAttachment"] != NSOrderedSame && [cmdName caseInsensitiveCompare: @"Sync"] != NSOrderedSame) return [NSException exceptionWithHTTPStatus: 500]; } diff --git a/NEWS b/NEWS index e0fbbe3a0..da7df793a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +2.2.13 (2014-12-xx) +------------------- + +Bug fixes + - fix contact description truncation on WP8 phones (#3028) + +Enhancements + - initial support for empty sync request/response for EAS + 2.2.12a (2014-12-19) --------------------