From eba307e5c0fc1c6c9ff72901a53273ecd420bfef Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 26 Nov 2008 12:20:26 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 8c84d6a640b03db846372423022159e6855f501a Monotone-Revision: 1fc6240dbb88ca9e470be6d2679ee8e3e10e4f4f Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-11-26T12:20:26 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 +++ .../Appointments/SOGoAppointmentObject.m | 60 ++++++++++++------- SoObjects/SOGo/SOGoGCSFolder.m | 4 +- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea9e8b302..8c7cc8e24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-26 Ludovic Marcotte + + * SoObjects/SOGo/SOGoGCSFolder.m + We escape the ' character in the folder name + before trying to set it. + * SoObjects/Appointments/SOGoAppointmentObject.m + We now handle the originator/organizer correctly + when posting CalDAV messages. + 2008-11-24 Ludovic Marcotte * We now sort the results in the subsription window diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 0b0bf24af..9af4d6846 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -190,29 +190,30 @@ return object; } -- (void) _addOrUpdateEvent: (iCalEvent *) event - forUID: (NSString *) uid +- (void) _addOrUpdateEvent: (iCalEvent *) theEvent + forUID: (NSString *) theUID + owner: (NSString *) theOwner { - SOGoAppointmentObject *object; - NSString *iCalString, *userLogin; - - userLogin = [[context activeUser] login]; - if (![uid isEqualToString: userLogin]) + if (![theUID isEqualToString: theOwner]) { - object = [self _lookupEvent: [event uid] forUID: uid]; - iCalString = [[event parent] versitString]; + SOGoAppointmentObject *object; + NSString *iCalString; + + object = [self _lookupEvent: [theEvent uid] forUID: theUID]; + iCalString = [[theEvent parent] versitString]; [object saveContentString: iCalString]; } } -- (void) _removeEventFromUID: (NSString *) uid +- (void) _removeEventFromUID: (NSString *) theUID + owner: (NSString *) theOwner { - SOGoAppointmentFolder *folder; - SOGoAppointmentObject *object; - - if (![uid isEqualToString: owner]) + if (![theUID isEqualToString: theOwner]) { - folder = [container lookupCalendarFolderForUID: uid]; + SOGoAppointmentFolder *folder; + SOGoAppointmentObject *object; + + folder = [container lookupCalendarFolderForUID: theUID]; object = [folder lookupName: nameInContainer inContext: context acquire: NO]; if (![object isKindOfClass: [NSException class]]) @@ -232,7 +233,8 @@ { currentUID = [currentAttendee uid]; if (currentUID) - [self _removeEventFromUID: currentUID]; + [self _removeEventFromUID: currentUID + owner: owner]; } } @@ -268,7 +270,8 @@ currentUID = [currentAttendee uid]; if (currentUID) [self _addOrUpdateEvent: newEvent - forUID: currentUID]; + forUID: currentUID + owner: owner]; } [self sendEMailUsingTemplateNamed: @"Update" @@ -290,7 +293,8 @@ currentUID = [currentAttendee uid]; if (currentUID) [self _addOrUpdateEvent: newEvent - forUID: currentUID]; + forUID: currentUID + owner: owner]; } } @@ -587,6 +591,14 @@ return code; } +// +// The originator here is the owner of the calendar where +// the event was created. Lightning sends us exactly this +// and handles the SENT-BY itself. We might have to review +// this if the originator ever becomes the user on whom +// the act is performed (ie. Alice creates an event in Bob's +// calendar and invites Thomas). +// - (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients from: (NSString *) originator { @@ -629,7 +641,10 @@ else hasChanged = NO; } - [self _addOrUpdateEvent: event forUID: uid]; + [self _addOrUpdateEvent: event + forUID: uid + owner: [[LDAPUserManager sharedUserManager] + getUIDForEmail: originator]]; } #warning fix this when sendEmailUsing blabla has been cleaned up if (hasChanged) @@ -646,6 +661,9 @@ return elements; } +// +// See our comment about the originator in the method above. +// - (NSArray *) postCalDAVEventCancelTo: (NSArray *) recipients from: (NSString *) originator { @@ -666,7 +684,9 @@ [person setValue: 0 to: recipient]; uid = [person uid]; if (uid) - [self _removeEventFromUID: uid]; + [self _removeEventFromUID: uid + owner: [[LDAPUserManager sharedUserManager] + getUIDForEmail: originator]]; #warning fix this when sendEmailUsing blabla has been cleaned up [self sendEMailUsingTemplateNamed: @"Deletion" forObject: event diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 32290caa5..eb2a67f9f 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -444,7 +444,9 @@ static NSArray *childRecordFields = nil; sql = [NSString stringWithFormat: (@"UPDATE %@ SET c_foldername = '%@'" @" WHERE c_path = '%@'"), - [folderLocation gcsTableName], newName, ocsPath]; + [folderLocation gcsTableName], + [newName stringByReplacingString: @"'" withString: @"''"], + ocsPath]; [fc evaluateExpressionX: sql]; [cm releaseChannel: fc]; // sql = [sql stringByAppendingFormat:@" WHERE %@ = '%@'",