From e866fd5fdaa677879ef611ff72e57140ea664f43 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 28 Oct 2019 14:39:39 -0400 Subject: [PATCH] (fix) fixed Apple Calendar creation (fixes #4813) --- NEWS | 1 + .../SOGoAppointmentFolderObject.m | 4 +--- .../Appointments/SOGoAppointmentFolders.m | 2 +- SoObjects/SOGo/SOGoGCSFolder.m | 19 ++++++++++++++++--- UI/Contacts/UIxContactFolderProperties.m | 2 +- UI/Scheduler/UIxCalendarProperties.m | 2 +- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 723e367c0..0d18f87f5 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ Enhancements Bug fixes - [core] use the supplied Sieve creds to fetch the IMAP4 separator (#4846) + - [core] fixed Apple Calendar creation (#4813) 4.1.0 (2019-10-24) diff --git a/SoObjects/Appointments/SOGoAppointmentFolderObject.m b/SoObjects/Appointments/SOGoAppointmentFolderObject.m index 9a917504a..6e8dd051a 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolderObject.m +++ b/SoObjects/Appointments/SOGoAppointmentFolderObject.m @@ -1,8 +1,6 @@ /* SOGoAppointmentFolderObject.m - this file is part of SOGo * - * Copyright (C) 2010-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2019 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.m b/SoObjects/Appointments/SOGoAppointmentFolders.m index 006af6332..c22442699 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.m +++ b/SoObjects/Appointments/SOGoAppointmentFolders.m @@ -378,7 +378,7 @@ static SoSecurityManager *sm = nil; methodSel = SOGoSelectorForPropertySetter (currentName); if ([newFolder respondsToSelector: methodSel]) [newFolder performSelector: methodSel - withObject: value]; + withObject: value]; } } diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 362b9d32c..68d76a5c7 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -477,11 +477,18 @@ static NSArray *childRecordFields = nil; if ([newName length]) { - [self renameTo: newName]; - error = nil; + NS_DURING + { + [self renameTo: newName]; + error = nil; + } + NS_HANDLER + error = [NSException exceptionWithHTTPStatus: 409 + reason: @"Existing name"]; + NS_ENDHANDLER; } else - error = [NSException exceptionWithHTTPStatus: 400 + error = [NSException exceptionWithHTTPStatus: 403 reason: @"Empty string"]; return error; @@ -645,6 +652,12 @@ static NSArray *childRecordFields = nil; - (void) renameTo: (NSString *) newName { + if (!displayName) + [self displayName]; + + if ([displayName isEqualToString: newName]) + return; + #warning SOGoFolder should have the corresponding method [displayName release]; displayName = nil; diff --git a/UI/Contacts/UIxContactFolderProperties.m b/UI/Contacts/UIxContactFolderProperties.m index 773aedcac..8d99ea2ca 100644 --- a/UI/Contacts/UIxContactFolderProperties.m +++ b/UI/Contacts/UIxContactFolderProperties.m @@ -72,7 +72,7 @@ NS_DURING { o = [params objectForKey: @"name"]; - if ([o isKindOfClass: [NSString class]] && ![o isEqualToString: [addressbook displayName]]) + if ([o isKindOfClass: [NSString class]]) [addressbook renameTo: o]; o = [params objectForKey: @"synchronize"]; diff --git a/UI/Scheduler/UIxCalendarProperties.m b/UI/Scheduler/UIxCalendarProperties.m index 907ba0658..262fa7675 100644 --- a/UI/Scheduler/UIxCalendarProperties.m +++ b/UI/Scheduler/UIxCalendarProperties.m @@ -86,7 +86,7 @@ NS_DURING { o = [params objectForKey: @"name"]; - if ([o isKindOfClass: [NSString class]] && ![o isEqualToString: [calendar displayName]]) + if ([o isKindOfClass: [NSString class]]) [calendar renameTo: o]; o = [params objectForKey: @"color"];