Calendar module optimizations in multidomain setup

Conflicts:
	NEWS
	UI/Common/UIxUserRightsEditor.m
This commit is contained in:
Francis Lachapelle
2015-07-22 16:45:42 -04:00
parent 8f49778501
commit 613f05ac02
9 changed files with 68 additions and 34 deletions
+2
View File
@@ -25,6 +25,8 @@ Bug fixes
- improved EAS email flagging handling (#3140)
- 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)
-------------------
+16 -16
View File
@@ -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
@@ -318,7 +318,7 @@
enumerator = [attendees objectEnumerator];
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
currentUID = [currentAttendee uidInContext: context];
if (currentUID)
[self _removeEventFromUID: currentUID
owner: owner
@@ -399,7 +399,7 @@
enumerator = [updateAttendees objectEnumerator];
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
currentUID = [currentAttendee uidInContext: context];
if (currentUID)
[self _addOrUpdateEvent: newEvent
forUID: currentUID
@@ -439,7 +439,7 @@
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
currentUID = [currentAttendee uidInContext: context];
if (currentUID)
{
@@ -521,7 +521,7 @@
enumerator = [theAttendees objectEnumerator];
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
currentUID = [currentAttendee uidInContext: context];
if (currentUID)
{
[attendees addObject: currentUID];
@@ -636,7 +636,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;
@@ -714,7 +714,7 @@
enumerator = [attendees objectEnumerator];
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
currentUID = [currentAttendee uidInContext: context];
if (currentUID)
[self _addOrUpdateEvent: newEvent
forUID: currentUID
@@ -839,7 +839,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
@@ -1216,7 +1216,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
@@ -1245,7 +1245,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
if (addDelegate)
{
delegatedUID = [delegate uid];
delegatedUID = [delegate uidInContext: context];
delegates = [NSArray arrayWithObject: delegate];
[event addToAttendees: delegate];
@@ -1272,11 +1272,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.
@@ -1303,7 +1303,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
@@ -1462,7 +1462,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])
@@ -1832,7 +1832,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;
@@ -2145,7 +2145,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)
@@ -523,16 +523,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];
}
+3 -4
View File
@@ -1,9 +1,6 @@
/* iCalPerson+SOGo.h - this file is part of SOGo
*
* Copyright (C) 2007-2012 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* 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;
+19 -4
View File
@@ -1,9 +1,6 @@
/* iCalPerson+SOGo.m - this file is part of SOGo
*
* Copyright (C) 2007-2012 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* 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;
+12 -2
View File
@@ -195,11 +195,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;
}
- (NSDictionary *) currentUserInfos
+11 -4
View File
@@ -1,6 +1,6 @@
/* UIxUserRightsEditor.m - this file is part of SOGo
*
* Copyright (C) 2007-2014 Inverse inc.
* 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
@@ -90,6 +90,7 @@
- (NSString *) userDisplayName
{
NSDictionary *infos;
SOGoUserManager *um;
if ([self userIsAnonymousUser])
@@ -103,9 +104,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;
}
}
+1 -1
View File
@@ -303,7 +303,7 @@
delegatedAttendee = [iCalPerson new];
[delegatedAttendee autorelease];
[delegatedAttendee setEmail: delegatedEmail];
delegatedUid = [delegatedAttendee uid];
delegatedUid = [delegatedAttendee uidInDomain: [user domain]];
if (delegatedUid)
{
SOGoUser *delegatedUser;
+1 -1
View File
@@ -293,7 +293,7 @@
delegatedAttendee = [iCalPerson new];
[delegatedAttendee autorelease];
[delegatedAttendee setEmail: delegatedEmail];
delegatedUid = [delegatedAttendee uid];
delegatedUid = [delegatedAttendee uidInDomain: [user domain]];
if (delegatedUid)
{
SOGoUser *delegatedUser;