mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-19 10:25:27 +00:00
Monotone-Parent: da9c14ddfb4c9a9c929c7b84543af4ce664cfc10
Monotone-Revision: 829ccf73000a2d91a5daf67741479e395011b6a8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-07-26T20:13:10 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -9,13 +9,26 @@
|
||||
* OpenChange/MAPIStoreObject.m (-lookupChild:): removed method as
|
||||
it was too generic. Each subclass has now its own set of
|
||||
specialized methods.
|
||||
(-childKeysMatchingQualiflier:andSortOrderings:) same as above.
|
||||
|
||||
* OpenChange/MAPIStoreMessage.m (-lookupAttachment:): new method,
|
||||
replacing -[MAPIStoreObject lookupChild:].
|
||||
(-attachmentKeysMatchingQualiflier:andSortOrderings:) same as
|
||||
above, replacing (-[MAPIStoreObject
|
||||
childKeysMatchingQualiflier:andSortOrderings:]).
|
||||
|
||||
* OpenChange/MAPIStoreFolder.m (-lookupFolder:, -lookupMessage:)
|
||||
(-lookupFAIMessage:): new methods, replacing -[MAPIStoreObject
|
||||
lookupChild:].
|
||||
(-messageKeysMatchingQualiflier:andSortOrderings:) same as
|
||||
above, replacing (-[MAPIStoreObject
|
||||
childKeysMatchingQualiflier:andSortOrderings:]).
|
||||
(-faiMessageKeysMatchingQualiflier:andSortOrderings:) same as
|
||||
above, replacing (-[MAPIStoreObject
|
||||
childKeysMatchingQualiflier:andSortOrderings:]).
|
||||
(-folderKeysMatchingQualiflier:andSortOrderings:) same as
|
||||
above, replacing (-[MAPIStoreObject
|
||||
childKeysMatchingQualiflier:andSortOrderings:]).
|
||||
|
||||
2011-07-26 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
|
||||
@@ -20,12 +20,51 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
|
||||
#import "MAPIStoreMessage.h"
|
||||
|
||||
#import "MAPIStoreAttachmentTable.h"
|
||||
|
||||
@implementation MAPIStoreAttachmentTable
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreMessage *)
|
||||
container attachmentKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreMessage *)
|
||||
container attachmentKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [(MAPIStoreMessage *) container lookupAttachment: childKey];
|
||||
|
||||
@@ -466,15 +466,6 @@
|
||||
[sogoObject saveComponent: newEvent];
|
||||
}
|
||||
|
||||
/* TODO: those are stubs meant to prevent OpenChange from crashing when a
|
||||
recurring event is open */
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
/* TODO: Here we should return recurrence exceptions */
|
||||
return attachmentKeys;
|
||||
}
|
||||
|
||||
- (id) lookupAttachment: (NSString *) childKey
|
||||
{
|
||||
return [attachmentParts objectForKey: childKey];
|
||||
@@ -486,7 +477,7 @@
|
||||
uint32_t newAid;
|
||||
NSString *newKey;
|
||||
|
||||
newAid = [attachmentKeys count];
|
||||
newAid = [[self attachmentKeys] count];
|
||||
|
||||
newAttachment = [MAPIStoreCalendarAttachment
|
||||
mapiStoreObjectWithSOGoObject: nil
|
||||
@@ -496,7 +487,8 @@
|
||||
newKey = [NSString stringWithFormat: @"%ul", newAid];
|
||||
[attachmentParts setObject: newAttachment
|
||||
forKey: newKey];
|
||||
[attachmentKeys addObject: newKey];
|
||||
[attachmentKeys release];
|
||||
attachmentKeys = nil;
|
||||
|
||||
return newAttachment;
|
||||
}
|
||||
|
||||
@@ -45,8 +45,9 @@
|
||||
{
|
||||
unsigned int v = MSGFLAG_FROMME;
|
||||
|
||||
if ([[self childKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil] count] > 0)
|
||||
if ([[self attachmentKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil]
|
||||
count] > 0)
|
||||
v |= MSGFLAG_HASATTACH;
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
@@ -172,17 +173,6 @@ e)
|
||||
return [attachmentParts objectForKey: childKey];
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for attachments"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for attachments"];
|
||||
|
||||
return attachmentKeys;
|
||||
}
|
||||
|
||||
- (void) submit
|
||||
{
|
||||
NSString *msgClass;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
|
||||
#import "MAPIStoreFAIMessage.h"
|
||||
#import "MAPIStoreFolder.h"
|
||||
|
||||
@@ -54,7 +56,39 @@ static Class MAPIStoreFAIMessageK = Nil;
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
return [(MAPIStoreFolder *) container faiMessageKeys];
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreFolder *)
|
||||
container faiMessageKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreFolder *)
|
||||
container faiMessageKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
|
||||
@@ -110,8 +110,8 @@ static Class MAPIStoreFSMessageK;
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSArray *allKeys;
|
||||
NSMutableArray *keys;
|
||||
@@ -145,14 +145,6 @@ static Class MAPIStoreFSMessageK;
|
||||
return keys;
|
||||
}
|
||||
|
||||
- (NSArray *) folderKeys
|
||||
{
|
||||
if (!folderKeys)
|
||||
ASSIGN (folderKeys, [sogoObject toManyRelationshipKeys]);
|
||||
|
||||
return folderKeys;
|
||||
}
|
||||
|
||||
- (id) lookupFolder: (NSString *) childKey
|
||||
{
|
||||
id childObject = nil;
|
||||
@@ -170,11 +162,6 @@ static Class MAPIStoreFSMessageK;
|
||||
return childObject;
|
||||
}
|
||||
|
||||
- (MAPIStoreFAIMessageTable *) folderTable
|
||||
{
|
||||
return [MAPIStoreFolderTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (NSDate *) lastMessageModificationTime
|
||||
{
|
||||
NSUInteger count, max;
|
||||
|
||||
@@ -142,8 +142,8 @@
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
- (NSArray *) attachmentsKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSDictionary *attachments;
|
||||
NSArray *keys;
|
||||
@@ -170,8 +170,8 @@
|
||||
fetchedAttachments = YES;
|
||||
}
|
||||
|
||||
return [super childKeysMatchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
return [super attachmentKeysMatchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
|
||||
- (void) save
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#import "MAPIStoreTable.h"
|
||||
|
||||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSURL;
|
||||
|
||||
@@ -48,7 +49,7 @@
|
||||
MAPIStoreContext *context;
|
||||
NSArray *messageKeys;
|
||||
NSArray *faiMessageKeys;
|
||||
NSMutableArray *folderKeys;
|
||||
NSArray *folderKeys;
|
||||
|
||||
NSDictionary *properties;
|
||||
|
||||
@@ -62,27 +63,31 @@
|
||||
- (id) initWithURL: (NSURL *) newURL
|
||||
inContext: (MAPIStoreContext *) newContext;
|
||||
|
||||
- (id) lookupFolder: (NSString *) folderKey;
|
||||
- (id) lookupFolderByURL: (NSString *) folderURL;
|
||||
- (id) lookupMessage: (NSString *) messageKey;
|
||||
- (id) lookupFAIMessage: (NSString *) messageKey;
|
||||
- (id) lookupMessageByURL: (NSString *) messageURL;
|
||||
|
||||
- (NSArray *) activeMessageTables;
|
||||
- (NSArray *) activeFAIMessageTables;
|
||||
|
||||
- (MAPIStoreMessageTable *) messageTable;
|
||||
- (id) lookupMessageByURL: (NSString *) messageURL;
|
||||
- (id) lookupFolderByURL: (NSString *) folderURL;
|
||||
|
||||
/* message objects and tables */
|
||||
- (id) lookupMessage: (NSString *) messageKey;
|
||||
- (NSArray *) messageKeys;
|
||||
|
||||
/* FAI message objects and tables */
|
||||
- (id) lookupFAIMessage: (NSString *) messageKey;
|
||||
- (MAPIStoreFAIMessageTable *) faiMessageTable;
|
||||
- (NSArray *) faiMessageKeys;
|
||||
- (NSArray *) faiMessageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
|
||||
/* folder objects and tables */
|
||||
- (id) lookupFolder: (NSString *) folderKey;
|
||||
- (MAPIStoreFolderTable *) folderTable;
|
||||
- (NSArray *) folderKeys;
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
|
||||
- (MAPIStoreMessage *) createMessage: (BOOL) isAssociated;
|
||||
- (NSString *) createFolder: (struct SRow *) aRow
|
||||
withFID: (uint64_t) newFID;
|
||||
|
||||
/* backend interface */
|
||||
|
||||
@@ -116,6 +121,12 @@
|
||||
/* subclasses */
|
||||
- (Class) messageClass;
|
||||
- (MAPIStoreMessage *) createMessage;
|
||||
- (MAPIStoreMessageTable *) messageTable;
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
|
||||
- (NSString *) createFolder: (struct SRow *) aRow
|
||||
withFID: (uint64_t) newFID;
|
||||
|
||||
- (NSCalendarDate *) lastMessageModificationTime;
|
||||
|
||||
|
||||
@@ -127,6 +127,9 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
{
|
||||
urlString = [[self url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
propsURL = [NSURL URLWithString: urlString];
|
||||
ASSIGN (faiFolder,
|
||||
[SOGoMAPIFSFolder folderWithURL: propsURL
|
||||
andTableType: MAPISTORE_FAI_TABLE]);
|
||||
ASSIGN (propsFolder,
|
||||
[SOGoMAPIFSFolder folderWithURL: propsURL
|
||||
andTableType: MAPISTORE_FOLDER_TABLE]);
|
||||
@@ -599,8 +602,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
{
|
||||
if (!messageKeys)
|
||||
{
|
||||
messageKeys = [self childKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil];
|
||||
messageKeys = [self messageKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil];
|
||||
[messageKeys retain];
|
||||
}
|
||||
|
||||
@@ -612,11 +615,23 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
return [MAPIStoreFAIMessageTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (NSArray *) faiMessageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for FAI messages"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for FAI messages"];
|
||||
|
||||
return [faiFolder toOneRelationshipKeys];
|
||||
}
|
||||
|
||||
- (NSArray *) faiMessageKeys
|
||||
{
|
||||
if (!faiMessageKeys)
|
||||
{
|
||||
faiMessageKeys = [faiFolder toOneRelationshipKeys];
|
||||
faiMessageKeys = [self faiMessageKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil];
|
||||
[faiMessageKeys retain];
|
||||
}
|
||||
|
||||
@@ -625,12 +640,30 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
- (MAPIStoreFolderTable *) folderTable
|
||||
{
|
||||
return nil;
|
||||
return [MAPIStoreFolderTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (NSArray *) folderKeys
|
||||
{
|
||||
return nil;
|
||||
if (!folderKeys)
|
||||
{
|
||||
folderKeys = [self folderKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil];
|
||||
[folderKeys retain];
|
||||
}
|
||||
|
||||
return folderKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for folders"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for folders"];
|
||||
|
||||
return [sogoObject toManyRelationshipKeys];
|
||||
}
|
||||
|
||||
- (NSArray *) activeMessageTables
|
||||
@@ -886,6 +919,14 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (Class) messageClass
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
@@ -46,18 +48,46 @@
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
return [(MAPIStoreFolder *) container folderKeys];
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreFolder *)
|
||||
container folderKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
/* FIXME: restrictions are ignored on folder tables */
|
||||
return [self childKeys];
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreFolder *)
|
||||
container folderKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [(MAPIStoreMessage *) container lookupFolder: childKey];
|
||||
return [(MAPIStoreFolder *) container lookupFolder: childKey];
|
||||
}
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
|
||||
@implementation MAPIStoreGCSFolder
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
static NSArray *fields = nil;
|
||||
NSArray *records;
|
||||
|
||||
@@ -199,12 +199,10 @@ static Class SOGoMailFolderK;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
- (EOQualifier *) nonDeletedQualifier
|
||||
{
|
||||
NSArray *uidKeys;
|
||||
EOQualifier *fetchQualifier, *deletedQualifier;
|
||||
static EOQualifier *nonDeletedQualifier = nil;
|
||||
EOQualifier *deletedQualifier;
|
||||
|
||||
if (!nonDeletedQualifier)
|
||||
{
|
||||
@@ -218,18 +216,28 @@ static Class SOGoMailFolderK;
|
||||
[deletedQualifier release];
|
||||
}
|
||||
|
||||
return nonDeletedQualifier;
|
||||
}
|
||||
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSArray *uidKeys;
|
||||
EOQualifier *fetchQualifier;
|
||||
|
||||
if (!sortOrderings)
|
||||
sortOrderings = [NSArray arrayWithObject: @"ARRIVAL"];
|
||||
|
||||
if (qualifier)
|
||||
{
|
||||
fetchQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers: nonDeletedQualifier, qualifier,
|
||||
nil];
|
||||
fetchQualifier
|
||||
= [[EOAndQualifier alloc] initWithQualifiers:
|
||||
[self nonDeletedQualifier], qualifier,
|
||||
nil];
|
||||
[fetchQualifier autorelease];
|
||||
}
|
||||
else
|
||||
fetchQualifier = nonDeletedQualifier;
|
||||
fetchQualifier = [self nonDeletedQualifier];
|
||||
|
||||
uidKeys = [sogoObject fetchUIDsMatchingQualifier: fetchQualifier
|
||||
sortOrdering: sortOrderings];
|
||||
@@ -244,11 +252,6 @@ static Class SOGoMailFolderK;
|
||||
return folderKeys;
|
||||
}
|
||||
|
||||
- (MAPIStoreFAIMessageTable *) folderTable
|
||||
{
|
||||
return [MAPIStoreMailFolderTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (id) lookupFolder: (NSString *) childKey
|
||||
{
|
||||
id childObject = nil;
|
||||
|
||||
@@ -104,7 +104,6 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
|
||||
headerSetup = NO;
|
||||
bodyContent = nil;
|
||||
bodySetup = NO;
|
||||
fetchedAttachments = NO;
|
||||
appointmentWrapper = nil;
|
||||
}
|
||||
|
||||
@@ -444,8 +443,8 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
v |= MSGFLAG_FROMME;
|
||||
if ([flags containsObject: @"seen"])
|
||||
v |= MSGFLAG_READ;
|
||||
if ([[self childKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil] count] > 0)
|
||||
if ([[self attachmentKeys]
|
||||
count] > 0)
|
||||
v |= MSGFLAG_HASATTACH;
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
@@ -1122,7 +1121,6 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
keyPrefix = @"0";
|
||||
[attachmentParts setObject: bodyInfo
|
||||
forKey: keyPrefix];
|
||||
[attachmentKeys addObject: keyPrefix];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1137,18 +1135,14 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
- (NSArray *) attachmentsKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (!fetchedAttachments)
|
||||
{
|
||||
[self _fetchAttachmentPartsInBodyInfo: [sogoObject bodyStructure]
|
||||
withPrefix: @""];
|
||||
fetchedAttachments = YES;
|
||||
}
|
||||
[self _fetchAttachmentPartsInBodyInfo: [sogoObject bodyStructure]
|
||||
withPrefix: @""];
|
||||
|
||||
return [super childKeysMatchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
return [super attachmentKeysMatchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
|
||||
- (id) lookupAttachment: (NSString *) childKey
|
||||
@@ -1186,7 +1180,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
mapiStoreObjectWithSOGoObject: currentPart
|
||||
inContainer: self];
|
||||
[attachment setBodyInfo: [attachmentParts objectForKey: childKey]];
|
||||
[attachment setAID: [attachmentKeys indexOfObject: childKey]];
|
||||
[attachment setAID: [[self attachmentKeys] indexOfObject: childKey]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSMutableDictionary;
|
||||
|
||||
@class EOQualifier;
|
||||
|
||||
@class MAPIStoreAttachment;
|
||||
@class MAPIStoreAttachmentTable;
|
||||
@class MAPIStoreFolder;
|
||||
@@ -36,7 +39,7 @@
|
||||
|
||||
@interface MAPIStoreMessage : MAPIStoreObject
|
||||
{
|
||||
NSMutableArray *attachmentKeys;
|
||||
NSArray *attachmentKeys;
|
||||
NSMutableDictionary *attachmentParts;
|
||||
NSMutableArray *activeTables;
|
||||
}
|
||||
@@ -46,6 +49,9 @@
|
||||
|
||||
- (int) modifyRecipientsWithRows: (struct ModifyRecipientRow *) rows
|
||||
andCount: (NSUInteger) max;
|
||||
- (NSArray *) attachmentKeys;
|
||||
- (NSArray *) attachmentKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
- (id) lookupAttachment: (NSString *) childKey;
|
||||
|
||||
/* backend methods */
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
attachmentKeys = [NSMutableArray new];
|
||||
attachmentParts = [NSMutableDictionary new];
|
||||
activeTables = [NSMutableArray new];
|
||||
}
|
||||
@@ -238,7 +237,7 @@
|
||||
uint32_t newAid;
|
||||
NSString *newKey;
|
||||
|
||||
newAid = [attachmentKeys count];
|
||||
newAid = [[self attachmentKeys] count];
|
||||
|
||||
newAttachment = [MAPIStoreAttachment
|
||||
mapiStoreObjectWithSOGoObject: nil
|
||||
@@ -248,7 +247,8 @@
|
||||
newKey = [NSString stringWithFormat: @"%ul", newAid];
|
||||
[attachmentParts setObject: newAttachment
|
||||
forKey: newKey];
|
||||
[attachmentKeys addObject: newKey];
|
||||
[attachmentKeys release];
|
||||
attachmentKeys = nil;
|
||||
|
||||
return newAttachment;
|
||||
}
|
||||
@@ -285,8 +285,7 @@
|
||||
NSArray *keys;
|
||||
int rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
keys = [self childKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil];
|
||||
keys = [self attachmentKeys];
|
||||
if (aid < [keys count])
|
||||
{
|
||||
attachment = [self lookupAttachment: [keys objectAtIndex: aid]];
|
||||
@@ -310,9 +309,7 @@
|
||||
if (attTable)
|
||||
{
|
||||
*tablePtr = attTable;
|
||||
*countPtr = [[self childKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil]
|
||||
count];
|
||||
*countPtr = [[attTable childKeys] count];
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
@@ -661,8 +658,7 @@
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPIBoolValue (memCtx,
|
||||
[[self childKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil] count] > 0);
|
||||
[[self attachmentKeys] count] > 0);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -678,15 +674,27 @@
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
- (NSArray *) attachmentKeys
|
||||
{
|
||||
if (!attachmentKeys)
|
||||
{
|
||||
attachmentKeys = [self attachmentKeysMatchingQualifier: nil
|
||||
andSortOrderings: nil];
|
||||
[attachmentKeys retain];
|
||||
}
|
||||
|
||||
return attachmentKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) attachmentKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for attachments"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for attachments"];
|
||||
|
||||
return attachmentKeys;
|
||||
return [attachmentParts allKeys];
|
||||
}
|
||||
|
||||
- (MAPIStoreAttachmentTable *) attachmentTable
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <SOGo/SOGoFolder.h>
|
||||
@@ -39,6 +41,43 @@
|
||||
[self logWithFormat: @"unimplemented method: %@", NSStringFromSelector (_cmd)];
|
||||
}
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreFolder *)
|
||||
container messageKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreFolder *)
|
||||
container messageKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [(MAPIStoreFolder *) container lookupMessage: childKey];
|
||||
|
||||
@@ -126,9 +126,6 @@
|
||||
- (NSDate *) creationTime;
|
||||
- (NSDate *) lastModificationTime;
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREOBJECT_H */
|
||||
|
||||
@@ -440,10 +440,4 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
+14
-35
@@ -344,41 +344,6 @@ static Class NSDataK, NSStringK;
|
||||
handleId = newHandleId;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [container childKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [container childKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (void) cleanupCaches
|
||||
{
|
||||
[restrictedChildKeys release];
|
||||
@@ -818,6 +783,20 @@ static Class NSDataK, NSStringK;
|
||||
return child;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
Reference in New Issue
Block a user