mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-13 07:47:12 +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 parent
83d0ee535c
commit
b9d975fbb4
2 files changed
+31
-3
No files matched your search
@@ -1,5 +1,10 @@
|
|||||||
2011-07-27 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
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:):
|
* OpenChange/NSArray+MAPIStore.m (-asArrayOfUnicodeStringsInCtx:):
|
||||||
the return type is now "struct WStringArray_r *".
|
the return type is now "struct WStringArray_r *".
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
|
#import <Foundation/NSData.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSFileManager.h>
|
#import <Foundation/NSFileManager.h>
|
||||||
#import <Foundation/NSException.h>
|
#import <Foundation/NSException.h>
|
||||||
|
#import <Foundation/NSPropertyList.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
@@ -66,10 +68,26 @@
|
|||||||
|
|
||||||
- (NSDictionary *) properties
|
- (NSDictionary *) properties
|
||||||
{
|
{
|
||||||
|
NSData *content;
|
||||||
|
NSString *error;
|
||||||
|
NSPropertyListFormat format;
|
||||||
|
|
||||||
if (!properties)
|
if (!properties)
|
||||||
{
|
{
|
||||||
properties = [[NSMutableDictionary alloc]
|
content = [NSData dataWithContentsOfFile: [self completeFilename]];
|
||||||
initWithContentsOfFile: [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)
|
if (!properties)
|
||||||
properties = [NSMutableDictionary new];
|
properties = [NSMutableDictionary new];
|
||||||
}
|
}
|
||||||
@@ -88,9 +106,14 @@
|
|||||||
|
|
||||||
- (void) save
|
- (void) save
|
||||||
{
|
{
|
||||||
|
NSData *content;
|
||||||
|
|
||||||
[container ensureDirectory];
|
[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"
|
[NSException raise: @"MAPIStoreIOException"
|
||||||
format: @"could not save message"];
|
format: @"could not save message"];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user