Skip to content

Commit

Permalink
Merge to 2.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Jan 30, 2015
2 parents 74b27a7 + 2aa528d commit 3ca94c6
Show file tree
Hide file tree
Showing 34 changed files with 271 additions and 99 deletions.
9 changes: 5 additions & 4 deletions ActiveSync/NSData+ActiveSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#import <Foundation/NSString.h>

#import <NGExtensions/NGBase64Coding.h>
#import <NGExtensions/NSObject+Logs.h>

#include <wbxml/wbxml.h>
#include <wbxml/wbxml_conv.h>
Expand All @@ -48,7 +49,7 @@ - (void) _dumpToFile

path = [NSString stringWithFormat: @"/tmp/%@.data", [[NSProcessInfo processInfo] globallyUniqueString]];
[self writeToFile: path atomically: YES];
NSLog(@"Original data written to: %@", path);
[self errorWithFormat: @"Original data written to: %@", path];
}

//
Expand Down Expand Up @@ -81,7 +82,7 @@ - (NSData *) wbxml2xml

if (ret != WBXML_OK)
{
NSLog(@"wbxml2xmlFromContent: failed: %s\n", wbxml_errors_string(ret));
[self errorWithFormat: @"wbxml2xmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
[self _dumpToFile];
return nil;
}
Expand Down Expand Up @@ -114,7 +115,7 @@ - (NSData *) xml2wbxml

if (ret != WBXML_OK)
{
NSLog(@"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret));
[self logWithFormat: @"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
[self _dumpToFile];
return nil;
}
Expand All @@ -129,7 +130,7 @@ - (NSData *) xml2wbxml

if (ret != WBXML_OK)
{
NSLog(@"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret));
[self errorWithFormat: @"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
[self _dumpToFile];
free(wbxml);
wbxml_conv_xml2wbxml_destroy(conv);
Expand Down
40 changes: 28 additions & 12 deletions ActiveSync/SOGoActiveSyncDispatcher+Sync.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#import <NGCards/NGVCard.h>

#import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSString+misc.h>

#import <NGImap4/NSString+Imap4.h>
Expand Down Expand Up @@ -287,9 +288,8 @@ - (void) processSyncAddCommand: (id <DOMElement>) theDocumentElement
case ActiveSyncMailFolder:
default:
{
// FIXME
//continue;
NSLog(@"BLARG!");
// FIXME - what to do?
[self errorWithFormat: @"Fatal error occured - tried to call -processSyncAddCommand: ... on a mail folder. We abort."];
abort();
}
}
Expand Down Expand Up @@ -1065,13 +1065,14 @@ - (void) processSyncCollection: (id <DOMElement>) theDocumentElement
changeDetected: (BOOL *) changeDetected
maxSyncResponseSize: (int) theMaxSyncResponseSize
{
NSString *collectionId, *realCollectionId, *syncKey, *davCollectionTag, *bodyPreferenceType, *lastServerKey;
NSString *collectionId, *realCollectionId, *syncKey, *davCollectionTag, *bodyPreferenceType, *lastServerKey, *syncKeyInCache;
SOGoMicrosoftActiveSyncFolderType folderType;
id collection, value;

NSMutableString *changeBuffer, *commandsBuffer;
BOOL getChanges, first_sync;
unsigned int windowSize, v, status;
NSMutableDictionary *folderMetadata;

changeBuffer = [NSMutableString string];
commandsBuffer = [NSMutableString string];
Expand Down Expand Up @@ -1186,6 +1187,8 @@ - (void) processSyncCollection: (id <DOMElement>) theDocumentElement
[commandsBuffer appendFormat: @"<Responses>%@</Responses>", s];
}

folderMetadata = [self _folderMetadataForKey: [self _getNameInCache: collection withType: folderType]];

// If we got any changes or if we have applied any commands
// let's regenerate our SyncKey based on the collection tag.
if ([changeBuffer length] || [commandsBuffer length])
Expand All @@ -1196,7 +1199,7 @@ - (void) processSyncCollection: (id <DOMElement>) theDocumentElement
{
// Use the SyncKey saved by processSyncGetChanges - if processSyncGetChanges is not called (because of getChanges=false)
// SyncKey has the value of the previous sync operation.
davCollectionTag = [[self _folderMetadataForKey: [self _getNameInCache: collection withType: folderType]] objectForKey: @"SyncKey"];
davCollectionTag = [folderMetadata objectForKey: @"SyncKey"];

if (!davCollectionTag)
davCollectionTag = [collection davCollectionTag];
Expand All @@ -1206,8 +1209,13 @@ - (void) processSyncCollection: (id <DOMElement>) theDocumentElement
}
else
{
if (folderType == ActiveSyncMailFolder && [syncKey isEqualToString: @"-1"])
davCollectionTag = [collection davCollectionTag];
// Make sure that client is updated with the right syncKey. - This keeps vtodo's and vevent's syncKey in sync.
syncKeyInCache = [folderMetadata objectForKey: @"SyncKey"];
if (syncKeyInCache && !([davCollectionTag isEqualToString:syncKeyInCache]))
{
davCollectionTag = syncKeyInCache;
*changeDetected = YES;
}
}

// Generate the response buffer
Expand All @@ -1228,7 +1236,7 @@ - (void) processSyncCollection: (id <DOMElement>) theDocumentElement

// MoreAvailable breaks Windows Mobile devices if not between <Status> and <Commands>
// https://social.msdn.microsoft.com/Forums/en-US/040b254e-f47e-4cc1-a397-6d8393cdb819/airsyncmoreavailable-breaks-windows-mobile-devices-what-am-i-doing-wrong?forum=os_exchangeprotocols
if ([[self _folderMetadataForKey: [self _getNameInCache: collection withType: folderType]] objectForKey: @"MoreAvailable"])
if ([folderMetadata objectForKey: @"MoreAvailable"])
[theBuffer appendString: @"<MoreAvailable/>"];

[theBuffer appendString: commandsBuffer];
Expand Down Expand Up @@ -1373,6 +1381,10 @@ - (void) processSync: (id <DOMElement>) theDocumentElement
defaultInterval = [defaults maximumSyncInterval];
internalInterval = [defaults internalSyncInterval];

// If the request doesn't contain "HeartbeatInterval" there is no reason to delay the response.
if (heartbeatInterval == 0)
heartbeatInterval = internalInterval = 1;

// We check to see if our heartbeat interval falls into the supported ranges.
if (heartbeatInterval > defaultInterval || heartbeatInterval < 1)
{
Expand All @@ -1389,7 +1401,7 @@ - (void) processSync: (id <DOMElement>) theDocumentElement
allCollections = (id)[theDocumentElement getElementsByTagName: @"Collection"];

// We enter our loop detection change
for (i = 0; i < (defaultInterval/internalInterval); i++)
for (i = 0; i < (heartbeatInterval/internalInterval); i++)
{
s = [NSMutableString string];

Expand All @@ -1405,14 +1417,18 @@ - (void) processSync: (id <DOMElement>) theDocumentElement

if (changeDetected)
{
NSLog(@"Change detected, we push the content.");
[self logWithFormat: @"Change detected, we push the content."];
break;
}
else
else if (heartbeatInterval > 1)
{
NSLog(@"Sleeping %d seconds while detecting changes...", internalInterval);
[self logWithFormat: @"Sleeping %d seconds while detecting changes...", internalInterval];
sleep(internalInterval);
}
else
{
break;
}
}

// Only send a response if there are changes otherwise send an empty response.
Expand Down
35 changes: 15 additions & 20 deletions ActiveSync/SOGoActiveSyncDispatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NGCalendarDateRange.h>
#import <NGExtensions/NGHashMap.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSString+misc.h>

#import <NGImap4/NGImap4Client.h>
Expand Down Expand Up @@ -1805,30 +1806,24 @@ - (void) processPing: (id <DOMElement>) theDocumentElement

// We build the list of folders to "ping". When the payload is empty, we use the list
// of "cached" folders.
allCollections = (id)[theDocumentElement getElementsByTagName: @"Folders"];
allCollections = (id)[theDocumentElement getElementsByTagName: @"Folder"];
allFoldersID = [NSMutableArray array];

if (![allCollections count])
{
SOGoMailAccounts *accountsFolder;
SOGoMailAccount *accountFolder;
SOGoUserFolder *userFolder;
NSArray *allValues;
// We received an empty Ping request. Return status '3' to ask client to resend the request with complete body.
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: @"<Ping xmlns=\"Ping:\">"];
[s appendString: @"<Status>3</Status>"];
[s appendString: @"</Ping>"];

userFolder = [[context activeUser] homeFolderInContext: context];
accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
accountFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO];
d = [[s dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml];

allValues = [[accountFolder imapFolderGUIDs] allValues];

for (i = 0; i < [allValues count]; i++)
[allFoldersID addObject: [NSString stringWithFormat: @"mail/%@", [[allValues objectAtIndex: i] substringFromIndex: 6]]];
[theResponse setContent: d];


// FIXME: handle multiple GCS collecitons
[allFoldersID addObject: @"vcard/personal"];
[allFoldersID addObject: @"vevent/personal"];
[allFoldersID addObject: @"vtodo/personal"];
return;
}
else
{
Expand Down Expand Up @@ -1872,13 +1867,13 @@ - (void) processPing: (id <DOMElement>) theDocumentElement

if ([foldersWithChanges count])
{
NSLog(@"Change detected, we push the content.");
[self logWithFormat: @"Change detected, we push the content."];
status = 2;
break;
}
else
{
NSLog(@"Sleeping %d seconds while detecting changes...", internalInterval);
[self logWithFormat: @"Sleeping %d seconds while detecting changes...", internalInterval];
sleep(internalInterval);
}
}
Expand Down Expand Up @@ -2617,7 +2612,7 @@ - (NSException *) dispatchRequest: (id) theRequest

[theResponse setHeader: @"14.1" forKey: @"MS-Server-ActiveSync"];
[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.0,2.1,2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"];
[theResponse setHeader: @"2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"];

RELEASE(context);
RELEASE(pool);
Expand Down
2 changes: 1 addition & 1 deletion ActiveSync/SoObjectWebDAVDispatcher+ActiveSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ - (id) doOPTIONS:(WOContext *)_ctx
[response setHeader: @"private" forKey: @"Cache-Control"];
[response setHeader: @"OPTIONS, POST" forKey: @"Allow"];
[response setHeader: @"14.1" forKey: @"MS-Server-ActiveSync"];
[response setHeader: @"2.0,2.1,2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"];
[response setHeader: @"2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"];
[response 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"];
[response setHeader: @"OPTIONS, POST" forKey: @"Public"];
}
Expand Down
136 changes: 136 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,139 @@
commit d1d398091961f5d497b67313e098a8a5624089f4
Author: Francis Lachapelle <flachapelle@inverse.ca>
Date: Fri Jan 30 11:03:38 2015 -0500

Update translations

M NEWS
M UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings
M UI/PreferencesUI/Hungarian.lproj/Localizable.strings

commit cf35eec1f5c56d8c7332bed34e2195a8ad9c9e9f
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Fri Jan 30 10:28:45 2015 -0500

Improved the NEWS file for the release

M NEWS

commit 58a0b0c173616db9a3a1592b437dba7e40475321
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Fri Jan 30 10:23:04 2015 -0500

Updated for the release

M NEWS

commit 723a9d4e080644a7a8cef60de9b7450621f0964e
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Thu Jan 29 16:21:06 2015 -0500

Reverted bug fix from #3054 and added comment

M SoObjects/SOGo/SOGoParentFolder.m

commit 4cc158043eb6183ecefed7abd93b579afbdfd7f6
Author: Francis Lachapelle <flachapelle@inverse.ca>
Date: Wed Jan 28 16:38:27 2015 -0500

Improve CSS server-side cleaner

Fixes #3040

M UI/MailPartViewers/UIxMailPartHTMLViewer.m

commit 7fd1564a86d50cc96995bd3dec44939741312f4a
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Wed Jan 28 15:16:21 2015 -0500

fix for #3076

M ActiveSync/SOGoActiveSyncDispatcher.m
M ActiveSync/SoObjectWebDAVDispatcher+ActiveSync.m
M Documentation/SOGoInstallationGuide.asciidoc
M NEWS

commit 981c718d228f70a23e73d8db913234be7161166c
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Wed Jan 28 15:03:49 2015 -0500

improved handling of EAS Push when no heartbeat is provided

M ActiveSync/SOGoActiveSyncDispatcher+Sync.m
M ActiveSync/SOGoActiveSyncDispatcher.m
M NEWS

commit 086361b79a8be7722d8ae476140858067bb06c2a
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Fri Jan 23 16:16:36 2015 -0500

Avoid GNUstep warnings

M SOPE/GDLContentStore/GCSFolderType.m
M UI/MailerUI/UIxMailEditor.m

commit ab12c84887a663c0ec442cfa22b2c9fd1f737f24
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Fri Jan 23 15:32:22 2015 -0500

More NSLog usage cleanups

M SoObjects/Appointments/iCalCalendar+SOGo.m
M SoObjects/Mailer/NSData+Mail.h
M SoObjects/Mailer/NSData+Mail.m
M SoObjects/SOGo/BSONCodec.m
M SoObjects/SOGo/SOGoMailer.m
M SoObjects/SOGo/SOGoSieveManager.m
M SoObjects/SOGo/SOGoWebDAVAclManager.m

commit e2bee230217d16287883fb595d7bfc7ddec0ff77
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Thu Jan 22 16:25:16 2015 -0500

Avoid unnecessary calls to NSLog

M UI/Contacts/UIxListView.m
M UI/MailPartViewers/UIxMailPartHTMLViewer.m
M UI/MailerUI/UIxMailView.m
M UI/Scheduler/UIxCalView.m
M UI/Scheduler/UIxComponentEditor.m

commit 1a10599369da87e64b77cf110624ca6745605585
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Thu Jan 22 15:39:57 2015 -0500

Removed unnecessary NSLog calls

M SOPE/NGCards/CardGroup.m
M SOPE/NGCards/IcalResponse.m
M SOPE/NGCards/NSCalendarDate+ICal.m
M SOPE/NGCards/NSString+NGCards.m
M SOPE/NGCards/iCalObject.m

commit d907d5d268b470c7f461cb0b7951b894e4b77772
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Thu Jan 22 13:31:31 2015 -0500

Avoid using NSLog() where we can

M ActiveSync/NSData+ActiveSync.m
M ActiveSync/SOGoActiveSyncDispatcher+Sync.m
M ActiveSync/SOGoActiveSyncDispatcher.m
M Main/SOGo.m
M Main/sogod.m

commit d98ff69fbee723ae268b0cb0836c8dca75394743
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Tue Jan 20 08:35:10 2015 -0500

Version bumps for the release

M ChangeLog
M Documentation/docinfo.xml
M Documentation/includes/global-attributes.asciidoc
M NEWS
M Version

commit daa7ab87d7de8553c4df8790a10f18dead51e61f
Author: Ludovic Marcotte <lmarcotte@inverse.ca>
Date: Mon Jan 19 13:54:04 2015 -0500
Expand Down
3 changes: 0 additions & 3 deletions Documentation/SOGoInstallationGuide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2417,9 +2417,6 @@ have unexpected behaviour with various ActiveSync clients.
Please be aware of the following limitations:
* When creating an Outlook 2013 profile, you must actually kill Outlook
before the end of the creation process. See http://www.vionblog.com/connect-zimbra-community-with-outlook-2013
for a procedure example.
* Outlook 2013 does not search the GAL. One possible alternative
solution is to configure Outlook to use a LDAP server (over SSL) with
authentication. Outlook 2013 also does not seem to support multiple
Expand Down
Loading

0 comments on commit 3ca94c6

Please sign in to comment.