From 37e4310b7634e45f6a6435185c99b4acdce4b874 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 4 Sep 2007 15:42:13 +0000 Subject: [PATCH] Monotone-Parent: 1c0531a754185ea8992128b43f8114ecf312a212 Monotone-Revision: 50c7cdafb86543f6dae899261002b0e053792856 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-09-04T15:42:13 Monotone-Branch: ca.inverse.sogo --- .../Appointments/iCalEntityObject+SOGo.m | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.m b/SoObjects/Appointments/iCalEntityObject+SOGo.m index 6b67f2da4..3a4411161 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.m +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.m @@ -23,6 +23,8 @@ #import #import +#import + #import #import @@ -32,44 +34,31 @@ - (BOOL) userIsParticipant: (SOGoUser *) user { - NSEnumerator *emails; - NSArray *identities; - NSString *currentEmail; - BOOL response; + NSEnumerator *participants; + iCalPerson *currentParticipant; + BOOL isParticipant; - response = NO; + isParticipant = NO; - identities = [user allIdentities]; - emails = [[identities objectsForKey: @"email"] objectEnumerator]; - currentEmail = [emails nextObject]; - while (!response && currentEmail) - if ([self isParticipant: currentEmail]) - response = YES; + participants = [[self participants] objectEnumerator]; + currentParticipant = [participants nextObject]; + while (!isParticipant + && currentParticipant) + if ([user hasEmail: [currentParticipant rfc822Email]]) + isParticipant = YES; else - currentEmail = [emails nextObject]; + currentParticipant = [participants nextObject]; - return response; + return isParticipant; } - (BOOL) userIsOrganizer: (SOGoUser *) user { - NSEnumerator *emails; - NSArray *identities; - NSString *currentEmail; - BOOL response; + NSString *orgMail; - response = NO; + orgMail = [[self organizer] rfc822Email]; - identities = [user allIdentities]; - emails = [[identities objectsForKey: @"email"] objectEnumerator]; - currentEmail = [emails nextObject]; - while (!response && currentEmail) - if ([self isOrganizer: currentEmail]) - response = YES; - else - currentEmail = [emails nextObject]; - - return response; + return [user hasEmail: orgMail]; } @end