From 89b67f843485e7626b507dd9d2e24ed9045745a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 10 Aug 2009 20:57:22 +0000 Subject: [PATCH] Monotone-Parent: 9014b61a856557f48bcdb06cd327ce958a4d98c7 Monotone-Revision: 14fb6c252ef1563d917c59f289ac3d06479a7eab Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-08-10T20:57:22 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/Appointments/iCalEntityObject+SOGo.h | 2 ++ SoObjects/Appointments/iCalEntityObject+SOGo.m | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0a31dbe64..0cdf1a778 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ 2009-08-10 Wolfgang Sourdeau + * SoObjects/Appointments/iCalEntityObject+SOGo.m + (-userAsParticipant): new method that returns the "PARTICIPANT" + entity of the SOGoUser passed as parameter, if found. + * Tests/webdavlib.py (WebDAVClient._prepare_headers): fixed a typo causing the "depth" parameter to never be issued in query heades. diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.h b/SoObjects/Appointments/iCalEntityObject+SOGo.h index 5bf7e58c4..294b93030 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.h +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.h @@ -37,6 +37,8 @@ NSNumber *iCalDistantFutureNumber; - (BOOL) userIsParticipant: (SOGoUser *) user; - (BOOL) userIsOrganizer: (SOGoUser *) user; +- (iCalPerson *) userAsParticipant: (SOGoUser *) user; + - (NSArray *) attendeeUIDs; - (BOOL) isStillRelevant; diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.m b/SoObjects/Appointments/iCalEntityObject+SOGo.m index fa2941b4a..afc6b5dd5 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.m +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.m @@ -96,6 +96,22 @@ _computeAllDayOffset() return isParticipant; } +- (iCalPerson *) userAsParticipant: (SOGoUser *) user +{ + NSEnumerator *participants; + iCalPerson *currentParticipant, *userParticipant; + + userParticipant = nil; + + participants = [[self participants] objectEnumerator]; + while (!userParticipant + && (currentParticipant = [participants nextObject])) + if ([user hasEmail: [currentParticipant rfc822Email]]) + userParticipant = currentParticipant; + + return userParticipant; +} + - (BOOL) userIsOrganizer: (SOGoUser *) user { NSString *mail;