Monotone-Parent: b0613f483a296b882038d9d023bcb71c82d4916e

Monotone-Revision: 0811b557e4a5f5fb3a026bfc3e9578e656e1d32b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-07-26T19:02:45
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau 2011-07-26 19:02:45 +00:00
parent 21436999e5
commit 287625af3f
12 changed files with 58 additions and 38 deletions

View file

@ -1,3 +1,16 @@
2011-07-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreObject.m (-lookupChild:): removed method as
it was too generic. Each subclass has now its own set of
specialized methods.
* OpenChange/MAPIStoreMessage.m (-lookupAttachment:): new method,
replacing -[MAPIStoreObject lookupChild:].
* OpenChange/MAPIStoreFolder.m (-lookupFolder:, -lookupMessage:)
(-lookupFAIMessage:): new methods, replacing -[MAPIStoreObject
lookupChild:].
2011-07-26 Francis Lachapelle <flachapelle@inverse.ca> 2011-07-26 Francis Lachapelle <flachapelle@inverse.ca>
* UI/MailerUI/UIxMailListActions.m * UI/MailerUI/UIxMailListActions.m

View file

@ -475,7 +475,7 @@
return attachmentKeys; return attachmentKeys;
} }
- (id) lookupChild: (NSString *) childKey - (id) lookupAttachment: (NSString *) childKey
{ {
return [attachmentParts objectForKey: childKey]; return [attachmentParts objectForKey: childKey];
} }

View file

@ -167,7 +167,7 @@ e)
[self _saveAttachment: [attachmentKeys objectAtIndex: count]]; [self _saveAttachment: [attachmentKeys objectAtIndex: count]];
} }
- (id) lookupChild: (NSString *) childKey - (id) lookupAttachment: (NSString *) childKey
{ {
return [attachmentParts objectForKey: childKey]; return [attachmentParts objectForKey: childKey];
} }

View file

@ -153,9 +153,9 @@ static Class MAPIStoreFSMessageK;
return folderKeys; return folderKeys;
} }
- (id) lookupChild: (NSString *) childKey - (id) lookupFolder: (NSString *) childKey
{ {
id childObject; id childObject = nil;
SOGoMAPIFSFolder *childFolder; SOGoMAPIFSFolder *childFolder;
[self folderKeys]; [self folderKeys];
@ -166,8 +166,6 @@ static Class MAPIStoreFSMessageK;
childObject = [MAPIStoreFSFolder mapiStoreObjectWithSOGoObject: childFolder childObject = [MAPIStoreFSFolder mapiStoreObjectWithSOGoObject: childFolder
inContainer: self]; inContainer: self];
} }
else
childObject = [super lookupChild: childKey];
return childObject; return childObject;
} }
@ -191,7 +189,7 @@ static Class MAPIStoreFSMessageK;
max = [messageKeys count]; max = [messageKeys count];
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
{ {
msg = [self lookupChild: [messageKeys objectAtIndex: count]]; msg = [self lookupMessage: [messageKeys objectAtIndex: count]];
fileDate = [msg lastModificationTime]; fileDate = [msg lastModificationTime];
if ([date laterDate: fileDate] == fileDate) if ([date laterDate: fileDate] == fileDate)
{ {

View file

@ -65,6 +65,7 @@
- (id) lookupFolder: (NSString *) folderKey; - (id) lookupFolder: (NSString *) folderKey;
- (id) lookupFolderByURL: (NSString *) folderURL; - (id) lookupFolderByURL: (NSString *) folderURL;
- (id) lookupMessage: (NSString *) messageKey; - (id) lookupMessage: (NSString *) messageKey;
- (id) lookupFAIMessage: (NSString *) messageKey;
- (id) lookupMessageByURL: (NSString *) messageURL; - (id) lookupMessageByURL: (NSString *) messageURL;
- (NSArray *) activeMessageTables; - (NSArray *) activeMessageTables;

View file

@ -190,6 +190,25 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
MAPIStoreObject *childMessage = nil; MAPIStoreObject *childMessage = nil;
SOGoObject *msgObject; SOGoObject *msgObject;
if (messageKey)
{
msgObject = [sogoObject lookupName: messageKey
inContext: nil
acquire: NO];
if (msgObject && ![msgObject isKindOfClass: NSExceptionK])
childMessage
= [[self messageClass] mapiStoreObjectWithSOGoObject: msgObject
inContainer: self];
}
return childMessage;
}
- (id) lookupFAIMessage: (NSString *) messageKey
{
MAPIStoreObject *childMessage = nil;
SOGoObject *msgObject;
if (messageKey) if (messageKey)
{ {
[self faiMessageKeys]; [self faiMessageKeys];
@ -202,16 +221,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
= [MAPIStoreFAIMessageK mapiStoreObjectWithSOGoObject: msgObject = [MAPIStoreFAIMessageK mapiStoreObjectWithSOGoObject: msgObject
inContainer: self]; inContainer: self];
} }
else
{
msgObject = [sogoObject lookupName: messageKey
inContext: nil
acquire: NO];
if (msgObject && ![msgObject isKindOfClass: NSExceptionK])
childMessage
= [[self messageClass] mapiStoreObjectWithSOGoObject: msgObject
inContainer: self];
}
} }
return childMessage; return childMessage;
@ -220,7 +229,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
- (id) lookupMessageByURL: (NSString *) childURL - (id) lookupMessageByURL: (NSString *) childURL
{ {
MAPIStoreObject *foundObject = nil; MAPIStoreObject *foundObject = nil;
NSString *baseURL, *subURL; NSString *baseURL, *subURL, *key;
NSArray *parts; NSArray *parts;
NSUInteger partsCount; NSUInteger partsCount;
@ -235,7 +244,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
parts = [subURL componentsSeparatedByString: @"/"]; parts = [subURL componentsSeparatedByString: @"/"];
partsCount = [parts count]; partsCount = [parts count];
if (partsCount == 1) if (partsCount == 1)
foundObject = [self lookupMessage: [parts objectAtIndex: 0]]; {
key = [parts objectAtIndex: 0];
foundObject = [self lookupFAIMessage: key];
if (!foundObject)
foundObject = [self lookupMessage: key];
}
} }
} }
@ -659,11 +673,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
folderKeys = nil; folderKeys = nil;
} }
- (id) lookupChild: (NSString *) childKey
{
return [self lookupMessage: childKey];
}
- (int) getPrParentFid: (void **) data - (int) getPrParentFid: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {

View file

@ -250,9 +250,9 @@ static Class SOGoMailFolderK;
return [MAPIStoreMailFolderTable tableForContainer: self]; return [MAPIStoreMailFolderTable tableForContainer: self];
} }
- (id) lookupChild: (NSString *) childKey - (id) lookupFolder: (NSString *) childKey
{ {
id childObject; id childObject = nil;
SOGoMailFolder *childFolder; SOGoMailFolder *childFolder;
[self folderKeys]; [self folderKeys];
@ -263,8 +263,6 @@ static Class SOGoMailFolderK;
childObject = [MAPIStoreMailFolder mapiStoreObjectWithSOGoObject: childFolder childObject = [MAPIStoreMailFolder mapiStoreObjectWithSOGoObject: childFolder
inContainer: self]; inContainer: self];
} }
else
childObject = [super lookupChild: childKey];
return childObject; return childObject;
} }

View file

@ -1151,7 +1151,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
andSortOrderings: sortOrderings]; andSortOrderings: sortOrderings];
} }
- (id) lookupChild: (NSString *) childKey - (id) lookupAttachment: (NSString *) childKey
{ {
MAPIStoreMailAttachment *attachment; MAPIStoreMailAttachment *attachment;
SOGoMailBodyPart *currentPart; SOGoMailBodyPart *currentPart;

View file

@ -46,7 +46,9 @@
- (int) modifyRecipientsWithRows: (struct ModifyRecipientRow *) rows - (int) modifyRecipientsWithRows: (struct ModifyRecipientRow *) rows
andCount: (NSUInteger) max; andCount: (NSUInteger) max;
- (id) lookupAttachment: (NSString *) childKey;
/* backend methods */
- (int) createAttachment: (MAPIStoreAttachment **) attachmentPtr - (int) createAttachment: (MAPIStoreAttachment **) attachmentPtr
inAID: (uint32_t *) aidPtr; inAID: (uint32_t *) aidPtr;
- (int) getAttachment: (MAPIStoreAttachment **) attachmentPtr - (int) getAttachment: (MAPIStoreAttachment **) attachmentPtr

View file

@ -271,6 +271,13 @@
return rc; return rc;
} }
- (id) lookupAttachment: (NSString *) childKey
{
[self subclassResponsibility: _cmd];
return nil;
}
- (int) getAttachment: (MAPIStoreAttachment **) attachmentPtr - (int) getAttachment: (MAPIStoreAttachment **) attachmentPtr
withAID: (uint32_t) aid withAID: (uint32_t) aid
{ {
@ -282,7 +289,7 @@
andSortOrderings: nil]; andSortOrderings: nil];
if (aid < [keys count]) if (aid < [keys count])
{ {
attachment = [self lookupChild: [keys objectAtIndex: aid]]; attachment = [self lookupAttachment: [keys objectAtIndex: aid]];
if (attachment) if (attachment)
{ {
*attachmentPtr = attachment; *attachmentPtr = attachment;

View file

@ -126,7 +126,6 @@
- (NSDate *) creationTime; - (NSDate *) creationTime;
- (NSDate *) lastModificationTime; - (NSDate *) lastModificationTime;
- (id) lookupChild: (NSString *) childKey;
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier - (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
andSortOrderings: (NSArray *) sortOrderings; andSortOrderings: (NSArray *) sortOrderings;

View file

@ -440,13 +440,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
return nil; return nil;
} }
- (id) lookupChild: (NSString *) childKey
{
[self subclassResponsibility: _cmd];
return nil;
}
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier - (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
andSortOrderings: (NSArray *) sortOrderings andSortOrderings: (NSArray *) sortOrderings
{ {