diff --git a/ChangeLog b/ChangeLog index cc4bf6cb1..ec184ffb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-05-05 Wolfgang Sourdeau + + * SoObjects/Appointments/iCalEntityObject+SOGo.m + (-userIsParticipant:): renamed to "userIsAttendee:". We now + request the list of attendees rather than the list of + participants. + (-userAsParticipant:): renamed to "userAsAttendee:". Again, we + return the attendee matching the user, whether he/she is a + participant or not. + + * SoObjects/SOGo/iCalEntityObject+Utilities.[hm]: removed useless + module, since it implemented methods already found elsewhere. + 2010-05-04 Wolfgang Sourdeau * UI/WebServerResources/ContactsUI.js (initContacts): we must diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index a143f11ef..896c23d2e 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -39,7 +39,6 @@ #import -#import #import #import #import @@ -591,13 +590,13 @@ SOGoUser *currentUser; currentUser = [context activeUser]; - otherAttendee = [event findParticipant: theOwnerUser]; + otherAttendee = [event userAsAttendee: theOwnerUser]; delegateEmail = [otherAttendee delegatedTo]; if ([delegateEmail length]) delegateEmail = [delegateEmail rfc822Email]; if ([delegateEmail length]) - otherDelegate = [event findParticipantWithEmail: delegateEmail]; + otherDelegate = [event findAttendeeWithEmail: delegateEmail]; else otherDelegate = NO; @@ -635,7 +634,7 @@ delegateEmail = [delegateEmail rfc822Email]; if ([delegateEmail length]) - otherDelegate = [event findParticipantWithEmail: delegateEmail]; + otherDelegate = [event findAttendeeWithEmail: delegateEmail]; else otherDelegate = NO; } @@ -708,7 +707,7 @@ delegateEmail = [delegateEmail rfc822Email]; if ([delegateEmail length]) - otherDelegate = [event findParticipantWithEmail: delegateEmail]; + otherDelegate = [event findAttendeeWithEmail: delegateEmail]; else otherDelegate = NO; @@ -792,7 +791,7 @@ delegateEmail = [delegateEmail rfc822Email]; if ([delegateEmail length]) - otherDelegate = [event findParticipantWithEmail: delegateEmail]; + otherDelegate = [event findAttendeeWithEmail: delegateEmail]; else otherDelegate = NO; } @@ -860,7 +859,7 @@ shouldAddSentBy: YES]; } - // We update the calendar of all participants that are + // We update the calendar of all attendees that are // local to the system. This is useful in case user A accepts // invitation from organizer B and users C, D, E who are also // attendees need to verify if A has accepted. @@ -1075,7 +1074,7 @@ [self sendReceiptEmailUsingTemplateNamed: (isUpdate ? @"Update" : @"Invitation") forObject: emailEvent - to: [newEvent participants]]; + to: [newEvent attendees]]; return elements; } @@ -1120,7 +1119,7 @@ [self sendReceiptEmailUsingTemplateNamed: @"Deletion" forObject: event - to: [event participants]]; + to: [event attendees]]; return elements; } @@ -1161,7 +1160,7 @@ } // Find attendee within event - localAttendee = [event findParticipantWithEmail: [attendee rfc822Email]]; + localAttendee = [event findAttendeeWithEmail: [attendee rfc822Email]]; if (localAttendee) { // Update the attendee's status @@ -1230,7 +1229,7 @@ [[event parent] setMethod: @""]; ownerUser = [SOGoUser userWithLogin: [[SOGoUserManager sharedUserManager] getUIDForEmail: originator]]; - attendee = [event findParticipant: ownerUser]; + attendee = [event userAsAttendee: ownerUser]; eventUID = [event uid]; delegate = nil; @@ -1240,7 +1239,7 @@ delegateEmail = [delegateEmail substringFromIndex: 7]; if ([delegateEmail length]) delegate - = [event findParticipantWithEmail: delegateEmail]; + = [event findAttendeeWithEmail: delegateEmail]; } recipientsEnum = [recipients objectEnumerator]; @@ -1326,7 +1325,7 @@ // change will be on the attendee corresponding to the ownerUser. ownerUser = [SOGoUser userWithLogin: owner]; - attendee = [event findParticipant: ownerUser]; + attendee = [event userAsAttendee: ownerUser]; if (attendee) { if (delegate @@ -1338,9 +1337,9 @@ if (delegatedUser != nil && [event userIsOrganizer: delegatedUser]) ex = [NSException exceptionWithHTTPStatus: 403 reason: @"delegate is organizer"]; - if ([event isParticipant: [[delegate email] rfc822Email]]) + if ([event isAttendee: [[delegate email] rfc822Email]]) ex = [NSException exceptionWithHTTPStatus: 403 - reason: @"delegate is a participant"]; + reason: @"delegate is a attendee"]; else if ([SOGoGroup groupWithEmail: [[delegate email] rfc822Email] inDomain: [ownerUser domain]]) ex = [NSException exceptionWithHTTPStatus: 403 @@ -1411,7 +1410,7 @@ to: attendees]; } } - else if ([occurence userIsParticipant: ownerUser]) + else if ([occurence userIsAttendee: ownerUser]) // The current user deletes the occurence; let the organizer know that // the user has declined this occurence. [self changeParticipationStatus: @"DECLINED" withDelegate: nil @@ -1439,7 +1438,7 @@ NSArray *allEvents; int count, max; iCalEvent *currentEvent; - iCalPerson *ownerParticipant; + iCalPerson *ownerAttendee; NSString *key; SOGoUser *ownerUser; @@ -1452,14 +1451,14 @@ for (count = 0; count < max; count++) { currentEvent = [allEvents objectAtIndex: count]; - ownerParticipant = [currentEvent userAsParticipant: ownerUser]; - if (ownerParticipant) + ownerAttendee = [currentEvent userAsAttendee: ownerUser]; + if (ownerAttendee) { if (count == 0) key = @"master"; else key = [[currentEvent recurrenceId] iCalFormattedDateTimeString]; - [partStats setObject: ownerParticipant forKey: key]; + [partStats setObject: ownerAttendee forKey: key]; } } diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index b20668814..9f0b810e5 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -41,7 +41,6 @@ #import #import -#import #import #import #import @@ -825,7 +824,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, p = [app pageWithName: pageName inContext: context]; [p setApt: (iCalEvent *) event]; - attendee = [event findParticipant: from]; + attendee = [event userAsAttendee: from]; [p setAttendee: attendee]; /* construct message */ @@ -897,7 +896,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, if (![event userIsOrganizer: ownerUser]) { organizer = [event organizer]; - attendee = [event findParticipant: ownerUser]; + attendee = [event userAsAttendee: ownerUser]; [event setAttendees: [NSArray arrayWithObject: attendee]]; [self sendIMIPReplyForEvent: event from: from to: organizer]; } @@ -981,7 +980,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, user = [SOGoUser userWithLogin: uid]; component = [self component: NO secure: NO]; - return [component findParticipant: user]; + return [component userAsAttendee: user]; } - (iCalPerson *) iCalPersonWithUID: (NSString *) uid @@ -1061,7 +1060,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, ownerUser = [SOGoUser userWithLogin: owner]; if ([component userIsOrganizer: ownerUser]) role = SOGoCalendarRole_Organizer; - else if ([component userIsParticipant: ownerUser]) + else if ([component userIsAttendee: ownerUser]) role = SOGoCalendarRole_Participant; else role = SOGoRole_None; @@ -1119,7 +1118,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, aclUser = [SOGoUser userWithLogin: uid]; if ([component userIsOrganizer: aclUser]) [roles addObject: SOGoCalendarRole_Organizer]; - else if ([component userIsParticipant: aclUser]) + else if ([component userIsAttendee: aclUser]) [roles addObject: SOGoCalendarRole_Participant]; accessRole = [container roleForComponentsWithAccessClass: [component symbolicAccessClass] diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.h b/SoObjects/Appointments/iCalEntityObject+SOGo.h index 6d52d9e5d..6d1545dcc 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.h +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.h @@ -34,10 +34,10 @@ extern NSNumber *iCalDistantFutureNumber; + (void) initializeSOGoExtensions; -- (BOOL) userIsParticipant: (SOGoUser *) user; +- (BOOL) userIsAttendee: (SOGoUser *) user; - (BOOL) userIsOrganizer: (SOGoUser *) user; -- (iCalPerson *) userAsParticipant: (SOGoUser *) user; +- (iCalPerson *) userAsAttendee: (SOGoUser *) user; - (NSArray *) attendeeUIDs; - (BOOL) isStillRelevant; diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.m b/SoObjects/Appointments/iCalEntityObject+SOGo.m index fe5fac74b..b5d21f6a4 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.m +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.m @@ -57,40 +57,40 @@ NSNumber *iCalDistantFutureNumber = nil; } } -- (BOOL) userIsParticipant: (SOGoUser *) user +- (BOOL) userIsAttendee: (SOGoUser *) user { - NSEnumerator *participants; - iCalPerson *currentParticipant; - BOOL isParticipant; + NSEnumerator *attendees; + iCalPerson *currentAttendee; + BOOL isAttendee; - isParticipant = NO; + isAttendee = NO; - participants = [[self participants] objectEnumerator]; - currentParticipant = [participants nextObject]; - while (!isParticipant - && currentParticipant) - if ([user hasEmail: [currentParticipant rfc822Email]]) - isParticipant = YES; + attendees = [[self attendees] objectEnumerator]; + currentAttendee = [attendees nextObject]; + while (!isAttendee + && currentAttendee) + if ([user hasEmail: [currentAttendee rfc822Email]]) + isAttendee = YES; else - currentParticipant = [participants nextObject]; + currentAttendee = [attendees nextObject]; - return isParticipant; + return isAttendee; } -- (iCalPerson *) userAsParticipant: (SOGoUser *) user +- (iCalPerson *) userAsAttendee: (SOGoUser *) user { - NSEnumerator *participants; - iCalPerson *currentParticipant, *userParticipant; + NSEnumerator *attendees; + iCalPerson *currentAttendee, *userAttendee; - userParticipant = nil; + userAttendee = nil; - participants = [[self participants] objectEnumerator]; - while (!userParticipant - && (currentParticipant = [participants nextObject])) - if ([user hasEmail: [currentParticipant rfc822Email]]) - userParticipant = currentParticipant; + attendees = [[self attendees] objectEnumerator]; + while (!userAttendee + && (currentAttendee = [attendees nextObject])) + if ([user hasEmail: [currentAttendee rfc822Email]]) + userAttendee = currentAttendee; - return userParticipant; + return userAttendee; } - (BOOL) userIsOrganizer: (SOGoUser *) user diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index ac5e0dcaa..58c0970c6 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -34,7 +34,6 @@ SOGo_HEADER_FILES = \ SOGoDateFormatter.h \ SOGoPermissions.h \ SOGoStartupLogger.h \ - iCalEntityObject+Utilities.h \ NSArray+DAV.h \ NSArray+Utilities.h \ NSCalendarDate+SOGo.h \ @@ -103,7 +102,6 @@ SOGo_OBJC_FILES = \ SQLSource.m \ SOGoUserProfile.m \ SOGoSQLUserProfile.m \ - iCalEntityObject+Utilities.m \ NSArray+DAV.m \ NSArray+Utilities.m \ NSCalendarDate+SOGo.m \ diff --git a/SoObjects/SOGo/iCalEntityObject+Utilities.h b/SoObjects/SOGo/iCalEntityObject+Utilities.h deleted file mode 100644 index c60441b59..000000000 --- a/SoObjects/SOGo/iCalEntityObject+Utilities.h +++ /dev/null @@ -1,37 +0,0 @@ -/* iCalEntityObject+Utilities.h - this file is part of SOGo - * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau - * - * 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 - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef ICALENTITYOBJECT_UTILITIES_H -#define ICALENTITYOBJECT_UTILITIES_H - -#import - -@class iCalPerson; -@class SOGoUser; - -@interface iCalEntityObject (SOGoAddition) - -- (iCalPerson *) findParticipant: (SOGoUser *) user; - -@end - -#endif /* ICALENTITYOBJECT_UTILITIES_H */ diff --git a/SoObjects/SOGo/iCalEntityObject+Utilities.m b/SoObjects/SOGo/iCalEntityObject+Utilities.m deleted file mode 100644 index a23594ed7..000000000 --- a/SoObjects/SOGo/iCalEntityObject+Utilities.m +++ /dev/null @@ -1,53 +0,0 @@ -/* iCalEntityObject+Utilities.m - this file is part of SOGo - * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau - * - * 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 - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#import -#import - -#import - -#import "SOGoUser.h" - -#import "iCalEntityObject+Utilities.h" - -#warning we should move this into Appointments. - -@implementation iCalEntityObject (SOGoAddition) - -- (iCalPerson *) findParticipant: (SOGoUser *) user -{ - iCalPerson *participant, *currentParticipant; - NSEnumerator *participants; - - participant = nil; - participants = [[self attendees] objectEnumerator]; - currentParticipant = [participants nextObject]; - while (currentParticipant && !participant) - if ([user hasEmail: [currentParticipant rfc822Email]]) - participant = currentParticipant; - else - currentParticipant = [participants nextObject]; - - return participant; -} - -@end diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index b842246fc..80f8e62d6 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -44,7 +44,6 @@ #import #import #import -#import #import #import #import @@ -378,7 +377,7 @@ - (BOOL) isLoggedInUserAnAttendee { - return [[self authorativeEvent] userIsParticipant: [context activeUser]]; + return [[self authorativeEvent] userIsAttendee: [context activeUser]]; } - (NSString *) currentAttendeeClass @@ -451,7 +450,7 @@ { iCalPerson *currentUser; - currentUser = [[self authorativeEvent] findParticipant: [context activeUser]]; + currentUser = [[self authorativeEvent] userAsAttendee: [context activeUser]]; return currentUser; } @@ -463,7 +462,7 @@ should translate the email to an internal uid and then retrieve all emails addresses for matching the participant. - Note: -findParticipantWithEmail: does not parse the email! + Note: -findAttendeeWithEmail: does not parse the email! */ iCalEvent *e; iCalPerson *p; @@ -473,9 +472,9 @@ e = [self storedEvent]; if (e) { - p = [e findParticipantWithEmail: [self replySenderBaseEMail]]; + p = [e findAttendeeWithEmail: [self replySenderBaseEMail]]; if (!p) - p = [e findParticipantWithEmail:[self replySenderEMail]]; + p = [e findAttendeeWithEmail:[self replySenderEMail]]; } return p; @@ -496,7 +495,7 @@ address = [[mailObject fromEnvelopeAddresses] objectAtIndex: 0]; emailFrom = [address baseEMail]; - return [event findParticipantWithEmail: emailFrom]; + return [event findAttendeeWithEmail: emailFrom]; } - (BOOL) hasSenderStatusChanged