Monotone-Parent: a59f6d7afaa2784c96352c1b819c57a31206c4bd

Monotone-Revision: 8e14613f7e0332410a0bb4de6eea4181b3432372

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-08-02T18:54:08
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
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> 2011-08-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreFSMessage.m * OpenChange/MAPIStoreFSMessage.m

View file

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

View file

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