diff --git a/ChangeLog b/ChangeLog index ed0409dd3..9fb63e9da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-10-31 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoAppointmentObject.m + ([SOGoAppointmentObject + -saveContentString:contentStringbaseVersion:baseVersion]): + overloaded method that parse new events and detects if they have + an organizer or not. If they are new and have no organizer set + (Sunbird/Lightning...), the owner of the event is set as + organizer. + * SoObjects/Appointments/iCalEntityObject+Agenor.[hm]: new category that provides facility methods and interfaces to the AgenorUserManager. diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index b94239206..4de627a55 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -29,7 +29,10 @@ #import #import #import + #import "SOGoAptMailNotification.h" +#import "iCalEntityObject+Agenor.h" + #import "common.h" #import "NSArray+Appointments.h" @@ -507,6 +510,7 @@ static NSString *mailTemplateDefaultLanguage = nil; - (NSException *)saveContentString:(NSString *)_iCalString { return [self saveContentString:_iCalString baseSequence:0]; } + - (NSException *)delete { return [self deleteWithBaseSequence:0]; } @@ -610,6 +614,34 @@ static NSString *mailTemplateDefaultLanguage = nil; return [self serverTimeZone]; } +- (NSException *) saveContentString: (NSString *) contentString + baseVersion: (unsigned int) baseVersion +{ + NSString *newContentString, *oldContentString; + iCalCalendar *eventCalendar; + iCalEvent *event; + NSArray *organizers; + + oldContentString = [self iCalString]; + if (oldContentString) + newContentString = contentString; + else + { + eventCalendar = [iCalCalendar parseSingleFromSource: contentString]; + event = [self firstEventFromCalendar: eventCalendar]; + organizers = [event childrenWithTag: @"organizer"]; + if ([organizers count]) + newContentString = contentString; + else + { + [event setOrganizerWithUid: [self ownerInContext: nil]]; + newContentString = [eventCalendar versitString]; + } + } + + return [super saveContentString: newContentString + baseVersion: baseVersion]; +} - (void)sendEMailUsingTemplateNamed:(NSString *)_pageName forOldAppointment:(iCalEvent *)_oldApt