Monotone-Parent: 600b3a1c268cabeca401fb335f2e4c76bd1709b7
Monotone-Revision: d93b5b4142f73cdb24bac181e6d92140b7a59313 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-28T20:04:32 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
dcb952e1b7
commit
269393250b
|
@ -1,5 +1,12 @@
|
|||
2012-03-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/SOGoMAPIFSMessage.m
|
||||
(_readFileChangesDataWithDate:andInode:): use the inode number
|
||||
rather than the filesize as change indicator since a new file is
|
||||
created each time the dictionary is written to disk, thanks to the
|
||||
"atomically" flag.
|
||||
(-save): write the file atomically.
|
||||
|
||||
* SoObjects/Contacts/SOGoFolder+CardDAV.m (_isValidFilter:):
|
||||
accept "email" as filter name.
|
||||
(_appendObject:withBaseURL:toREPORTResponse:): fixed the ordering
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
@interface SOGoMAPIFSMessage : SOGoMAPIVolatileMessage
|
||||
{
|
||||
NSString *completeFilename;
|
||||
NSUInteger fileSize;
|
||||
NSUInteger inode;
|
||||
NSData *lastModificationTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
if ((self = [super init]))
|
||||
{
|
||||
completeFilename = nil;
|
||||
fileSize = 0;
|
||||
inode = 0;
|
||||
lastModificationTime = nil;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
|||
}
|
||||
|
||||
- (BOOL) _readFileChangesDataWithDate: (NSDate **) newLMTime
|
||||
andSize: (NSUInteger *) newFileSize
|
||||
andInode: (NSUInteger *) newInode
|
||||
{
|
||||
BOOL rc;
|
||||
NSDictionary *attributes;
|
||||
|
@ -97,7 +97,7 @@
|
|||
if (attributes)
|
||||
{
|
||||
*newLMTime = [attributes fileModificationDate];
|
||||
*newFileSize = [attributes fileSize];
|
||||
*newInode = [attributes fileSystemFileNumber];
|
||||
rc = YES;
|
||||
}
|
||||
else
|
||||
|
@ -107,22 +107,22 @@
|
|||
}
|
||||
|
||||
- (BOOL) _checkFileChangesDataWithDate: (NSDate **) newLMTime
|
||||
andSize: (NSUInteger *) newFileSize
|
||||
andInode: (NSUInteger *) newInode
|
||||
{
|
||||
BOOL hasChanged = NO;
|
||||
NSDate *lastLMTime;
|
||||
NSUInteger lastFileSize;
|
||||
NSUInteger lastInode;
|
||||
|
||||
if ([self _readFileChangesDataWithDate: &lastLMTime
|
||||
andSize: &lastFileSize])
|
||||
andInode: &lastInode])
|
||||
{
|
||||
if (fileSize != lastFileSize
|
||||
if (inode != lastInode
|
||||
|| ![lastModificationTime isEqual: lastLMTime])
|
||||
{
|
||||
if (lastLMTime)
|
||||
*newLMTime = lastLMTime;
|
||||
if (newFileSize)
|
||||
*newFileSize = lastFileSize;
|
||||
if (newInode)
|
||||
*newInode = lastInode;
|
||||
hasChanged = YES;
|
||||
}
|
||||
}
|
||||
|
@ -136,10 +136,10 @@
|
|||
NSString *error;
|
||||
NSPropertyListFormat format;
|
||||
NSDate *lastLMTime;
|
||||
NSUInteger lastFileSize;
|
||||
NSUInteger lastInode;
|
||||
|
||||
if ([self _checkFileChangesDataWithDate: &lastLMTime
|
||||
andSize: &lastFileSize])
|
||||
andInode: &lastInode])
|
||||
{
|
||||
[self logWithFormat: @"file '%@' new or modified: rereading properties",
|
||||
[self completeFilename]];
|
||||
|
@ -158,7 +158,7 @@
|
|||
@" of message: '%@'", error];
|
||||
}
|
||||
ASSIGN (lastModificationTime, lastLMTime);
|
||||
fileSize = lastFileSize;
|
||||
inode = lastInode;
|
||||
}
|
||||
|
||||
return [super properties];
|
||||
|
@ -168,7 +168,7 @@
|
|||
{
|
||||
NSData *content;
|
||||
NSDate *lastLMTime;
|
||||
NSUInteger lastFileSize;
|
||||
NSUInteger lastInode;
|
||||
|
||||
[container ensureDirectory];
|
||||
|
||||
|
@ -178,14 +178,13 @@
|
|||
dataFromPropertyList: [self properties]
|
||||
format: NSPropertyListBinaryFormat_v1_0
|
||||
errorDescription: NULL];
|
||||
if (![content writeToFile: [self completeFilename] atomically: NO])
|
||||
if (![content writeToFile: [self completeFilename] atomically: YES])
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"could not save message"];
|
||||
|
||||
[self _readFileChangesDataWithDate: &lastLMTime
|
||||
andSize: &lastFileSize];
|
||||
[self _readFileChangesDataWithDate: &lastLMTime andInode: &lastInode];
|
||||
ASSIGN (lastModificationTime, lastLMTime);
|
||||
fileSize = lastFileSize;
|
||||
inode = lastInode;
|
||||
// [self logWithFormat: @"fs message written to '%@'", [self completeFilename]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue