mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-17 20:45:56 +00:00
propagate from branch 'ca.inverse.sogo.1_3_15' (head 693036245b42a3d0059f8c06a2a725e716d54c9e)
to branch 'ca.inverse.sogo' (head d93b5b4142f73cdb24bac181e6d92140b7a59313) Monotone-Parent: 693036245b42a3d0059f8c06a2a725e716d54c9e Monotone-Parent: d93b5b4142f73cdb24bac181e6d92140b7a59313 Monotone-Revision: 34215cf1c90ce31c32de705320b2cd5f2bee55ec Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-30T14:08:23 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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]];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user