From d66e63d3de61f53c16ac03226e80a6bcfde96ac7 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 7 Nov 2007 23:35:26 +0000 Subject: [PATCH] Monotone-Parent: 1fb2ab16dbaee22f67d20e86943f297a72cf6c72 Monotone-Revision: 21e396c8605b155acfec0b2ce58b23eb13319cf3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-07T23:35:26 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 ++ .../Appointments/SOGoAppointmentObject.m | 48 ++++++------------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9142242ee..754a4edf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-11-07 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoAppointmentObject.m + ([SOGoAppointmentObject -saveContentString:_iCalinUIDs:_uids]): + simplified method by directly building a similar appointment + object with the current folder as container. + * SoObjects/Contacts/SOGoContactLDAPFolder.m ([SOGoContactLDAPFolder -appendObject:objectwithBaseURL:baseURLtoREPORTResponse:r]): diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 59f96d69e..8b2f12b54 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -106,43 +106,23 @@ NSEnumerator *e; id folder; NSException *allErrors = nil; - + NSException *error; + SOGoAppointmentObject *apt; + e = [[container lookupCalendarFoldersForUIDs:_uids inContext: context] objectEnumerator]; - while ((folder = [e nextObject]) != nil) { - NSException *error; - SOGoAppointmentObject *apt; - - if (![folder isNotNull]) /* no folder was found for given UID */ - continue; - - apt = [folder lookupName: [self nameInContainer] inContext: context - acquire: NO]; - if ([apt isKindOfClass: [NSException class]]) - { - [self logWithFormat:@"Note: an exception occured finding '%@' in folder: %@", - [self nameInContainer], folder]; - [self logWithFormat:@"the exception reason was: %@", - [(NSException *) apt reason]]; - continue; - } - - if (![apt isNotNull]) { - [self logWithFormat:@"Note: did not find '%@' in folder: %@", - [self nameInContainer], folder]; - continue; + while ((folder = [e nextObject])) + { + apt = [SOGoAppointmentObject objectWithName: nameInContainer + inContainer: folder]; + error = [apt primarySaveContentString:_iCal]; + if (error) + { + [self logWithFormat:@"Note: failed to save iCal in folder: %@", folder]; + // TODO: make compound + allErrors = error; + } } - if ([apt isKindOfClass: [NSException class]]) { - [self logWithFormat:@"Exception: %@", [(NSException *) apt reason]]; - continue; - } - - if ((error = [apt primarySaveContentString:_iCal]) != nil) { - [self logWithFormat:@"Note: failed to save iCal in folder: %@", folder]; - // TODO: make compound - allErrors = error; - } - } return allErrors; }