Monotone-Parent: a59f6d7afaa2784c96352c1b819c57a31206c4bd

Monotone-Revision: 8e14613f7e0332410a0bb4de6eea4181b3432372

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-08-02T18:54:08
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-08-02 18:54:08 +00:00
parent 90b80cdf7f
commit 6a67a2ff30
3 changed files with 39 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2011-08-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreTable.m (-operatorFromRestrictionOperator):
code split from evaluatePropertyRestriction:intoQualifier: and
exposed for external use.
2011-08-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreFSMessage.m

View File

@ -79,12 +79,8 @@ typedef enum {
- (void) setHandleId: (uint32_t) newHandleId;
- (NSArray *) childKeys;
- (NSArray *) restrictedChildKeys;
- (id) childAtRowID: (uint32_t) rowId
forQueryType: (enum table_query_type) queryType;
- (id) lookupChild: (NSString *) childKey;
- (void) cleanupCaches;
@ -104,10 +100,16 @@ typedef enum {
/* helpers */
- (SEL) operatorFromRestrictionOperator: (uint32_t) resOp;
- (void) warnUnhandledProperty: (enum MAPITAGS) property
inFunction: (const char *) function;
/* subclasses */
- (NSArray *) childKeys;
- (NSArray *) restrictedChildKeys;
- (id) lookupChild: (NSString *) childKey;
- (void) setSortOrder: (const struct SSortOrderSet *) set;
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property;

View File

@ -580,8 +580,7 @@ static Class NSDataK, NSStringK;
return rc;
}
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
intoQualifier: (EOQualifier **) qualifier
- (SEL) operatorFromRestrictionOperator: (uint32_t) resOp
{
static SEL operators[] = { EOQualifierOperatorLessThan,
EOQualifierOperatorLessThanOrEqualTo,
@ -591,6 +590,23 @@ static Class NSDataK, NSStringK;
EOQualifierOperatorNotEqual,
EOQualifierOperatorContains };
SEL operator;
if (resOp < 7)
operator = operators[resOp];
else
{
operator = NULL;
[NSException raise: @"MAPIStoreRestrictionException"
format: @"unhandled operator type number %d", resOp];
}
return operator;
}
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
intoQualifier: (EOQualifier **) qualifier
{
SEL operator;
id value;
NSString *property;
MAPIRestrictionState rc;
@ -598,17 +614,8 @@ static Class NSDataK, NSStringK;
property = [self backendIdentifierForProperty: res->ulPropTag];
if (property)
{
if (res->relop >= 0 && res->relop < 7)
operator = operators[res->relop];
else
{
operator = NULL;
[NSException raise: @"MAPIStoreRestrictionException"
format: @"unhandled operator type number %d", res->relop];
}
operator = [self operatorFromRestrictionOperator: res->relop];
value = NSObjectFromMAPISPropValue (&res->lpProp);
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: property
operatorSelector: operator
value: value];
@ -713,6 +720,14 @@ static Class NSDataK, NSStringK;
intoQualifier: qualifier];
break;
case RES_COMMENT:
if (res->res.resComment.RestrictionPresent)
state = [self evaluateRestriction: (struct mapi_SRestriction *) res->res.resComment.Restriction.res
intoQualifier: qualifier];
else
state = MAPIRestrictionStateAlwaysTrue;
break;
// case 5: MAPIStringForComparePropsRestriction(&resPtr->res.resCompareProps); break;
// case 7: MAPIStringForPropertyRestriction(&resPtr->res.resProperty); break;
// case 9: MAPIStringForPropertyRestriction(&resPtr->res.resProperty); break;