Monotone-Parent: 7a12a4fc3471976029528f54b57e6999eff2b3aa

Monotone-Revision: f43939c9f93e2ae0c474453779ec04d06a04dd8a

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-07-19T19:06:46
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2012-07-19 19:06:46 +00:00
parent 2de531a6cb
commit 4c86e1b09b
5 changed files with 88 additions and 60 deletions

View File

@ -1,3 +1,10 @@
2012-07-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/NSObject+MAPIStore.m
(+getAvailableProperties:inMemCtx:)
(-getAvailableProperties:inMemCtx:, canGetProperty:): methods
moved from MAPIStoreObject.m
2012-07-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCalendarFolder.m (-createMessage): attach a

View File

@ -50,8 +50,6 @@
+ (id) mapiStoreObjectInContainer: (MAPIStoreObject *) newContainer;
- (id) initInContainer: (MAPIStoreObject *) newContainer;
+ (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx;
- (MAPIStoreObject *) container;
@ -61,14 +59,10 @@
/* properties */
- (BOOL) canGetProperty: (enum MAPITAGS) propTag;
- (void) addProperties: (NSDictionary *) newProperties;
- (NSMutableDictionary *) properties;
/* ops */
- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) localMemCtx;
- (int) getProperties: (struct mapistore_property_data *) data
withTags: (enum MAPITAGS *) tags
andCount: (uint16_t) columnCount

View File

@ -68,35 +68,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
return newObject;
}
+ (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx
{
struct SPropTagArray *properties;
const MAPIStorePropertyGetter *classGetters;
NSUInteger count;
enum MAPITAGS propTag;
uint16_t propValue;
properties = talloc_zero (memCtx, struct SPropTagArray);
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
MAPIStoreSupportedPropertiesCount);
classGetters = MAPIStorePropertyGettersForClass (self);
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
{
propTag = MAPIStoreSupportedProperties[count];
propValue = (propTag & 0xffff0000) >> 16;
if (classGetters[propValue])
{
properties->aulPropTag[properties->cValues] = propTag;
properties->cValues++;
}
}
*propertiesP = properties;
return MAPISTORE_SUCCESS;
}
- (id) init
{
if ((self = [super init]))
@ -204,31 +175,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
return MAPISTORE_SUCCESS;
}
- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx
{
NSUInteger count;
struct SPropTagArray *availableProps;
enum MAPITAGS propTag;
availableProps = talloc_zero (memCtx, struct SPropTagArray);
availableProps->aulPropTag = talloc_array (availableProps, enum MAPITAGS,
MAPIStoreSupportedPropertiesCount);
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
{
propTag = MAPIStoreSupportedProperties[count];
if ([self canGetProperty: propTag])
{
availableProps->aulPropTag[availableProps->cValues] = propTag;
availableProps->cValues++;
}
}
*propertiesP = availableProps;
return MAPISTORE_SUCCESS;
}
- (BOOL) canGetProperty: (enum MAPITAGS) propTag
{
uint16_t propValue;

View File

@ -26,6 +26,7 @@
#import <Foundation/NSObject.h>
#include <talloc.h>
#include <mapistore/mapistore_errors.h>
struct MAPIStoreTallocWrapper
{
@ -58,4 +59,14 @@ struct MAPIStoreTallocWrapper
@end
@interface NSObject (MAPIStoreProperties)
+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx;
- (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx;
- (BOOL) canGetProperty: (enum MAPITAGS) propTag;
@end
#endif /* NSOBJECT_MAPISTORE_H */

View File

@ -25,6 +25,7 @@
#import <Foundation/NSThread.h>
#import <NGExtensions/NSObject+Logs.h>
#import "MAPIStorePropertySelectors.h"
#import "MAPIStoreTypes.h"
#import "NSArray+MAPIStore.h"
#import "NSData+MAPIStore.h"
@ -168,3 +169,72 @@ MAPIStoreTallocWrapperDestroy (void *data)
}
@end
@implementation NSObject (MAPIStoreProperties)
+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx
{
struct SPropTagArray *properties;
const MAPIStorePropertyGetter *classGetters;
NSUInteger count;
enum MAPITAGS propTag;
uint16_t propValue;
properties = talloc_zero (memCtx, struct SPropTagArray);
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
MAPIStoreSupportedPropertiesCount);
classGetters = MAPIStorePropertyGettersForClass (self);
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
{
propTag = MAPIStoreSupportedProperties[count];
propValue = (propTag & 0xffff0000) >> 16;
if (classGetters[propValue])
{
properties->aulPropTag[properties->cValues] = propTag;
properties->cValues++;
}
}
*propertiesP = properties;
return MAPISTORE_SUCCESS;
}
- (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
inMemCtx: (TALLOC_CTX *) memCtx
{
NSUInteger count;
struct SPropTagArray *availableProps;
enum MAPITAGS propTag;
availableProps = talloc_zero (memCtx, struct SPropTagArray);
availableProps->aulPropTag = talloc_array (availableProps, enum MAPITAGS,
MAPIStoreSupportedPropertiesCount);
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
{
propTag = MAPIStoreSupportedProperties[count];
if ([self canGetProperty: propTag])
{
availableProps->aulPropTag[availableProps->cValues] = propTag;
availableProps->cValues++;
}
}
*propertiesP = availableProps;
return MAPISTORE_SUCCESS;
}
- (BOOL) canGetProperty: (enum MAPITAGS) propTag
{
uint16_t propValue;
const IMP *classGetters;
classGetters = (IMP *) MAPIStorePropertyGettersForClass (isa);
propValue = (propTag & 0xffff0000) >> 16;
return (classGetters[propValue] != NULL);
}
@end