applied changes from c6b25920d896b2d19d0ef40a4cadee46c87bba2d

through fcec9822c0aaee8cefba77d0f50a8582b33fa3f0

Monotone-Parent: 975e40192e290b5aa4bc5c5b99a12b299d84fa5a
Monotone-Revision: 4d39a71900cc87ae1185f268c1c35a5a4b086b1d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-07-12T15:03:38
This commit is contained in:
Wolfgang Sourdeau
2012-07-12 15:03:38 +00:00
parent 6556c92c87
commit 87a7732361
4 changed files with 145 additions and 19 deletions
+20
View File
@@ -8,6 +8,26 @@
show the notification options if it's a web calendar or if the active
user isn't the owner of the calendar.
2012-07-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m
(-davNotifyOnPersonalModifications)
(-setDavNotifyOnPersonalModifications:)
(-davNotifyOnExternalModifications)
(-setDavNotifyOnExternalModifications:)
(-davNotifyUserOnPersonalModifications)
(-setDavNotifyUserOnPersonalModifications:)
(-davNotifiedUserOnPersonalModifications)
(-setDavNotifiedUserOnPersonalModifications:): new dav accessors.
* SoObjects/SOGo/SOGoObject.m (-davBooleanForResult:): new method
that returns a valid DAV boolean from a BOOL.
(-isValidDAVBoolean:): new method that validates the value as a
DAV boolean.
(-resultForDAVBoolean:): new method that returns a BOOL from a DAV
boolean.
2012-07-09 Ludovic Marcotte <lmarcotte@inverse.ca>
* Dropped old templates (SOGoAptMailDeletionReceipt.wox
+91 -19
View File
@@ -455,7 +455,7 @@ static NSNumber *sharedYes = nil;
// We MUST keep the 'NO' value here, because we will always
// fallback to the domain defaults otherwise.
//
- (BOOL) _setNotificationValue: (BOOL) b
- (void) _setNotificationValue: (BOOL) b
forKey: (NSString *) theKey
{
[self setFolderPropertyValue: [NSNumber numberWithBool: b]
@@ -1005,7 +1005,9 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
rules = [cycleinfo objectForKey: @"rules"];
exRules = [cycleinfo objectForKey: @"exRules"];
exDates = [cycleinfo objectForKey: @"exDates"];
eventTimeZone = allDayTimeZone = tz = nil;
eventTimeZone = nil;
allDayTimeZone = nil;
tz = nil;
row = [self fixupRecord: theRecord];
[row removeObjectForKey: @"c_cycleinfo"];
@@ -1062,7 +1064,9 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
}
}
tz = eventTimeZone? eventTimeZone : allDayTimeZone;
#warning this code is ugly: we should not mix objects with different types as\
it reduces readability
tz = eventTimeZone ? eventTimeZone : allDayTimeZone;
if (tz)
{
// Adjust the exception dates
@@ -2250,28 +2254,18 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
- (NSString *) davCalendarShowAlarms
{
NSString *boolean;
if ([self showCalendarAlarms])
boolean = @"true";
else
boolean = @"false";
return boolean;
return [self davBooleanForResult: [self showCalendarAlarms]];
}
- (NSException *) setDavCalendarShowAlarms: (id) newBoolean
{
NSException *error;
error = nil;
if ([newBoolean isEqualToString: @"true"]
|| [newBoolean isEqualToString: @"1"])
[self setShowCalendarAlarms: YES];
else if ([newBoolean isEqualToString: @"false"]
|| [newBoolean isEqualToString: @"0"])
[self setShowCalendarAlarms: NO];
if ([self isValidDAVBoolean: newBoolean])
{
[self setShowCalendarAlarms: [self resultForDAVBoolean: newBoolean]];
error = nil;
}
else
error = [NSException exceptionWithHTTPStatus: 400
reason: @"Bad boolean value."];
@@ -2279,6 +2273,84 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
return error;
}
- (NSString *) davNotifyOnPersonalModifications
{
return [self davBooleanForResult: [self notifyOnPersonalModifications]];
}
- (NSException *) setDavNotifyOnPersonalModifications: (NSString *) newBoolean
{
NSException *error;
if ([self isValidDAVBoolean: newBoolean])
{
[self setNotifyOnPersonalModifications:
[self resultForDAVBoolean: newBoolean]];
error = nil;
}
else
error = [NSException exceptionWithHTTPStatus: 400
reason: @"Bad boolean value."];
return error;
}
- (NSString *) davNotifyOnExternalModifications
{
return [self davBooleanForResult: [self notifyOnExternalModifications]];
}
- (NSException *) setDavNotifyOnExternalModifications: (NSString *) newBoolean
{
NSException *error;
if ([self isValidDAVBoolean: newBoolean])
{
[self setNotifyOnExternalModifications:
[self resultForDAVBoolean: newBoolean]];
error = nil;
}
else
error = [NSException exceptionWithHTTPStatus: 400
reason: @"Bad boolean value."];
return error;
}
- (NSString *) davNotifyUserOnPersonalModifications
{
return [self davBooleanForResult: [self notifyUserOnPersonalModifications]];
}
- (NSException *) setDavNotifyUserOnPersonalModifications: (NSString *) newBoolean
{
NSException *error;
if ([self isValidDAVBoolean: newBoolean])
{
[self setNotifyUserOnPersonalModifications:
[self resultForDAVBoolean: newBoolean]];
error = nil;
}
else
error = [NSException exceptionWithHTTPStatus: 400
reason: @"Bad boolean value."];
return error;
}
- (NSString *) davNotifiedUserOnPersonalModifications
{
return [self notifiedUserOnPersonalModifications];
}
- (NSException *) setDavNotifiedUserOnPersonalModifications: (NSString *) theUser
{
[self setNotifiedUserOnPersonalModifications: theUser];
return nil;
}
/* vevent UID handling */
- (NSString *) resourceNameForEventUID: (NSString *) uid
+4
View File
@@ -166,6 +166,10 @@
parameters: (NSArray *) params;
/* utilities */
- (NSString *) davBooleanForResult: (BOOL) result;
- (BOOL) isValidDAVBoolean: (NSString *) davBoolean;
- (BOOL) resultForDAVBoolean: (NSString *) davBoolean;
- (NSString *) labelForKey: (NSString *) key;
/* description */
+30
View File
@@ -27,6 +27,7 @@
#import <Foundation/NSClassDescription.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSString.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSValue.h>
@@ -1582,6 +1583,35 @@
return exception;
}
- (NSString *) davBooleanForResult: (BOOL) result
{
return (result ? @"true" : @"false");
}
- (BOOL) isValidDAVBoolean: (NSString *) davBoolean
{
static NSSet *validBooleans = nil;
if (!validBooleans)
{
validBooleans = [NSSet setWithObjects: @"true", @"false", @"1", @"0",
nil];
[validBooleans retain];
}
return [validBooleans containsObject: davBoolean];
}
- (BOOL) resultForDAVBoolean: (NSString *) davBoolean
{
BOOL result;
result = ([davBoolean isEqualToString: @"true"]
|| [davBoolean isEqualToString: @"1"]);
return result;
}
- (NSString *) labelForKey: (NSString *) key
{
return [self labelForKey: key inContext: context];