merge of '1fae890d6e269d7918982811c46400a4ff38745d'

and '4d39a71900cc87ae1185f268c1c35a5a4b086b1d'

Monotone-Parent: 1fae890d6e269d7918982811c46400a4ff38745d
Monotone-Parent: 4d39a71900cc87ae1185f268c1c35a5a4b086b1d
Monotone-Revision: dac25405c6ab2f1d735ddb9f6db4243e5e96d14b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-07-12T15:04:27
This commit is contained in:
Wolfgang Sourdeau
2012-07-12 15:04:27 +00:00
4 changed files with 145 additions and 19 deletions

View File

@@ -11,6 +11,26 @@
* Added strings to translate and cleaned up the template to send
HTML mails instead of text/plain.
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

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

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 */

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];