From e18608e58b1796d4a43b34f339bd14c79345dc11 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 18 Apr 2012 19:13:26 +0000 Subject: [PATCH] Monotone-Parent: e7a3d03032fdca1b9564002f83fa7c9947b6cb17 Monotone-Revision: 2d2d3a51a60fe527ccb060a620cf04792ccfb293 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-04-18T19:13:26 --- ChangeLog | 4 ++ .../Appointments/SOGoAppointmentFolders.m | 38 ++++++++++++------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index d341b1bd9..965f29b80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-04-18 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoAppointmentFolders.m + (-newWebCalendarWithName:atURL:): perform sanity checks on the url + parameter. + * SoObjects/Appointments/SOGoWebAppointmentFolder.m (-setUsername:andPassword:): new method that associate an encrypted login pair for authenticating to remove calendars. diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.m b/SoObjects/Appointments/SOGoAppointmentFolders.m index 3a8e020aa..24ddf9879 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.m +++ b/SoObjects/Appointments/SOGoAppointmentFolders.m @@ -25,6 +25,7 @@ #import #import #import +#import #import #import @@ -133,25 +134,35 @@ static SoSecurityManager *sm = nil; - (SOGoWebAppointmentFolder *) newWebCalendarWithName: (NSString *) folderDisplayName - atURL: (NSString *) url + atURL: (NSString *) urlString { + NSException *error; SOGoAppointmentFolder *aptFolder; SOGoWebAppointmentFolder *webCalendar; NSString *name; + NSURL *url; - if ([self newFolderWithName: folderDisplayName - nameInContainer: &name]) - webCalendar = nil; - else + webCalendar = nil; + + if ([folderDisplayName length] > 0 && [urlString length] > 0) { - aptFolder = [subFolders objectForKey: name]; - [aptFolder setFolderPropertyValue: url - inCategory: @"WebCalendars"]; - - webCalendar = [SOGoWebAppointmentFolder objectWithName: name - inContainer: self]; - [webCalendar setOCSPath: [aptFolder ocsPath]]; - [subFolders setObject: webCalendar forKey: name]; + url = [NSURL URLWithString: urlString]; + if ([[url scheme] hasPrefix: @"http"]) + { + error = [self newFolderWithName: folderDisplayName + nameInContainer: &name]; + if (!error) + { + aptFolder = [subFolders objectForKey: name]; + [aptFolder setFolderPropertyValue: urlString + inCategory: @"WebCalendars"]; + + webCalendar = [SOGoWebAppointmentFolder objectWithName: name + inContainer: self]; + [webCalendar setOCSPath: [aptFolder ocsPath]]; + [subFolders setObject: webCalendar forKey: name]; + } + } } return webCalendar; @@ -542,6 +553,7 @@ static SoSecurityManager *sm = nil; calSettings = [us objectForKey: @"Calendar"]; refs = [[calSettings objectForKey: @"WebCalendars"] allKeys]; max = [refs count]; + for (count = 0; count < max; count++) { ref = [refs objectAtIndex: count];