Monotone-Parent: 7a12a4fc3471976029528f54b57e6999eff2b3aa
Monotone-Revision: f43939c9f93e2ae0c474453779ec04d06a04dd8a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-07-19T19:06:46 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
2de531a6cb
commit
4c86e1b09b
|
@ -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>
|
2012-07-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* OpenChange/MAPIStoreCalendarFolder.m (-createMessage): attach a
|
* OpenChange/MAPIStoreCalendarFolder.m (-createMessage): attach a
|
||||||
|
|
|
@ -50,8 +50,6 @@
|
||||||
+ (id) mapiStoreObjectInContainer: (MAPIStoreObject *) newContainer;
|
+ (id) mapiStoreObjectInContainer: (MAPIStoreObject *) newContainer;
|
||||||
- (id) initInContainer: (MAPIStoreObject *) newContainer;
|
- (id) initInContainer: (MAPIStoreObject *) newContainer;
|
||||||
|
|
||||||
+ (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
|
||||||
|
|
||||||
- (MAPIStoreObject *) container;
|
- (MAPIStoreObject *) container;
|
||||||
|
|
||||||
|
@ -61,14 +59,10 @@
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
|
|
||||||
- (BOOL) canGetProperty: (enum MAPITAGS) propTag;
|
|
||||||
|
|
||||||
- (void) addProperties: (NSDictionary *) newProperties;
|
- (void) addProperties: (NSDictionary *) newProperties;
|
||||||
- (NSMutableDictionary *) properties;
|
- (NSMutableDictionary *) properties;
|
||||||
|
|
||||||
/* ops */
|
/* ops */
|
||||||
- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
|
||||||
inMemCtx: (TALLOC_CTX *) localMemCtx;
|
|
||||||
- (int) getProperties: (struct mapistore_property_data *) data
|
- (int) getProperties: (struct mapistore_property_data *) data
|
||||||
withTags: (enum MAPITAGS *) tags
|
withTags: (enum MAPITAGS *) tags
|
||||||
andCount: (uint16_t) columnCount
|
andCount: (uint16_t) columnCount
|
||||||
|
|
|
@ -68,35 +68,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||||
return newObject;
|
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
|
- (id) init
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
|
@ -204,31 +175,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||||
return MAPISTORE_SUCCESS;
|
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
|
- (BOOL) canGetProperty: (enum MAPITAGS) propTag
|
||||||
{
|
{
|
||||||
uint16_t propValue;
|
uint16_t propValue;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#import <Foundation/NSObject.h>
|
#import <Foundation/NSObject.h>
|
||||||
|
|
||||||
#include <talloc.h>
|
#include <talloc.h>
|
||||||
|
#include <mapistore/mapistore_errors.h>
|
||||||
|
|
||||||
struct MAPIStoreTallocWrapper
|
struct MAPIStoreTallocWrapper
|
||||||
{
|
{
|
||||||
|
@ -58,4 +59,14 @@ struct MAPIStoreTallocWrapper
|
||||||
|
|
||||||
@end
|
@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 */
|
#endif /* NSOBJECT_MAPISTORE_H */
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#import <Foundation/NSThread.h>
|
#import <Foundation/NSThread.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
|
#import "MAPIStorePropertySelectors.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
#import "NSArray+MAPIStore.h"
|
#import "NSArray+MAPIStore.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
|
@ -168,3 +169,72 @@ MAPIStoreTallocWrapperDestroy (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@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
|
||||||
|
|
Loading…
Reference in a new issue