(fix) fixed Apple Calendar creation (fixes #4813)

pull/262/head
Ludovic Marcotte 2019-10-28 14:39:39 -04:00
parent 7ff9921709
commit e866fd5fda
6 changed files with 21 additions and 9 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ Enhancements
Bug fixes Bug fixes
- [core] use the supplied Sieve creds to fetch the IMAP4 separator (#4846) - [core] use the supplied Sieve creds to fetch the IMAP4 separator (#4846)
- [core] fixed Apple Calendar creation (#4813)
4.1.0 (2019-10-24) 4.1.0 (2019-10-24)

View File

@ -1,8 +1,6 @@
/* SOGoAppointmentFolderObject.m - this file is part of SOGo /* SOGoAppointmentFolderObject.m - this file is part of SOGo
* *
* Copyright (C) 2010-2012 Inverse inc. * Copyright (C) 2010-2019 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@ -378,7 +378,7 @@ static SoSecurityManager *sm = nil;
methodSel = SOGoSelectorForPropertySetter (currentName); methodSel = SOGoSelectorForPropertySetter (currentName);
if ([newFolder respondsToSelector: methodSel]) if ([newFolder respondsToSelector: methodSel])
[newFolder performSelector: methodSel [newFolder performSelector: methodSel
withObject: value]; withObject: value];
} }
} }

View File

@ -477,11 +477,18 @@ static NSArray *childRecordFields = nil;
if ([newName length]) if ([newName length])
{ {
[self renameTo: newName]; NS_DURING
error = nil; {
[self renameTo: newName];
error = nil;
}
NS_HANDLER
error = [NSException exceptionWithHTTPStatus: 409
reason: @"Existing name"];
NS_ENDHANDLER;
} }
else else
error = [NSException exceptionWithHTTPStatus: 400 error = [NSException exceptionWithHTTPStatus: 403
reason: @"Empty string"]; reason: @"Empty string"];
return error; return error;
@ -645,6 +652,12 @@ static NSArray *childRecordFields = nil;
- (void) renameTo: (NSString *) newName - (void) renameTo: (NSString *) newName
{ {
if (!displayName)
[self displayName];
if ([displayName isEqualToString: newName])
return;
#warning SOGoFolder should have the corresponding method #warning SOGoFolder should have the corresponding method
[displayName release]; [displayName release];
displayName = nil; displayName = nil;

View File

@ -72,7 +72,7 @@
NS_DURING NS_DURING
{ {
o = [params objectForKey: @"name"]; o = [params objectForKey: @"name"];
if ([o isKindOfClass: [NSString class]] && ![o isEqualToString: [addressbook displayName]]) if ([o isKindOfClass: [NSString class]])
[addressbook renameTo: o]; [addressbook renameTo: o];
o = [params objectForKey: @"synchronize"]; o = [params objectForKey: @"synchronize"];

View File

@ -86,7 +86,7 @@
NS_DURING NS_DURING
{ {
o = [params objectForKey: @"name"]; o = [params objectForKey: @"name"];
if ([o isKindOfClass: [NSString class]] && ![o isEqualToString: [calendar displayName]]) if ([o isKindOfClass: [NSString class]])
[calendar renameTo: o]; [calendar renameTo: o];
o = [params objectForKey: @"color"]; o = [params objectForKey: @"color"];