Monotone-Parent: fccd21ec84b5d4e56232523b4a8b8733c3d3a051
Monotone-Revision: 618681307a4cbc2f326ac0bdd3eb6077cb9a22f4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-19T20:59:05 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
1af2ab7453
commit
3d9689524a
|
@ -1,5 +1,11 @@
|
||||||
2012-03-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2012-03-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* Main/SOGo+DAV.m (_fillCollections:where:matches:inContext:):
|
||||||
|
added bogosupport for
|
||||||
|
"{http://calendarserver.org/ns/}email-address-set".
|
||||||
|
(_principalCollectionsMatching:inContext:): relationship between
|
||||||
|
search criteria is now and "OR" rathern than an "AND".
|
||||||
|
|
||||||
* SoObjects/Appointments/SOGoUserFolder+Appointments.m
|
* SoObjects/Appointments/SOGoUserFolder+Appointments.m
|
||||||
(-davCalendarUserType, -davEmailAddressSet): new DAV accessors.
|
(-davCalendarUserType, -davEmailAddressSet): new DAV accessors.
|
||||||
|
|
||||||
|
|
100
Main/SOGo+DAV.m
100
Main/SOGo+DAV.m
|
@ -40,6 +40,7 @@
|
||||||
#import <SOGo/NSString+DAV.h>
|
#import <SOGo/NSString+DAV.h>
|
||||||
#import <SOGo/WORequest+SOGo.h>
|
#import <SOGo/WORequest+SOGo.h>
|
||||||
#import <SOGo/WOResponse+SOGo.h>
|
#import <SOGo/WOResponse+SOGo.h>
|
||||||
|
#import <SOGo/SOGoSource.h>
|
||||||
#import <SOGo/SOGoPermissions.h>
|
#import <SOGo/SOGoPermissions.h>
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
#import <SOGo/SOGoUserFolder.h>
|
#import <SOGo/SOGoUserFolder.h>
|
||||||
|
@ -362,46 +363,53 @@
|
||||||
[collections addObject: collection];
|
[collections addObject: collection];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableArray *) _firstPrincipalCollectionsWhere: (NSString *) key
|
- (void) _fillCollections: (NSMutableArray *) collections
|
||||||
matches: (NSString *) value
|
withEmailAddressSetMatching: (NSString *) value
|
||||||
inContext: (WOContext *) localContext
|
inContext: (WOContext *) localContext
|
||||||
{
|
{
|
||||||
NSMutableArray *collections;
|
id <SOGoSource> authenticationSource;
|
||||||
|
SOGoUser *activeUser;
|
||||||
|
NSArray *records;
|
||||||
|
NSUInteger count, max;
|
||||||
|
NSString *uid;
|
||||||
|
SOGoUserFolder *collection;
|
||||||
|
|
||||||
collections = [NSMutableArray array];
|
activeUser = [localContext activeUser];
|
||||||
|
if ([activeUser respondsToSelector: @selector (authenticationSource)])
|
||||||
|
{
|
||||||
|
authenticationSource = [[localContext activeUser] authenticationSource];
|
||||||
|
records = [authenticationSource
|
||||||
|
fetchContactsMatching: value
|
||||||
|
inDomain: [activeUser domain]];
|
||||||
|
max = [records count];
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
|
{
|
||||||
|
uid = [[records objectAtIndex: count] objectForKey: @"c_uid"];
|
||||||
|
if ([uid length] > 0)
|
||||||
|
{
|
||||||
|
collection = [[SOGoUser userWithLogin: uid]
|
||||||
|
homeFolderInContext: localContext];
|
||||||
|
[collections addObject: collection];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) _fillCollections: (NSMutableArray *) collections
|
||||||
|
where: (NSString *) key
|
||||||
|
matches: (NSString *) value
|
||||||
|
inContext: (WOContext *) localContext
|
||||||
|
{
|
||||||
if ([key
|
if ([key
|
||||||
isEqualToString: @"{urn:ietf:params:xml:ns:caldav}calendar-home-set"])
|
isEqualToString: @"{urn:ietf:params:xml:ns:caldav}calendar-home-set"])
|
||||||
[self _fillCollections: collections withCalendarHomeSetMatching: value
|
[self _fillCollections: collections withCalendarHomeSetMatching: value
|
||||||
inContext: localContext];
|
inContext: localContext];
|
||||||
|
else if ([key isEqualToString: @"{http://calendarserver.org/ns/}email-address-set"])
|
||||||
|
[self _fillCollections: collections withEmailAddressSetMatching: value
|
||||||
|
inContext: localContext];
|
||||||
else
|
else
|
||||||
[self errorWithFormat: @"principal-property-search: unhandled key '%@'",
|
[self warnWithFormat: @"principal-property-search: unhandled key '%@'",
|
||||||
key];
|
key];
|
||||||
|
|
||||||
return collections;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) _principalCollections: (NSMutableArray **) baseCollections
|
|
||||||
where: (NSString *) key
|
|
||||||
matches: (NSString *) value
|
|
||||||
inContext: (WOContext *) localContext
|
|
||||||
{
|
|
||||||
SOGoUserFolder *currentCollection;
|
|
||||||
unsigned int count, max;
|
|
||||||
|
|
||||||
if (!*baseCollections)
|
|
||||||
*baseCollections = [self _firstPrincipalCollectionsWhere: key
|
|
||||||
matches: value
|
|
||||||
inContext: localContext];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
max = [*baseCollections count];
|
|
||||||
for (count = max; count > 0; count--)
|
|
||||||
{
|
|
||||||
currentCollection = [*baseCollections objectAtIndex: count - 1];
|
|
||||||
if (![currentCollection collectionDavKey: key matches: value])
|
|
||||||
[*baseCollections removeObjectAtIndex: count - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) _principalCollectionsMatching: (NSDictionary *) matches
|
- (NSArray *) _principalCollectionsMatching: (NSDictionary *) matches
|
||||||
|
@ -411,14 +419,14 @@
|
||||||
NSEnumerator *allKeys;
|
NSEnumerator *allKeys;
|
||||||
NSString *currentKey;
|
NSString *currentKey;
|
||||||
|
|
||||||
collections = nil;
|
collections = [NSMutableArray array];
|
||||||
|
|
||||||
allKeys = [[matches allKeys] objectEnumerator];
|
allKeys = [[matches allKeys] objectEnumerator];
|
||||||
while ((currentKey = [allKeys nextObject]))
|
while ((currentKey = [allKeys nextObject]))
|
||||||
[self _principalCollections: &collections
|
[self _fillCollections: collections
|
||||||
where: currentKey
|
where: currentKey
|
||||||
matches: [matches objectForKey: currentKey]
|
matches: [matches objectForKey: currentKey]
|
||||||
inContext: localContext];
|
inContext: localContext];
|
||||||
|
|
||||||
return collections;
|
return collections;
|
||||||
}
|
}
|
||||||
|
@ -453,13 +461,14 @@
|
||||||
SEL methodSel;
|
SEL methodSel;
|
||||||
NSString *currentProperty;
|
NSString *currentProperty;
|
||||||
id currentValue;
|
id currentValue;
|
||||||
NSMutableArray *response, *props;
|
NSMutableArray *response, *props, *propstat;
|
||||||
NSDictionary *keyTuple;
|
NSDictionary *keyTuple;
|
||||||
|
|
||||||
response = [NSMutableArray array];
|
response = [NSMutableArray array];
|
||||||
[response addObject: davElementWithContent (@"href", XMLNS_WEBDAV,
|
[response addObject: davElementWithContent (@"href", XMLNS_WEBDAV,
|
||||||
[collection davURLAsString])];
|
[collection davURLAsString])];
|
||||||
props = [NSMutableArray array];
|
props = [NSMutableArray array];
|
||||||
|
|
||||||
max = [properties count];
|
max = [properties count];
|
||||||
for (count = 0; count < max; count++)
|
for (count = 0; count < max; count++)
|
||||||
{
|
{
|
||||||
|
@ -483,10 +492,13 @@
|
||||||
currentValue)];
|
currentValue)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[response addObject: davElementWithContent (@"propstat", XMLNS_WEBDAV,
|
|
||||||
davElementWithContent
|
propstat = [NSMutableArray array];
|
||||||
(@"prop", XMLNS_WEBDAV,
|
[propstat addObject: davElementWithContent (@"status", XMLNS_WEBDAV,
|
||||||
props))];
|
@"HTTP/1.1 200 OK")];
|
||||||
|
[propstat addObject: davElementWithContent (@"prop", XMLNS_WEBDAV,
|
||||||
|
props)];
|
||||||
|
[response addObject: davElementWithContent (@"propstat", XMLNS_WEBDAV, propstat)];
|
||||||
[responses addObject: davElementWithContent (@"response", XMLNS_WEBDAV,
|
[responses addObject: davElementWithContent (@"response", XMLNS_WEBDAV,
|
||||||
response)];
|
response)];
|
||||||
}
|
}
|
||||||
|
@ -503,8 +515,8 @@
|
||||||
responses = [NSMutableArray arrayWithCapacity: max];
|
responses = [NSMutableArray arrayWithCapacity: max];
|
||||||
for (count = 0; count < max; count++)
|
for (count = 0; count < max; count++)
|
||||||
[self _appendProperties: properties
|
[self _appendProperties: properties
|
||||||
ofCollection: [collections objectAtIndex: count]
|
ofCollection: [collections objectAtIndex: count]
|
||||||
toResponses: responses];
|
toResponses: responses];
|
||||||
mStatus = davElementWithContent (@"multistatus", XMLNS_WEBDAV, responses);
|
mStatus = davElementWithContent (@"multistatus", XMLNS_WEBDAV, responses);
|
||||||
[response appendContentString: [mStatus asWebDavStringWithNamespaces: nil]];
|
[response appendContentString: [mStatus asWebDavStringWithNamespaces: nil]];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue