Monotone-Parent: 72b9bd995f18feb4cb9796148626b91ffeacd955

Monotone-Revision: 9cd38432efa3f821a55e29054f08c730b4b8df41

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-02-04T03:48:31
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2011-02-04 03:48:31 +00:00
parent cda37360b8
commit abbce9b69a
3 changed files with 40 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
2011-02-03 Ludovic Marcotte <lmarcotte@inverse.ca>
* OpenChange/SOGoMAPIFSMessage.m (-delete): implemented method.
(-setMAPIProperties:): append the new properties to the existing
ones instead of replacing them.
* OpenChange/MAPIStoreTable.m (-setRestrictions:): log the old
restriction when unset.

View File

@@ -29,7 +29,7 @@
@interface SOGoMAPIFSMessage : SOGoObject
{
NSDictionary *properties;
NSMutableDictionary *properties;
}
- (NSDictionary *) properties;

View File

@@ -21,6 +21,7 @@
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
@@ -57,7 +58,7 @@
{
filePath = [[container directory]
stringByAppendingPathComponent: nameInContainer];
properties = [[NSDictionary alloc]
properties = [[NSMutableDictionary alloc]
initWithContentsOfFile: filePath];
}
@@ -66,7 +67,22 @@
- (void) setMAPIProperties: (NSDictionary *) newProperties
{
ASSIGN (properties, newProperties);
NSArray *keys;
NSString *key;
int i, count;
// We ensure the current properties are loaded
[self properties];
// We merge the changes
keys = [newProperties allKeys];
count = [keys count];
for (i = 0; i < count; i++)
{
key = [keys objectAtIndex: i];
[properties setObject: [newProperties objectForKey: key]
forKey: key];
}
}
- (void) MAPISave
@@ -112,4 +128,21 @@
return [NSString stringWithFormat: @"%p", attributes];
}
- (NSException *) delete
{
NSFileManager *fm;
NSString *filePath;
fm = [NSFileManager defaultManager];
filePath = [[container directory]
stringByAppendingPathComponent: nameInContainer];
if (![fm removeFileAtPath: filePath handler: NULL])
[NSException raise: @"MAPIStoreIOException"
format: @"could not delete message"];
return nil;
}
@end