From 88a5fec7537e59782a2fad64bd203f783fdc0e73 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 3 Oct 2011 20:53:56 +0000 Subject: [PATCH] Monotone-Parent: 9109f0600492701322f24fb53d86a39821e26dc4 Monotone-Revision: cb5283601b9539bb382aa64a739bf758b9e2ac7f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-10-03T20:53:56 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 +++++ OpenChange/MAPIStoreMessage.h | 3 ++- OpenChange/MAPIStoreMessage.m | 41 +++++++++++++++++++++++++++++++---- OpenChange/MAPIStoreSOGo.m | 5 ++++- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8748a06d8..35409902d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-10-03 Wolfgang Sourdeau + + * OpenChange/MAPIStoreSOGo.m (sogo_message_modify_recipients): + this backend op now has a "columns" arguments for the dynamic data + records. + 2011-09-30 Wolfgang Sourdeau * OpenChange/MAPIStoreMailMessage.m (-getMessageData:inMemCtx:): diff --git a/OpenChange/MAPIStoreMessage.h b/OpenChange/MAPIStoreMessage.h index 3a0facfdf..2e1a00e6d 100644 --- a/OpenChange/MAPIStoreMessage.h +++ b/OpenChange/MAPIStoreMessage.h @@ -51,7 +51,8 @@ extern NSData *MAPIStoreExternalEntryId (NSString *cn, NSString *email); inMemCtx: (TALLOC_CTX *) memCtx; - (int) modifyRecipientsWithRows: (struct ModifyRecipientRow *) rows - andCount: (NSUInteger) max; + andCount: (NSUInteger) max + andColumns: (struct SPropTagArray *) columns; - (NSArray *) attachmentKeys; - (NSArray *) attachmentKeysMatchingQualifier: (EOQualifier *) qualifier andSortOrderings: (NSArray *) sortOrderings; diff --git a/OpenChange/MAPIStoreMessage.m b/OpenChange/MAPIStoreMessage.m index 0acdf6b51..552e567be 100644 --- a/OpenChange/MAPIStoreMessage.m +++ b/OpenChange/MAPIStoreMessage.m @@ -204,10 +204,14 @@ NSData *MAPIStoreExternalEntryId (NSString *cn, NSString *email) } - (NSDictionary *) _convertRecipientFromRow: (struct RecipientRow *) row + andColumns: (struct SPropTagArray *) columns { - NSMutableDictionary *recipient; - NSString *value; + NSMutableDictionary *recipient, *properties; SOGoUser *recipientUser; + NSUInteger count, dataPos; + struct mapi_SPropValue mapiValue; + id value; + TALLOC_CTX *memCtx; recipient = [NSMutableDictionary dictionaryWithCapacity: 5]; @@ -260,11 +264,39 @@ NSData *MAPIStoreExternalEntryId (NSString *cn, NSString *email) [recipient setObject: value forKey: @"fullName"]; } + properties = [NSMutableDictionary new]; + [recipient setObject: properties forKey: @"properties"]; + dataPos = 0; + + memCtx = talloc_zero (NULL, TALLOC_CTX); + for (count = 0; count < columns->cValues; count++) + { + mapiValue.ulPropTag = columns->aulPropTag[count]; + if (row->layout) + { + if (row->prop_values.data[dataPos]) + { + dataPos += 5; + continue; + } + else + dataPos++; + } + set_mapi_SPropValue (memCtx, &mapiValue, row->prop_values.data + dataPos); + value = NSObjectFromMAPISPropValue (&mapiValue); + dataPos += get_mapi_property_size (&mapiValue); + if (value) + [properties setObject: value forKey: MAPIPropertyKey (columns->aulPropTag[count])]; + } + [properties release]; + talloc_free (memCtx); + return recipient; } - (int) modifyRecipientsWithRows: (struct ModifyRecipientRow *) rows andCount: (NSUInteger) max + andColumns: (struct SPropTagArray *) columns { static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" }; NSDictionary *recipientProperties; @@ -296,8 +328,9 @@ NSData *MAPIStoreExternalEntryId (NSString *cn, NSString *email) [recipients setObject: list forKey: recType]; [list release]; } - [list addObject: [self _convertRecipientFromRow: - &(currentRow->RecipientRow)]]; + [list addObject: + [self _convertRecipientFromRow: &(currentRow->RecipientRow) + andColumns: columns]]; } } [self addNewProperties: recipientProperties]; diff --git a/OpenChange/MAPIStoreSOGo.m b/OpenChange/MAPIStoreSOGo.m index 3c041100a..32869f644 100644 --- a/OpenChange/MAPIStoreSOGo.m +++ b/OpenChange/MAPIStoreSOGo.m @@ -642,6 +642,7 @@ sogo_message_get_attachment_table (void *message_object, TALLOC_CTX *mem_ctx, vo static int sogo_message_modify_recipients (void *message_object, + struct SPropTagArray *columns, struct ModifyRecipientRow *recipients, uint16_t count) { @@ -657,7 +658,9 @@ sogo_message_modify_recipients (void *message_object, wrapper = message_object; message = wrapper->MAPIStoreSOGoObject; pool = [NSAutoreleasePool new]; - rc = [message modifyRecipientsWithRows: recipients andCount: count]; + rc = [message modifyRecipientsWithRows: recipients + andCount: count + andColumns: columns]; // [context tearDownRequest]; [pool release]; }