mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-19 02:15:36 +00:00
Monotone-Parent: 482fb2f36da6ff311c3c19eb3752da985fdae5cd
Monotone-Revision: 8fcaef79630a50f01c6aba0e5fdc0744c274cba6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-03-07T19:15:16 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -263,6 +263,9 @@ static Class NSDataK, NSStringK;
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
tableType = MAPISTORE_MESSAGE_TABLE;
|
||||
handleId = -1;
|
||||
|
||||
container = nil;
|
||||
|
||||
childKeys = nil;
|
||||
@@ -284,11 +287,17 @@ static Class NSDataK, NSStringK;
|
||||
if ((self = [self init]))
|
||||
{
|
||||
container = newContainer;
|
||||
[container addActiveTable: self];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) deactivate
|
||||
{
|
||||
[container removeActiveTable: self];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[currentChild release];
|
||||
@@ -298,6 +307,12 @@ static Class NSDataK, NSStringK;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setHandleId: (uint32_t) newHandleId
|
||||
{
|
||||
handleId = newHandleId;
|
||||
[self logWithFormat: @"new table handle: %d", handleId];
|
||||
}
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
@@ -727,6 +742,7 @@ static Class NSDataK, NSStringK;
|
||||
child = currentChild;
|
||||
else
|
||||
{
|
||||
[currentChild release];
|
||||
child = nil;
|
||||
|
||||
if (queryType == MAPISTORE_PREFILTERED_QUERY)
|
||||
@@ -751,7 +767,11 @@ static Class NSDataK, NSStringK;
|
||||
|
||||
currentChild = child;
|
||||
[currentChild retain];
|
||||
currentRow = rowId;
|
||||
|
||||
if (child)
|
||||
currentRow = rowId;
|
||||
else
|
||||
currentRow = (uint32_t) -1;
|
||||
}
|
||||
|
||||
return child;
|
||||
@@ -780,6 +800,57 @@ static Class NSDataK, NSStringK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) notifyChangesForChild: (MAPIStoreObject *) child
|
||||
{
|
||||
NSUInteger currentChildRow, newChildRow;
|
||||
NSArray *list;
|
||||
NSString *childName;
|
||||
struct mapistore_table_notification_parameters notif_parameters;
|
||||
|
||||
notif_parameters.table_type = tableType;
|
||||
notif_parameters.handle = handleId;
|
||||
notif_parameters.folder_id = [container objectId];
|
||||
notif_parameters.object_id = [child objectId];
|
||||
notif_parameters.instance_id = 0; /* TODO: always 0 ? */
|
||||
|
||||
[self logWithFormat: @"table notification handle: %d", handleId];
|
||||
|
||||
childName = [child nameInContainer];
|
||||
list = [self restrictedChildKeys];
|
||||
currentChildRow = [list indexOfObject: childName];
|
||||
notif_parameters.row_id = currentChildRow;
|
||||
|
||||
[self cleanupCaches];
|
||||
list = [self restrictedChildKeys];
|
||||
newChildRow = [list indexOfObject: childName];
|
||||
|
||||
if (currentChildRow == NSNotFound)
|
||||
{
|
||||
if (newChildRow != NSNotFound)
|
||||
{
|
||||
notif_parameters.row_id = newChildRow;
|
||||
mapistore_push_notification (MAPISTORE_TABLE,
|
||||
MAPISTORE_OBJECT_CREATED,
|
||||
¬if_parameters);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newChildRow == NSNotFound)
|
||||
mapistore_push_notification (MAPISTORE_TABLE,
|
||||
MAPISTORE_OBJECT_DELETED,
|
||||
¬if_parameters);
|
||||
else
|
||||
{
|
||||
/* the fact that the row order has changed has no impact here */
|
||||
notif_parameters.row_id = newChildRow;
|
||||
mapistore_push_notification (MAPISTORE_TABLE,
|
||||
MAPISTORE_OBJECT_MODIFIED,
|
||||
¬if_parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* subclasses */
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user