Monotone-Parent: fcf51dfbffeff460e370282e0f739875e3414767

Monotone-Revision: f2d1ff2e80e90f3c3d73fe6006e22ee1e9d39b01

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-05-05T13:45:18
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-05-05 13:45:18 +00:00
parent da5fff77e9
commit 312ed2824f
3 changed files with 77 additions and 66 deletions

View File

@ -1,3 +1,12 @@
2010-05-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalEntityObject.m (-resources): removed useless method.
(-nonParticipants): new method returning ATTENDEE objects having
their ROLE attribute set to "NON-PARTICIPANT".
(-isAttendee:): new method.
(-findAttendeeWithEmail): new method replacing
"findParticipantWithEmail:".
2010-04-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalRecurrenceRule.m (-iCalRepresentationForWeekDay:): made
@ -34,7 +43,7 @@
* iCalWeeklyRecurrenceCalculator.m
(-recurrenceRangesWithinCalendarDateRange:): make use of the new
iCalByDayMask class.
iCalByDayMask class.
(-lastInstanceStartDate): make use of the previous method when a
BYxxx mask is defined in the rule.

View File

@ -109,15 +109,16 @@ typedef enum
- (void) addToAttendees: (iCalPerson *) _person;
- (NSArray *) attendees;
- (void) setAttendees: (NSArray *) attendees;
- (BOOL) isAttendee: (id) _email;
- (void) removeFromAttendees: (iCalPerson *) oldAttendee;
- (void) removeAllAttendees;
/* categorize attendees into participants and resources */
/* categorize attendees into participants and non-participants */
- (NSArray *) participants;
- (NSArray *) resources;
- (NSArray *) nonParticipants;
- (BOOL) isParticipant: (id) _email;
- (iCalPerson *) findParticipantWithEmail: (id) _email;
- (iCalPerson *) findAttendeeWithEmail: (id) email;
- (void) removeAllAlarms;
- (void) addToAlarms: (id) _alarm;

View File

@ -330,6 +330,40 @@
return [self childrenWithTag: @"attendee"];
}
- (BOOL) isAttendee: (id) _email
{
NSArray *attEmails;
_email = [_email lowercaseString];
attEmails = [[self attendees] valueForKey:@"rfc822Email"];
attEmails = [attEmails valueForKey: @"lowercaseString"];
return [attEmails containsObject:_email];
}
- (iCalPerson *) findAttendeeWithEmail: (id) email
{
NSArray *attendees;
unsigned int count, max;
NSString *lowerEmail, *currentEmail;
iCalPerson *attendee, *currentAttendee;
attendee = nil;
lowerEmail = [email lowercaseString];
attendees = [self attendees];
max = [attendees count];
for (count = 0; attendee == nil && count < max; count++)
{
currentAttendee = [attendees objectAtIndex: count];
currentEmail = [[currentAttendee rfc822Email] lowercaseString];
if ([currentEmail isEqualToString: lowerEmail])
attendee = currentAttendee;
}
return attendee;
}
- (void) removeAllAlarms
{
[children removeObjectsInArray: [self alarms]];
@ -406,48 +440,6 @@
}
/* stuff */
- (NSArray *) participants
{
return [self _filteredAttendeesThinkingOfPersons: YES];
}
- (NSArray *) resources
{
return [self _filteredAttendeesThinkingOfPersons: NO];
}
- (NSArray *) _filteredAttendeesThinkingOfPersons: (BOOL) _persons
{
NSArray *list;
NSMutableArray *filtered;
unsigned count, max;
iCalPerson *person;
NSString *role;
if (_persons)
{
list = [self attendees];
max = [list count];
filtered = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
person = (iCalPerson *) [list objectAtIndex: count];
role = [[person role] uppercaseString];
if (![role hasPrefix: @"NON-PART"])
[filtered addObject: person];
}
list = filtered;
}
else
list = [self childrenWithTag: @"attendee"
andAttribute: @"role"
havingValue: @"non-part"];
return list;
}
- (BOOL) isOrganizer: (id) _email
{
NSString *organizerMail;
@ -458,6 +450,35 @@
isEqualToString: [_email lowercaseString]];
}
- (NSArray *) participants
{
NSArray *list;
NSMutableArray *filtered;
unsigned count, max;
iCalPerson *person;
NSString *role;
list = [self attendees];
max = [list count];
filtered = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
person = [list objectAtIndex: count];
role = [[person role] uppercaseString];
if (![role hasPrefix: @"NON-PARTICIPANT"])
[filtered addObject: person];
}
return filtered;
}
- (NSArray *) nonParticipants
{
return [self childrenWithTag: @"attendee"
andAttribute: @"role"
havingValue: @"non-participant"];
}
- (BOOL) isParticipant: (id) _email
{
NSArray *partEmails;
@ -468,26 +489,6 @@
return [partEmails containsObject:_email];
}
- (iCalPerson *) findParticipantWithEmail: (id) _email
{
NSArray *ps;
unsigned i, count;
_email = [_email lowercaseString];
ps = [self participants];
count = [ps count];
for (i = 0; i < count; i++) {
iCalPerson *p;
p = [ps objectAtIndex:i];
if ([[[p rfc822Email] lowercaseString] isEqualToString:_email])
return p;
}
return nil; /* not found */
}
- (NSComparisonResult) _compareValue: (id) selfValue
withValue: (id) otherValue
{