diff --git a/ChangeLog b/ChangeLog index ee3e3a6af..3f0847334 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,12 @@ * SoObjects/Appointments/SOGoAptMailICalReply.m: Added Spanish definition. * SoObjects/Appointments/SOGoAptMailDeletion.m: Added Spanish definition. * SoObjects/Appointments/SOGoAptMailUpdate.m: Added Spanish definition. + * SoObjects/SOGo/NSString+Utilities.m (stringByEscapingURLPart): Added to + fix the URL parts for MailDAV + * SoObjects/Mailer/SOGoMailAccount.m (toManyRelationshipKeys): Added the + "folder" prefix for MailDAV compatibility. + * SoObjects/SOGo/SOGoObject.m (_urlPreferringParticle:): Fixed URL escaping + to make paths work in MailDAV. 2009-09-28 Wolfgang Sourdeau diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 3adf9dec1..c2b0dea12 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -185,7 +185,7 @@ static NSString *fallbackIMAP4Server = nil; [folders addObjectsFromArray: additionalFolders]; } - return folders; + return [folders stringsWithFormat: @"folder%@"]; } - (BOOL) supportsQuotas diff --git a/SoObjects/SOGo/NSString+Utilities.h b/SoObjects/SOGo/NSString+Utilities.h index 1b29c1df2..801e17973 100644 --- a/SoObjects/SOGo/NSString+Utilities.h +++ b/SoObjects/SOGo/NSString+Utilities.h @@ -44,6 +44,8 @@ - (NSString *) doubleQuotedString; +- (NSString *) stringByEscapingURLPart; + - (NSString *) jsonRepresentation; - (NSString *) asCSSIdentifier; diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 792ea6a0b..f166ca0ea 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -304,6 +304,19 @@ static NSMutableCharacterSet *urlStartChars = nil; return [self doubleQuotedString]; } +- (NSString *) stringByEscapingURLPart +{ + NSString *rc; + + rc = [self stringByUnescapingURL]; + rc = [rc stringByReplacingString: @"@" + withString: @"%40"]; + rc = [rc stringByReplacingString: @" " + withString: @"%20"]; + + return rc; +} + - (NSString *) asCSSIdentifier { NSMutableString *cssIdentifier; diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index e508c6d9f..bcf9b3372 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -1143,11 +1143,12 @@ SEL SOGoSelectorForPropertySetter (NSString *property) { NSURL *serverURL, *url; NSMutableArray *path; - NSString *baseURL, *urlMethod, *fullHost; + NSString *baseURL, *urlMethod, *fullHost, *part; NSNumber *port; + int count, max; serverURL = [context serverURL]; - baseURL = [[self baseURLInContext: context] stringByUnescapingURL]; + baseURL = [self baseURLInContext: context]; path = [NSMutableArray arrayWithArray: [baseURL componentsSeparatedByString: @"/"]]; if ([baseURL hasPrefix: @"http"]) @@ -1165,6 +1166,14 @@ SEL SOGoSelectorForPropertySetter (NSString *property) [path insertObject: expected atIndex: 2]; } + max = [path count]; + for (count = 3; count < max; count++) + { + part = [path objectAtIndex: count]; + [path replaceObjectAtIndex: count + withObject: [part stringByEscapingURLPart]]; + } + port = [serverURL port]; if (port) fullHost = [NSString stringWithFormat: @"%@:%@",