From e7247cfa87b37f0f1c9fb9542726f35d582934f9 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Mon, 21 Jan 2008 16:36:15 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1329 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 6 ++++ SOPE/GDLContentStore/ChangeLog | 7 ++++ SOPE/GDLContentStore/GCSFolderManager.m | 7 ++-- SoObjects/Contacts/SOGoFolder+CardDAV.m | 46 ++++++++++--------------- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b2992c8..413fc320 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-18 Wolfgang Sourdeau + + * SoObjects/Contacts/SOGoFolder+CardDAV.m ([SOGoFolder + -davAddressbookQuery:queryContext]): when empty values are fed to + SOGo, their dictionary should be explicitly set to nil. + 2008-01-16 Wolfgang Sourdeau * SoObjects/SOGo/SOGoCache.m ([SOGoCache diff --git a/SOPE/GDLContentStore/ChangeLog b/SOPE/GDLContentStore/ChangeLog index e3f93815..fd54b285 100644 --- a/SOPE/GDLContentStore/ChangeLog +++ b/SOPE/GDLContentStore/ChangeLog @@ -1,3 +1,10 @@ +2008-01-21 Wolfgang Sourdeau + + * GCSFolderManager.m ([GCSFolderManager + -baseTableNameWithUID:_uid]): the id was too long for the quick + tables, we reduce the length of the increment string to 3 + characters instead of 8. + 2008-01-16 Wolfgang Sourdeau * GCSFolderManager.m ([GCSFolderManager -baseTableNameWithUID:]): diff --git a/SOPE/GDLContentStore/GCSFolderManager.m b/SOPE/GDLContentStore/GCSFolderManager.m index 438145a7..18481384 100644 --- a/SOPE/GDLContentStore/GCSFolderManager.m +++ b/SOPE/GDLContentStore/GCSFolderManager.m @@ -627,7 +627,8 @@ static NSCharacterSet *asciiAlphaNumericCS = nil; return [self folderForRecord:record]; } -- (NSString *)baseTableNameWithUID:(NSString *)_uid { +- (NSString *) baseTableNameWithUID: (NSString *) _uid +{ unichar currentChar; unsigned int count, max, done; NSMutableString *newUID; @@ -649,8 +650,8 @@ static NSCharacterSet *asciiAlphaNumericCS = nil; } randInc++; - return [NSString stringWithFormat: @"%@%.8x%.8x", - newUID, randInc, (unsigned int) rand()]; + return [NSString stringWithFormat: @"%@%.3x%.8x", + newUID, randInc & 0xfff, (unsigned int) rand()]; } - (NSException *)createFolderOfType:(NSString *)_type diff --git a/SoObjects/Contacts/SOGoFolder+CardDAV.m b/SoObjects/Contacts/SOGoFolder+CardDAV.m index 18b739de..8d2fb90e 100644 --- a/SoObjects/Contacts/SOGoFolder+CardDAV.m +++ b/SoObjects/Contacts/SOGoFolder+CardDAV.m @@ -45,9 +45,9 @@ NSString *baseURL; SOGoObject *o; - o = (id)self; + o = (id ) self; baseURL = [o baseURLInContext: localContext]; - + max = [filters count]; for (count = 0; count < max; count++) { @@ -58,29 +58,22 @@ objectEnumerator]; while ((contact = [contacts nextObject])) - { [o appendObject: contact withBaseURL: baseURL toREPORTResponse: response]; - } } } - (BOOL) _isValidFilter: (NSString *) theString { - if ([theString caseInsensitiveCompare: @"sn"] == NSOrderedSame) - return YES; - - if ([theString caseInsensitiveCompare: @"givenname"] == NSOrderedSame) - return YES; + NSString *newString; - if ([theString caseInsensitiveCompare: @"mail"] == NSOrderedSame) - return YES; + newString = [theString lowercaseString]; - if ([theString caseInsensitiveCompare: @"telephonenumber"] == NSOrderedSame) - return YES; - - return NO; + return ([theString isEqualToString: @"sn"] + || [theString isEqualToString: @"givenname"] + || [theString isEqualToString: @"mail"] + || [theString isEqualToString: @"telephonenumber"]); } - (NSDictionary *) _parseContactFilter: (id ) filterElement @@ -89,14 +82,17 @@ id parentNode; id ranges; + filterData = nil; + parentNode = [filterElement parentNode]; - if ([[parentNode tagName] isEqualToString: @"filter"] && - [self _isValidFilter: [filterElement attribute: @"name"]]) + if ([[parentNode tagName] isEqualToString: @"filter"] + && [self _isValidFilter: [filterElement attribute: @"name"]]) { ranges = [filterElement getElementsByTagName: @"text-match"]; - - if ([(NSArray *)ranges count] && [(NSArray *)[[ranges objectAtIndex: 0] childNodes] count]) + + if ([(NSArray *) ranges count] + && [(NSArray *) [[ranges objectAtIndex: 0] childNodes] count]) { filterData = [NSMutableDictionary new]; [filterData autorelease]; @@ -104,8 +100,6 @@ forKey: [filterElement attribute: @"name"]]; } } - else - filterData = nil; return filterData; } @@ -113,23 +107,19 @@ - (NSArray *) _parseContactFilters: (id ) parentNode { NSEnumerator *children; - id node; + id node; NSMutableArray *filters; NSDictionary *filter; - filters = [[NSMutableArray new] autorelease]; + filters = [NSMutableArray array]; children = [[parentNode getElementsByTagName: @"prop-filter"] objectEnumerator]; - - node = [children nextObject]; - - while (node) + while ((node = [children nextObject])) { filter = [self _parseContactFilter: node]; if (filter) [filters addObject: filter]; - node = [children nextObject]; } return filters; -- 2.39.5