merge of '53c5d360d6227b55fed66ce7b836271a87287b35'
and '97ce53eed867e1824e43f8db18e4c2e3affcff00' Monotone-Parent: 53c5d360d6227b55fed66ce7b836271a87287b35 Monotone-Parent: 97ce53eed867e1824e43f8db18e4c2e3affcff00 Monotone-Revision: 5ad5e8cbaacb3208712da8a7a033eb689e942a0c Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-01-21T20:52:53 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
5afddeb973
|
@ -1,3 +1,10 @@
|
|||
2008-01-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* 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 <wsourdeau@inverse.ca>
|
||||
|
||||
* GCSFolderManager.m ([GCSFolderManager -baseTableNameWithUID:]):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
NSString *baseURL;
|
||||
SOGoObject <SOGoContactFolder> *o;
|
||||
|
||||
o = (id<SOGoContactFolder>)self;
|
||||
o = (id <SOGoContactFolder>) 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;
|
||||
NSString *newString;
|
||||
|
||||
if ([theString caseInsensitiveCompare: @"givenname"] == NSOrderedSame)
|
||||
return YES;
|
||||
newString = [theString lowercaseString];
|
||||
|
||||
if ([theString caseInsensitiveCompare: @"mail"] == NSOrderedSame)
|
||||
return YES;
|
||||
|
||||
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 <DOMElement>) filterElement
|
||||
|
@ -89,26 +82,24 @@
|
|||
id <DOMNode> parentNode;
|
||||
id <DOMNodeList> 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];
|
||||
[filterData setObject: [[(NSArray *)[[ranges objectAtIndex: 0] childNodes] lastObject] data]
|
||||
forKey: [filterElement attribute: @"name"]];
|
||||
}
|
||||
else
|
||||
filterData = nil;
|
||||
}
|
||||
else
|
||||
filterData = nil;
|
||||
|
||||
return filterData;
|
||||
}
|
||||
|
@ -116,23 +107,19 @@
|
|||
- (NSArray *) _parseContactFilters: (id <DOMElement>) parentNode
|
||||
{
|
||||
NSEnumerator *children;
|
||||
id<DOMElement> node;
|
||||
id <DOMElement> 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;
|
||||
|
|
Loading…
Reference in a new issue