diff --git a/ChangeLog b/ChangeLog index 39f616753..d98dac749 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-08-02 Wolfgang Sourdeau + + * OpenChange/MAPIStoreTable.m (-operatorFromRestrictionOperator): + code split from evaluatePropertyRestriction:intoQualifier: and + exposed for external use. + 2011-08-01 Wolfgang Sourdeau * OpenChange/MAPIStoreFSMessage.m diff --git a/OpenChange/MAPIStoreTable.h b/OpenChange/MAPIStoreTable.h index ae2f60d8d..941d835af 100644 --- a/OpenChange/MAPIStoreTable.h +++ b/OpenChange/MAPIStoreTable.h @@ -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; diff --git a/OpenChange/MAPIStoreTable.m b/OpenChange/MAPIStoreTable.m index e2c4b0e19..ed4f73a69 100644 --- a/OpenChange/MAPIStoreTable.m +++ b/OpenChange/MAPIStoreTable.m @@ -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;