Monotone-Parent: 1c0531a754185ea8992128b43f8114ecf312a212

Monotone-Revision: 50c7cdafb86543f6dae899261002b0e053792856

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-04T15:42:13
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau 2007-09-04 15:42:13 +00:00
parent 0856cd6e79
commit 37e4310b76

View file

@ -23,6 +23,8 @@
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h> #import <Foundation/NSEnumerator.h>
#import <NGCards/iCalPerson.h>
#import <SoObjects/SOGo/NSArray+Utilities.h> #import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h> #import <SoObjects/SOGo/SOGoUser.h>
@ -32,44 +34,31 @@
- (BOOL) userIsParticipant: (SOGoUser *) user - (BOOL) userIsParticipant: (SOGoUser *) user
{ {
NSEnumerator *emails; NSEnumerator *participants;
NSArray *identities; iCalPerson *currentParticipant;
NSString *currentEmail; BOOL isParticipant;
BOOL response;
response = NO; isParticipant = NO;
identities = [user allIdentities]; participants = [[self participants] objectEnumerator];
emails = [[identities objectsForKey: @"email"] objectEnumerator]; currentParticipant = [participants nextObject];
currentEmail = [emails nextObject]; while (!isParticipant
while (!response && currentEmail) && currentParticipant)
if ([self isParticipant: currentEmail]) if ([user hasEmail: [currentParticipant rfc822Email]])
response = YES; isParticipant = YES;
else else
currentEmail = [emails nextObject]; currentParticipant = [participants nextObject];
return response; return isParticipant;
} }
- (BOOL) userIsOrganizer: (SOGoUser *) user - (BOOL) userIsOrganizer: (SOGoUser *) user
{ {
NSEnumerator *emails; NSString *orgMail;
NSArray *identities;
NSString *currentEmail;
BOOL response;
response = NO; orgMail = [[self organizer] rfc822Email];
identities = [user allIdentities]; return [user hasEmail: orgMail];
emails = [[identities objectsForKey: @"email"] objectEnumerator];
currentEmail = [emails nextObject];
while (!response && currentEmail)
if ([self isOrganizer: currentEmail])
response = YES;
else
currentEmail = [emails nextObject];
return response;
} }
@end @end