mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-01 03:22:43 +00:00
Monotone-Parent: a33d1b8b23cf8d9468c7f693a1087950524e9ebc
Monotone-Revision: cb0ecd99fcf222060f6e3bc248d2e9a9c47624c1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-04-13T19:59:04 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#import <SOGo/SOGoObject.h>
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStorePropertySelectors.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
@@ -64,6 +65,7 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
classGetters = (IMP *) MAPIStorePropertyGettersForClass (isa);
|
||||
parentContainersBag = [NSMutableArray new];
|
||||
container = nil;
|
||||
sogoObject = nil;
|
||||
@@ -190,52 +192,83 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||
- (int) getProperty: (void **) data
|
||||
withTag: (enum MAPITAGS) propTag
|
||||
{
|
||||
NSString *stringValue;
|
||||
int rc;
|
||||
MAPIStorePropertyGetter method = NULL;
|
||||
uint16_t propValue;
|
||||
const char *propName;
|
||||
|
||||
/* TODO: handle unsaved properties */
|
||||
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
switch (propTag)
|
||||
int rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
propValue = (propTag & 0xffff0000) >> 16;
|
||||
method = (MAPIStorePropertyGetter) classGetters[propValue];
|
||||
if (method)
|
||||
rc = method (self, NULL, data);
|
||||
else
|
||||
{
|
||||
case PR_DISPLAY_NAME_UNICODE:
|
||||
*data = [[sogoObject displayName] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_SEARCH_KEY: // TODO
|
||||
stringValue = [sogoObject nameInContainer];
|
||||
*data = [[stringValue dataUsingEncoding: NSASCIIStringEncoding]
|
||||
asBinaryInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_GENERATE_EXCHANGE_VIEWS: // TODO
|
||||
*data = MAPIBoolValue (memCtx, NO);
|
||||
break;
|
||||
|
||||
default:
|
||||
propName = get_proptag_name (propTag);
|
||||
if (!propName)
|
||||
propName = "<unknown>";
|
||||
propName = "<unknown>";
|
||||
*data = NULL;
|
||||
|
||||
[self warnWithFormat:
|
||||
@"unhandled or NULL value: %s (0x%.8x), childKey: %@",
|
||||
propName, propTag, [sogoObject nameInContainer]];
|
||||
// if ((propTag & 0x001F) == 0x001F)
|
||||
// {
|
||||
// stringValue = [NSString stringWithFormat: @"fake %s (0x.8x) value",
|
||||
// propName, propTag];
|
||||
// *data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
// rc = MAPISTORE_SUCCESS;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
*data = NULL;
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
// }
|
||||
break;
|
||||
@"unimplemented property: %s (0x%.8x) in class '%@'",
|
||||
propName, propTag, NSStringFromClass (isa)];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* helper getters */
|
||||
- (int) getEmptyString: (void **) data
|
||||
{
|
||||
*data = [@"" asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getLongZero: (void **) data
|
||||
{
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getYes: (void **) data
|
||||
{
|
||||
*data = MAPIBoolValue (memCtx, YES);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getNo: (void **) data
|
||||
{
|
||||
*data = MAPIBoolValue (memCtx, NO);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
/* getters */
|
||||
- (int) getPrDisplayName: (void **) data
|
||||
{
|
||||
*data = [[sogoObject displayName] asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPrSearchKey: (void **) data
|
||||
{
|
||||
NSString *stringValue;
|
||||
|
||||
stringValue = [sogoObject nameInContainer];
|
||||
*data = [[stringValue dataUsingEncoding: NSASCIIStringEncoding]
|
||||
asBinaryInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPrGenerateExchangeViews: (void **) data
|
||||
{
|
||||
return [self getNo: data];
|
||||
}
|
||||
|
||||
/* MAPIStoreProperty protocol */
|
||||
- (int) getProperties: (struct mapistore_property_data *) data
|
||||
withTags: (enum MAPITAGS *) tags
|
||||
@@ -277,8 +310,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user