mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-25 19:26:24 +00:00
Monotone-Parent: 88ed6891d1a0ab07ab5cd6b7f28144e585e93c30
Monotone-Revision: ecc7993695f6bf490b49a22b237471f7d599bc76 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-07-27T21:53:21 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
2011-07-27 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/SOGoMAPIFSMessage.m (-save): serialize the properties
|
||||
dictionary in binary plist format to avoid GNUstep bugs where
|
||||
high unsigned long long values are not parsed properly.
|
||||
(-properties): corrolary to the above change.
|
||||
|
||||
* OpenChange/NSArray+MAPIStore.m (-asArrayOfUnicodeStringsInCtx:):
|
||||
the return type is now "struct WStringArray_r *".
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSPropertyList.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
@@ -66,10 +68,26 @@
|
||||
|
||||
- (NSDictionary *) properties
|
||||
{
|
||||
NSData *content;
|
||||
NSString *error;
|
||||
NSPropertyListFormat format;
|
||||
|
||||
if (!properties)
|
||||
{
|
||||
properties = [[NSMutableDictionary alloc]
|
||||
initWithContentsOfFile: [self completeFilename]];
|
||||
content = [NSData dataWithContentsOfFile: [self completeFilename]];
|
||||
if (content)
|
||||
{
|
||||
properties = [NSPropertyListSerialization propertyListFromData: content
|
||||
mutabilityOption: NSPropertyListMutableContainers
|
||||
format: &format
|
||||
errorDescription: &error];
|
||||
[properties retain];
|
||||
if (!properties)
|
||||
[self logWithFormat: @"an error occurred during deserialization"
|
||||
@" of message: '%@'", error];
|
||||
}
|
||||
else
|
||||
properties = nil;
|
||||
if (!properties)
|
||||
properties = [NSMutableDictionary new];
|
||||
}
|
||||
@@ -88,9 +106,14 @@
|
||||
|
||||
- (void) save
|
||||
{
|
||||
NSData *content;
|
||||
|
||||
[container ensureDirectory];
|
||||
|
||||
if (![properties writeToFile: [self completeFilename] atomically: YES])
|
||||
content = [NSPropertyListSerialization dataFromPropertyList: properties
|
||||
format: NSPropertyListBinaryFormat_v1_0
|
||||
errorDescription: NULL];
|
||||
if (![content writeToFile: [self completeFilename] atomically: NO])
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"could not save message"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user