merge of '2cbf84f8b8523601758341cbc178cf538f0a6dee'
and 'f2d1ff2e80e90f3c3d73fe6006e22ee1e9d39b01' Monotone-Parent: 2cbf84f8b8523601758341cbc178cf538f0a6dee Monotone-Parent: f2d1ff2e80e90f3c3d73fe6006e22ee1e9d39b01 Monotone-Revision: 915f4f176feb772bfa74b034b6b7ce28f66778f8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-05-05T13:45:26 Monotone-Branch: ca.inverse.sogomaint-2.0.2
commit
2864ffff1e
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue