Monotone-Parent: de6d837f5c2b62b4ad465872fdc54602b3d1009c

Monotone-Revision: 1ccd34fd9ea99e675935d745db7e70d19716428a

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-05-05T13:56:19
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-05-05 13:56:19 +00:00
parent 82a38c87fb
commit f7799b9cf8
9 changed files with 68 additions and 150 deletions

View File

@ -1,3 +1,16 @@
2010-05-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* 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 <wsourdeau@inverse.ca>
* UI/WebServerResources/ContactsUI.js (initContacts): we must

View File

@ -39,7 +39,6 @@
#import <SOPE/NGCards/NSString+NGCards.h>
#import <SOGo/iCalEntityObject+Utilities.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSObject+DAV.h>
@ -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];
}
}

View File

@ -41,7 +41,6 @@
#import <NGMime/NGMimeMultipartBody.h>
#import <NGMail/NGMimeMessage.h>
#import <SOGo/iCalEntityObject+Utilities.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSObject+DAV.h>
@ -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]

View File

@ -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;

View File

@ -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

View File

@ -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 \

View File

@ -1,37 +0,0 @@
/* iCalEntityObject+Utilities.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* 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 <NGCards/iCalEntityObject.h>
@class iCalPerson;
@class SOGoUser;
@interface iCalEntityObject (SOGoAddition)
- (iCalPerson *) findParticipant: (SOGoUser *) user;
@end
#endif /* ICALENTITYOBJECT_UTILITIES_H */

View File

@ -1,53 +0,0 @@
/* iCalEntityObject+Utilities.m - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* 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 <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
#import <NGCards/iCalPerson.h>
#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

View File

@ -44,7 +44,6 @@
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserFolder.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/iCalEntityObject+Utilities.h>
#import <Appointments/iCalEntityObject+SOGo.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h>
@ -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