diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index a40af26f7..19ba99396 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -3240,8 +3240,28 @@ void handle_eas_terminate(int signum) if (error) { - [theResponse setStatus: 500]; - [theResponse appendContentString: @"FATAL ERROR occured during SendMail"]; + if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.0) + { + NSMutableString *s; + NSData *d; + + s = [NSMutableString string]; + + [s appendString: @""]; + [s appendString: @""]; + [s appendString: @""]; + [s appendString: @"120"]; + [s appendString: @""]; + + d = [[s dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml]; + + [theResponse setContent: d]; + } + else + { + [theResponse setStatus: 500]; + [theResponse appendContentString: @"FATAL ERROR occured during SendMail"]; + } } } @@ -3748,8 +3768,28 @@ void handle_eas_terminate(int signum) if (error) { - [theResponse setStatus: 500]; - [theResponse appendContentString: @"FATAL ERROR occured during SmartForward"]; + if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.0) + { + NSMutableString *s; + NSData *d; + + s = [NSMutableString string]; + + [s appendString: @""]; + [s appendString: @""]; + [s appendFormat: @"<%@ xmlns=\"ComposeMail:\">", (isSmartForward) ? @"SmartForward" : @"SmartReply"]; + [s appendString: @"120"]; + [s appendFormat: @"", (isSmartForward) ? @"SmartForward" : @"SmartReply"]; + + d = [[s dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml]; + + [theResponse setContent: d]; + } + else + { + [theResponse setStatus: 500]; + [theResponse appendContentString: @"FATAL ERROR occured during SmartForward"]; + } } else if (!isSmartForward) { @@ -3957,7 +3997,7 @@ void handle_eas_terminate(int signum) [theResponse setHeader: @"Sync,SendMail,SmartForward,SmartReply,GetAttachment,GetHierarchy,CreateCollection,DeleteCollection,MoveCollection,FolderSync,FolderCreate,FolderDelete,FolderUpdate,MoveItems,GetItemEstimate,MeetingResponse,Search,Settings,Ping,ItemOperations,ResolveRecipients,ValidateCert" forKey: @"MS-ASProtocolCommands"]; [theResponse setHeader: @"2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"]; - if (debugOn && [[theResponse headerForKey: @"Content-Type"] isEqualToString:@"application/vnd.ms-sync.wbxml"] && [[theResponse content] length]) + if (debugOn && [[theResponse headerForKey: @"Content-Type"] isEqualToString:@"application/vnd.ms-sync.wbxml"] && [[theResponse content] length] && !([(WOResponse *)theResponse status] == 500)) [self logWithFormat: @"EAS - response for device %@: %@", [context objectForKey: @"DeviceId"], [[[NSString alloc] initWithData: [[theResponse content] wbxml2xml] encoding: NSUTF8StringEncoding] autorelease]]; RELEASE(context);