We now allow to change the storage format for plists.

pull/8/merge
Ludovic Marcotte 2013-01-23 20:21:27 -05:00
parent 0965fd837a
commit a1b623b325
1 changed files with 19 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#import <Foundation/NSPropertyList.h>
#import <Foundation/NSString.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <GDLAccess/EOAdaptor.h>
#import <GDLAccess/EOAdaptorChannel.h>
@ -48,6 +49,18 @@
#import "SOGoMAPIDBObject.h"
//
// This defines the storage for internal properly list, stored in the
// database. Possible values are:
//
// NSPropertyListGNUstepFormat = 1000
// NSPropertyListGNUstepBinaryFormat = 1001
// NSPropertyListOpenStepFormat = 1
// NSPropertyListXMLFormat_v1_0 = 100
// NSPropertyListBinaryFormat_v1_0 = 200
//
static NSPropertyListFormat plistFormat;
static EOAttribute *textColumn = nil;
@implementation SOGoMAPIDBObject
@ -56,6 +69,11 @@ static EOAttribute *textColumn = nil;
{
NSDictionary *description;
plistFormat = [[NSUserDefaults standardUserDefaults] integerForKey: @"SOGoPropertyListFormat"];
if (!plistFormat)
plistFormat = NSPropertyListGNUstepBinaryFormat;
if (!textColumn)
{
/* TODO: this is a hack for providing an EOAttribute definition that is
@ -510,7 +528,7 @@ static EOAttribute *textColumn = nil;
{
content = [NSPropertyListSerialization
dataFromPropertyList: properties
format: NSPropertyListGNUstepBinaryFormat
format: plistFormat
errorDescription: NULL];
propsValue = [adaptor formatValue: [content stringByEncodingBase64]
forAttribute: textColumn];