diff --git a/NEWS b/NEWS index dde42eeaf..867b4ea97 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Bug fixes - fixed computation of GlobalObjectId (#3235) - fixed EAS conversation ID issues on BB10 (#3152) - fixed CR/LF printing in event's description (#3228) + - optimized Calendar module in multidomain configurations 2.3.0 (2015-06-01) ------------------- diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index e26bb405d..158a53f6b 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2014 Inverse inc. + Copyright (C) 2007-2015 Inverse inc. Copyright (C) 2004-2005 SKYRIX Software AG This file is part of SOGo @@ -317,7 +317,7 @@ enumerator = [attendees objectEnumerator]; while ((currentAttendee = [enumerator nextObject])) { - currentUID = [currentAttendee uid]; + currentUID = [currentAttendee uidInContext: context]; if (currentUID) [self _removeEventFromUID: currentUID owner: owner @@ -398,7 +398,7 @@ enumerator = [updateAttendees objectEnumerator]; while ((currentAttendee = [enumerator nextObject])) { - currentUID = [currentAttendee uid]; + currentUID = [currentAttendee uidInContext: context]; if (currentUID) [self _addOrUpdateEvent: newEvent forUID: currentUID @@ -438,7 +438,7 @@ while ((currentAttendee = [enumerator nextObject])) { - currentUID = [currentAttendee uid]; + currentUID = [currentAttendee uidInContext: context]; if (currentUID) { @@ -520,7 +520,7 @@ enumerator = [theAttendees objectEnumerator]; while ((currentAttendee = [enumerator nextObject])) { - currentUID = [currentAttendee uid]; + currentUID = [currentAttendee uidInContext: context]; if (currentUID) { [attendees addObject: currentUID]; @@ -635,7 +635,7 @@ for (i = 0; i < [theAttendees count]; i++) { currentAttendee = [theAttendees objectAtIndex: i]; - if ([[currentAttendee uid] isEqualToString: currentUID]) + if ([[currentAttendee uidInContext: context] isEqualToString: currentUID]) break; else currentAttendee = nil; @@ -713,7 +713,7 @@ enumerator = [attendees objectEnumerator]; while ((currentAttendee = [enumerator nextObject])) { - currentUID = [currentAttendee uid]; + currentUID = [currentAttendee uidInContext: context]; if (currentUID) [self _addOrUpdateEvent: newEvent forUID: currentUID @@ -838,7 +838,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent enumerator = [updatedAttendees objectEnumerator]; while ((currentAttendee = [enumerator nextObject])) { - currentUID = [currentAttendee uid]; + currentUID = [currentAttendee uidInContext: context]; if (currentUID) [self _addOrUpdateEvent: newEvent forUID: currentUID @@ -1215,7 +1215,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent { [delegates addObject: otherDelegate]; - delegatedUID = [otherDelegate uid]; + delegatedUID = [otherDelegate uidInContext: context]; if (delegatedUID) // Delegate attendee is a local user; remove event from their calendar [self _removeEventFromUID: delegatedUID @@ -1244,7 +1244,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent if (addDelegate) { - delegatedUID = [delegate uid]; + delegatedUID = [delegate uidInContext: context]; delegates = [NSArray arrayWithObject: delegate]; [event addToAttendees: delegate]; @@ -1271,11 +1271,11 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent [self sendResponseToOrganizer: event from: ownerUser]; - organizerUID = [[event organizer] uid]; + organizerUID = [[event organizer] uidInContext: context]; // Event is an exception to a recurring event; retrieve organizer from master event if (!organizerUID) - organizerUID = [[(iCalEntityObject*)[[event parent] firstChildWithTag: [self componentTag]] organizer] uid]; + organizerUID = [[(iCalEntityObject*)[[event parent] firstChildWithTag: [self componentTag]] organizer] uidInContext: context]; if (organizerUID) // Update the attendee in organizer's calendar. @@ -1302,7 +1302,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent for (i = 0; i < [attendees count]; i++) { att = [attendees objectAtIndex: i]; - uid = [att uid]; + uid = [att uidInContext: context]; if (uid && att != attendee && ![uid isEqualToString: delegatedUID]) [self _updateAttendee: attendee withDelegate: delegate @@ -1461,7 +1461,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent { if (delegate && ![[delegate email] isEqualToString: [attendee delegatedTo]]) { - delegatedUid = [delegate uid]; + delegatedUid = [delegate uidInContext: context]; if (delegatedUid) delegatedUser = [SOGoUser userWithLogin: delegatedUid]; if (delegatedUser != nil && [event userIsOrganizer: delegatedUser]) @@ -1831,7 +1831,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent // We now make sure that the organizer, if managed by SOGo, is using // its default email when creating events and inviting attendees. - uid = [[SOGoUserManager sharedUserManager] getUIDForEmail: [[event organizer] rfc822Email]]; + uid = [[event organizer] uidInContext: context]; if (uid) { NSDictionary *defaultIdentity; @@ -2144,7 +2144,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent // occurence, and invite someone, the PUT will have the organizer in the // recurrence-id and not in the master event. We must fix this, otherwise // SOGo will break. - if (!recurrenceId && ![[[[[newEvent parent] events] objectAtIndex: 0] organizer] uid]) + if (!recurrenceId && ![[[[[newEvent parent] events] objectAtIndex: 0] organizer] uidInContext: context]) [[[[newEvent parent] events] objectAtIndex: 0] setOrganizer: [newEvent organizer]]; if (userIsOrganizer) diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.m b/SoObjects/Appointments/iCalEntityObject+SOGo.m index 48ba026c3..cfdfc445e 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.m +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.m @@ -184,16 +184,17 @@ NSNumber *iCalDistantFutureNumber = nil; NSArray *oldAttendees; unsigned int count, max; iCalPerson *currentAttendee; - NSString *userID; + NSString *userID, *domain; userID = [user login]; + domain = [user domain]; oldAttendees = [self attendees]; max = [oldAttendees count]; newAttendees = [NSMutableArray arrayWithCapacity: max]; for (count = 0; count < max; count++) { currentAttendee = [oldAttendees objectAtIndex: count]; - if (![[currentAttendee uid] isEqualToString: userID]) + if (![[currentAttendee uidInDomain: domain] isEqualToString: userID]) [newAttendees addObject: currentAttendee]; } diff --git a/SoObjects/Appointments/iCalPerson+SOGo.h b/SoObjects/Appointments/iCalPerson+SOGo.h index 3ce9d31a5..87a499f9d 100644 --- a/SoObjects/Appointments/iCalPerson+SOGo.h +++ b/SoObjects/Appointments/iCalPerson+SOGo.h @@ -1,9 +1,6 @@ /* iCalPerson+SOGo.h - this file is part of SOGo * - * Copyright (C) 2007-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau - * Ludovic Marcotte + * Copyright (C) 2007-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +29,8 @@ - (NSString *) mailAddress; - (NSString *) uid; +- (NSString *) uidInDomain: (NSString *) domain; +- (NSString *) uidInContext: (WOContext *) context; - (NSString *) contactIDInContext: (WOContext *) context; - (BOOL) hasSentBy; - (NSString *) sentBy; diff --git a/SoObjects/Appointments/iCalPerson+SOGo.m b/SoObjects/Appointments/iCalPerson+SOGo.m index e3473c969..4180ff866 100644 --- a/SoObjects/Appointments/iCalPerson+SOGo.m +++ b/SoObjects/Appointments/iCalPerson+SOGo.m @@ -1,9 +1,6 @@ /* iCalPerson+SOGo.m - this file is part of SOGo * - * Copyright (C) 2007-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau - * Ludovic Marcotte + * Copyright (C) 2007-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,6 +64,24 @@ static SOGoUserManager *um = nil; return [um getUIDForEmail: [self rfc822Email]]; } +- (NSString *) uidInContext: (WOContext *) context +{ + NSString *domain; + + domain = [[context activeUser] domain]; + + return [self uidInDomain: domain]; +} + +- (NSString *) uidInDomain: (NSString *) domain +{ + if (!um) + um = [SOGoUserManager sharedUserManager]; + + return [um contactInfosForUserWithUIDorEmail: [self rfc822Email] + inDomain: domain]; +} + - (NSString *) contactIDInContext: (WOContext *) context { NSString *domain, *uid; diff --git a/UI/Common/UIxAclEditor.m b/UI/Common/UIxAclEditor.m index 8c39a7ebd..14c0f64bd 100644 --- a/UI/Common/UIxAclEditor.m +++ b/UI/Common/UIxAclEditor.m @@ -126,11 +126,21 @@ - (NSString *) currentUserDisplayName { + NSDictionary *infos; + NSString *uid; SOGoUserManager *um; um = [SOGoUserManager sharedUserManager]; - - return [um getFullEmailForUID: [self currentUser]]; + uid = [self currentUser]; + infos = [um contactInfosForUserWithUIDorEmail: uid inDomain: [[context activeUser] domain]]; + if (infos) + { + return [NSString stringWithFormat: @"%@ <%@>", + [infos objectForKey: @"cn"], + [infos objectForKey: @"c_email"]]; + } + else + return uid; } - (BOOL) canSubscribeUsers diff --git a/UI/Common/UIxUserRightsEditor.m b/UI/Common/UIxUserRightsEditor.m index 3519abc0e..79f631326 100644 --- a/UI/Common/UIxUserRightsEditor.m +++ b/UI/Common/UIxUserRightsEditor.m @@ -1,8 +1,6 @@ /* UIxUserRightsEditor.m - this file is part of SOGo * - * Copyright (C) 2007-2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +18,8 @@ * Boston, MA 02111-1307, USA. */ +#import + #import #import #import @@ -86,6 +86,7 @@ - (NSString *) userDisplayName { + NSDictionary *infos; SOGoUserManager *um; if ([self userIsAnonymousUser]) @@ -99,9 +100,15 @@ else { um = [SOGoUserManager sharedUserManager]; - return [NSString stringWithFormat: @"%@ <%@>", - [um getCNForUID: uid], - [um getEmailForUID: uid]]; + infos = [um contactInfosForUserWithUIDorEmail: uid inDomain: [[context activeUser] domain]]; + if (infos) + { + return [NSString stringWithFormat: @"%@ <%@>", + [infos objectForKey: @"cn"], + [infos objectForKey: @"c_email"]]; + } + else + return uid; } } diff --git a/UI/MailPartViewers/UIxMailPartICalActions.m b/UI/MailPartViewers/UIxMailPartICalActions.m index e068ebbe5..567412818 100644 --- a/UI/MailPartViewers/UIxMailPartICalActions.m +++ b/UI/MailPartViewers/UIxMailPartICalActions.m @@ -300,7 +300,7 @@ delegatedAttendee = [iCalPerson new]; [delegatedAttendee autorelease]; [delegatedAttendee setEmail: delegatedEmail]; - delegatedUid = [delegatedAttendee uid]; + delegatedUid = [delegatedAttendee uidInDomain: [user domain]]; if (delegatedUid) { SOGoUser *delegatedUser; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 653226628..314ee6681 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -452,7 +452,7 @@ delegatedAttendee = [iCalPerson new]; [delegatedAttendee autorelease]; [delegatedAttendee setEmail: delegatedEmail]; - delegatedUid = [delegatedAttendee uid]; + delegatedUid = [delegatedAttendee uidInDomain: [user domain]]; if (delegatedUid) { SOGoUser *delegatedUser;