Monotone-Parent: a1865313ff7142cbf139f7645dcbb299dd1acb92

Monotone-Revision: 06779f0bbfe40e7611b69790cf2eff4809382438

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-06-07T00:17:46
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2011-06-07 00:17:46 +00:00
parent b11f1c25df
commit 2974a91c5e
23 changed files with 923 additions and 331 deletions

View File

@@ -22,11 +22,14 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <Foundation/NSURL.h>
#import <NGExtensions/NSObject+Logs.h>
#import "EOQualifier+MAPIFS.h"
#import "MAPIStoreFSMessage.h"
#import "MAPIStoreFSMessageTable.h"
#import "MAPIStoreFolderTable.h"
#import "MAPIStoreTypes.h"
#import "SOGoMAPIFSFolder.h"
#import "SOGoMAPIFSMessage.h"
@@ -71,6 +74,22 @@ static Class MAPIStoreFSMessageK;
return MAPIStoreFSMessageK;
}
- (NSString *) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
{
NSString *newKey, *urlString;
SOGoMAPIFSFolder *childFolder;
newKey = [NSString stringWithFormat: @"0x%.16"PRIx64, (unsigned long long) newFID];
urlString = [NSString stringWithFormat: @"%@/%@", [self url], newKey];
childFolder = [SOGoMAPIFSFolder folderWithURL: [NSURL URLWithString: urlString]
andTableType: MAPISTORE_MESSAGE_TABLE];
[childFolder ensureDirectory];
return newKey;
}
- (MAPIStoreMessage *) createMessage
{
MAPIStoreMessage *newMessage;
@@ -122,4 +141,63 @@ static Class MAPIStoreFSMessageK;
return keys;
}
- (NSArray *) folderKeys
{
if (!folderKeys)
ASSIGN (folderKeys, [sogoObject toManyRelationshipKeys]);
return folderKeys;
}
- (id) lookupChild: (NSString *) childKey
{
id childObject;
SOGoMAPIFSFolder *childFolder;
[self folderKeys];
if ([folderKeys containsObject: childKey])
{
childFolder = [sogoObject lookupName: childKey inContext: nil
acquire: NO];
childObject = [MAPIStoreFSFolder mapiStoreObjectWithSOGoObject: childFolder
inContainer: self];
}
else
childObject = [super lookupChild: childKey];
return childObject;
}
- (MAPIStoreFAIMessageTable *) folderTable
{
return [MAPIStoreFolderTable tableForContainer: self];
}
- (NSDate *) lastMessageModificationTime
{
NSUInteger count, max;
NSDate *date, *fileDate;
MAPIStoreFSMessage *msg;
[self messageKeys];
date = [NSCalendarDate date];
[self logWithFormat: @"current date: %@", date];
max = [messageKeys count];
for (count = 0; count < max; count++)
{
msg = [self lookupChild: [messageKeys objectAtIndex: count]];
fileDate = [msg lastModificationTime];
if ([date laterDate: fileDate] == fileDate)
{
[self logWithFormat: @"current date: %@", date];
date = fileDate;
}
}
return date;
}
@end