Monotone-Parent: e160c8da7c5049a7b1bbca545d886045ba8a2f14
Monotone-Revision: b1f1b1e8d2d0e0165cffef74b543546db1110544 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-08-11T22:56:04 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
bd78438d3c
commit
5af234e075
|
@ -1,7 +1,16 @@
|
|||
2011-08-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreFSFolderTable.[hm]: new module.
|
||||
|
||||
* OpenChange/MAPIStoreFSFolder.m (-folderTable): overriden method
|
||||
to return a "MAPIStoreFSFolderTable" instance.
|
||||
(-folderKeysMatchingQualifier:andSortOrderings:): overriden method
|
||||
in order to evaluate folders by applying the received qualifer to
|
||||
the properties message.
|
||||
|
||||
* OpenChange/MAPIStoreFolder.m (-objectVersion): implemented
|
||||
method based on the value provided in the folder props dictionary.
|
||||
(-propertiesMessage): new getter.
|
||||
|
||||
* OpenChange/MAPIStoreObject.m (-objectVersion): now a mandatory
|
||||
method for subclasses.
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCharacterSet.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
@ -103,15 +105,28 @@
|
|||
|
||||
@implementation EOKeyValueQualifier (MAPIStoreRestrictionsPrivate)
|
||||
|
||||
typedef BOOL (*EOComparator) (id, SEL, id);
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
NSNumber *propTag;
|
||||
id finalKey;
|
||||
id propValue;
|
||||
EOComparator comparator;
|
||||
|
||||
propTag = [NSNumber numberWithInt: [key intValue]];
|
||||
propValue = [properties objectForKey: propTag];
|
||||
if ([key isKindOfClass: [NSNumber class]])
|
||||
finalKey = key;
|
||||
else if ([key isKindOfClass: [NSString class]])
|
||||
{
|
||||
finalKey = [key stringByTrimmingCharactersInSet: [NSCharacterSet decimalDigitCharacterSet]];
|
||||
if ([finalKey length] > 0)
|
||||
finalKey = key;
|
||||
else
|
||||
finalKey = [NSNumber numberWithInt: [key intValue]];
|
||||
}
|
||||
propValue = [properties objectForKey: finalKey];
|
||||
comparator = (EOComparator) [propValue methodForSelector: operator];
|
||||
|
||||
return [propValue performSelector: operator withObject: value] != nil;
|
||||
return (comparator ? comparator (propValue, operator, value) : NO);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -51,6 +51,7 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
|||
\
|
||||
MAPIStoreFSBaseContext.m \
|
||||
MAPIStoreFSFolder.m \
|
||||
MAPIStoreFSFolderTable.m \
|
||||
MAPIStoreFSMessage.m \
|
||||
MAPIStoreFSMessageTable.m \
|
||||
\
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import "EOQualifier+MAPIFS.h"
|
||||
#import "MAPIStoreFSFolderTable.h"
|
||||
#import "MAPIStoreFSMessage.h"
|
||||
#import "MAPIStoreFSMessageTable.h"
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "SOGoMAPIFSFolder.h"
|
||||
#import "SOGoMAPIFSMessage.h"
|
||||
|
@ -42,12 +43,13 @@
|
|||
// #include <libmapiproxy.h>
|
||||
// #include <param.h>
|
||||
|
||||
static Class MAPIStoreFSMessageK;
|
||||
static Class EOKeyValueQualifierK, MAPIStoreFSMessageK;
|
||||
|
||||
@implementation MAPIStoreFSFolder
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
EOKeyValueQualifierK = [EOKeyValueQualifier class];
|
||||
MAPIStoreFSMessageK = [MAPIStoreFSMessage class];
|
||||
}
|
||||
|
||||
|
@ -75,6 +77,11 @@ static Class MAPIStoreFSMessageK;
|
|||
return MAPIStoreFSMessageK;
|
||||
}
|
||||
|
||||
- (MAPIStoreFolderTable *) folderTable
|
||||
{
|
||||
return [MAPIStoreFSFolderTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (NSString *) createFolder: (struct SRow *) aRow
|
||||
withFID: (uint64_t) newFID
|
||||
{
|
||||
|
@ -117,6 +124,37 @@ static Class MAPIStoreFSMessageK;
|
|||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSArray *entries;
|
||||
NSMutableArray *filteredEntries;
|
||||
NSUInteger count, max;
|
||||
MAPIStoreFSFolder *subfolder;
|
||||
SOGoMAPIFSMessage *propertiesMessage;
|
||||
NSString *subfolderKey;
|
||||
|
||||
entries = [(SOGoMAPIFSFolder *) sogoObject toManyRelationshipKeys];
|
||||
if (qualifier)
|
||||
{
|
||||
max = [entries count];
|
||||
filteredEntries = [NSMutableArray arrayWithCapacity: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
subfolderKey = [entries objectAtIndex: count];
|
||||
subfolder = [self lookupFolder: subfolderKey];
|
||||
propertiesMessage = [subfolder propertiesMessage];
|
||||
if ([qualifier evaluateMAPIFSMessage: propertiesMessage])
|
||||
[filteredEntries addObject: subfolderKey];
|
||||
}
|
||||
entries = filteredEntries;
|
||||
}
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for folders"];
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
- (id) lookupFolder: (NSString *) childKey
|
||||
{
|
||||
id childObject = nil;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* MAPIStoreFSFolderTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef MAPISTOREFSFOLDERTABLE_H
|
||||
#define MAPISTOREFSFOLDERTABLE_H
|
||||
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
|
||||
@interface MAPIStoreFSFolderTable : MAPIStoreFolderTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFSFOLDERTABLE_H */
|
|
@ -0,0 +1,36 @@
|
|||
/* MAPIStoreFSFolderTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
|
||||
#import "MAPIStoreFSFolderTable.h"
|
||||
|
||||
@implementation MAPIStoreFSFolderTable
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@", MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
@end
|
|
@ -68,6 +68,8 @@
|
|||
- (NSArray *) activeMessageTables;
|
||||
- (NSArray *) activeFAIMessageTables;
|
||||
|
||||
- (SOGoMAPIFSMessage *) propertiesMessage;
|
||||
|
||||
- (id) lookupMessageByURL: (NSString *) messageURL;
|
||||
- (id) lookupFolderByURL: (NSString *) folderURL;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
|||
andTableType: MAPISTORE_FAI_TABLE]);
|
||||
ASSIGN (propsFolder,
|
||||
[SOGoMAPIFSFolder folderWithURL: newURL
|
||||
andTableType: MAPISTORE_FOLDER_TABLE]);
|
||||
andTableType: MAPISTORE_FOLDER_TABLE]);
|
||||
ASSIGN (propsMessage,
|
||||
[SOGoMAPIFSMessage objectWithName: @"properties.plist"
|
||||
inContainer: propsFolder]);
|
||||
|
@ -144,6 +144,11 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
|||
}
|
||||
|
||||
/* backend interface */
|
||||
- (SOGoMAPIFSMessage *) propertiesMessage
|
||||
{
|
||||
return propsMessage;
|
||||
}
|
||||
|
||||
- (uint64_t) objectVersion
|
||||
{
|
||||
NSNumber *value;
|
||||
|
|
Loading…
Reference in New Issue