Monotone-Parent: 5599b85afd7e2707325836a3b533b900d96b8b0c

Monotone-Revision: 570b17715b63da450bef9fde6d9c95288911034f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-08-15T01:02:08
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2012-08-15 01:02:08 +00:00
parent dac62b634c
commit 45974ec74b
12 changed files with 284 additions and 71 deletions

View File

@@ -315,6 +315,62 @@ static Class NSExceptionK, MAPIStoreFolderK;
return MAPISTORE_SUCCESS;
}
/* move and copy operations */
- (void) copyPropertiesToObject: (MAPIStoreObject *) newObject
{
TALLOC_CTX *memCtx;
struct SPropTagArray *availableProps;
struct SRow row;
enum MAPITAGS propTag;
bool *exclusions;
NSUInteger count;
enum mapistore_error error;
void *data;
memCtx = talloc_zero (NULL, TALLOC_CTX);
[self getAvailableProperties: &availableProps inMemCtx: memCtx];
/* We exclude identity and versioning properties to facilitate copy
operations. If they need to be set (move operations), the caller will need
to take care of them. */
exclusions = talloc_array (memCtx, bool, 65536);
exclusions[PidTagRowType >> 16] = true;
exclusions[PidTagInstanceKey >> 16] = true;
exclusions[PidTagInstanceNum >> 16] = true;
exclusions[PidTagInstID >> 16] = true;
exclusions[PidTagAttachNumber >> 16] = true;
exclusions[PidTagFolderId >> 16] = true;
exclusions[PidTagMid >> 16] = true;
exclusions[PidTagSourceKey >> 16] = true;
exclusions[PidTagParentSourceKey >> 16] = true;
exclusions[PidTagParentFolderId >> 16] = true;
exclusions[PidTagChangeKey >> 16] = true;
exclusions[PidTagChangeNumber >> 16] = true;
exclusions[PidTagPredecessorChangeList >> 16] = true;
row.cValues = 0;
row.lpProps = talloc_array (memCtx, struct SPropValue, 65535);
for (count = 0; count < availableProps->cValues; count++)
{
propTag = availableProps->aulPropTag[count];
if (!exclusions[propTag >> 16])
{
error = [self getProperty: &data withTag: propTag inMemCtx: memCtx];
if (error == MAPISTORE_SUCCESS && data)
{
set_SPropValue_proptag (row.lpProps + row.cValues, propTag, data);
row.cValues++;
}
}
}
[newObject addPropertiesFromRow: &row];
talloc_free (memCtx);
}
/* subclasses */
- (NSString *) nameInContainer
{