diff --git a/ChangeLog b/ChangeLog index 56e054249..50fa4ea60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-07-22 Wolfgang Sourdeau + * OpenChange/MAPIStoreSOGo.m (sogo_table_get_row_count): added new + backend operation. + * Tests/Unit/SaxXMLReaderFactory+SOGoTests.m: new module offering a category on SaxXMLReaderFactory that enables finding our NGCards SAX driver in our source directories. diff --git a/OpenChange/MAPIStoreSOGo.m b/OpenChange/MAPIStoreSOGo.m index 72875d185..88fba7c1b 100644 --- a/OpenChange/MAPIStoreSOGo.m +++ b/OpenChange/MAPIStoreSOGo.m @@ -841,6 +841,36 @@ sogo_table_get_row (void *table_object, TALLOC_CTX *mem_ctx, return rc; } +static int +sogo_table_get_row_count (void *table_object, + enum table_query_type query_type, + uint32_t *row_countp) +{ + struct MAPIStoreTallocWrapper *wrapper; + NSAutoreleasePool *pool; + MAPIStoreTable *table; + int rc; + + DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__)); + + if (table_object) + { + wrapper = table_object; + table = wrapper->MAPIStoreSOGoObject; + pool = [NSAutoreleasePool new]; + rc = [table getRowCount: row_countp + withQueryType: query_type]; + [pool release]; + } + else + { + NSLog (@" UNEXPECTED WEIRDNESS: RECEIVED NO DATA"); + rc = MAPISTORE_SUCCESS; + } + + return rc; +} + static int sogo_properties_get_available_properties(void *object, TALLOC_CTX *mem_ctx, struct SPropTagArray **propertiesP) @@ -973,6 +1003,7 @@ int mapistore_init_backend(void) backend.table.set_sort_order = sogo_table_set_sort_order; backend.table.set_columns = sogo_table_set_columns; backend.table.get_row = sogo_table_get_row; + backend.table.get_row_count = sogo_table_get_row_count; backend.properties.get_available_properties = sogo_properties_get_available_properties; backend.properties.get_properties = sogo_properties_get_properties; backend.properties.set_properties = sogo_properties_set_properties; diff --git a/OpenChange/MAPIStoreTable.h b/OpenChange/MAPIStoreTable.h index e1bc3a7f3..c292982a8 100644 --- a/OpenChange/MAPIStoreTable.h +++ b/OpenChange/MAPIStoreTable.h @@ -96,6 +96,8 @@ typedef enum { withRowID: (uint32_t) rowId andQueryType: (enum table_query_type) queryType inMemCtx: (TALLOC_CTX *) memCtx; +- (int) getRowCount: (uint32_t *) countP + withQueryType: (enum table_query_type) queryType; - (void) notifyChangesForChild: (MAPIStoreObject *) child; diff --git a/OpenChange/MAPIStoreTable.m b/OpenChange/MAPIStoreTable.m index 205b31e3f..efc1887e1 100644 --- a/OpenChange/MAPIStoreTable.m +++ b/OpenChange/MAPIStoreTable.m @@ -846,6 +846,21 @@ static Class NSDataK, NSStringK; return rc; } +- (int) getRowCount: (uint32_t *) countP + withQueryType: (enum table_query_type) queryType +{ + NSArray *children; + + if (queryType == MAPISTORE_PREFILTERED_QUERY) + children = [self restrictedChildKeys]; + else + children = [self childKeys]; + + *countP = [children count]; + + return MAPISTORE_SUCCESS; +} + - (void) notifyChangesForChild: (MAPIStoreObject *) child { NSUInteger currentChildRow, newChildRow;