diff --git a/ChangeLog b/ChangeLog index cfa955fa6..31b1f9ec3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,13 @@ limited perform a SOAP request to a MS Exhange server to retrieve the freebusy information of a user. + * UI/Scheduler/UIxComponentEditor.m (-_loadAttendees): when the + attendee's email address doesn't match a user from the + authentication source(s), perform a lookup in the addressbook + source(s). If the email matches a user from a source with a + MSExchangeHostname, return a concatenation of the active user uid + and this contact uid. + * UI/WebServerResources/UIxAttendeesEditor.js (performSearchCallback): if a matching contact has the "isMSExchange" attribute, prefix the uid with the login uid. diff --git a/SoObjects/Contacts/SOGoContactSourceFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m index cc25d0d76..16346f935 100644 --- a/SoObjects/Contacts/SOGoContactSourceFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -24,6 +24,7 @@ #import #import #import +#import #import #import @@ -160,6 +161,7 @@ { NSMutableDictionary *newRecord; NSString *data; + NSObject *recordSource; newRecord = [NSMutableDictionary dictionaryWithCapacity: 8]; [newRecord setObject: [oldRecord objectForKey: @"c_uid"] @@ -218,6 +220,11 @@ if ([data length] > 0) [newRecord setObject: data forKey: @"contactInfo"]; + recordSource = [oldRecord objectForKey: @"source"]; + if ([recordSource conformsToProtocol: @protocol (SOGoDNSource)] && + [[(NSObject *) recordSource MSExchangeHostname] length]) + [newRecord setObject: [NSNumber numberWithInt: 1] forKey: @"isMSExchange"]; + return newRecord; } diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 662eaa99e..c6841a5a4 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -61,6 +61,7 @@ #import #import #import +#import #import #import #import @@ -248,9 +249,12 @@ iRANGE(2); { NSEnumerator *attendees; NSMutableDictionary *currentAttendeeData; + NSString *uid, *domain; + NSArray *contacts; + NSDictionary *contact; iCalPerson *currentAttendee; - NSString *uid; SOGoUserManager *um; + NSObject *source; jsonAttendees = [NSMutableDictionary new]; um = [SOGoUserManager sharedUserManager]; @@ -271,6 +275,23 @@ iRANGE(2); if (uid != nil) [currentAttendeeData setObject: uid forKey: @"uid"]; + else + { + domain = [[context activeUser] domain]; + contacts = [um fetchContactsMatching: [currentAttendee rfc822Email] inDomain: domain]; + if ([contacts count] == 1) + { + contact = [contacts lastObject]; + source = [contact objectForKey: @"source"]; + if ([source conformsToProtocol: @protocol (SOGoDNSource)] && + [[(NSObject *) source MSExchangeHostname] length]) + { + uid = [NSString stringWithFormat: @"%@:%@", [[context activeUser] login], + [contact valueForKey: @"c_uid"]]; + [currentAttendeeData setObject: uid forKey: @"uid"]; + } + } + } [currentAttendeeData setObject: [[currentAttendee partStat] lowercaseString] forKey: @"partstat"];