diff --git a/ChangeLog b/ChangeLog index bfa16d561..97eee1d30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-02-03 Ludovic Marcotte + * OpenChange/MAPIStoreCalendarContext.m + (-openMessage:forKey:inTable:): overriden method to return + attendees as recipients. + * OpenChange/SOGoMAPIFSMessage.m (-delete): implemented method. (-setMAPIProperties:): append the new properties to the existing ones instead of replacing them. diff --git a/OpenChange/MAPIStoreCalendarContext.m b/OpenChange/MAPIStoreCalendarContext.m index d40d911aa..fbe26b3b2 100644 --- a/OpenChange/MAPIStoreCalendarContext.m +++ b/OpenChange/MAPIStoreCalendarContext.m @@ -30,13 +30,17 @@ #import #import +#import + #import "MAPIApplication.h" #import "MAPIStoreAuthenticator.h" #import "MAPIStoreCalendarMessageTable.h" #import "MAPIStoreMapping.h" +#import "MAPIStoreTypes.h" #import "SOGoGCSFolder+MAPIStore.h" #import "MAPIStoreCalendarContext.h" +#import "NSString+MAPIStore.h" #undef DEBUG #include @@ -99,4 +103,63 @@ return [MAPIStoreCalendarMessageTable class]; } +- (int) openMessage: (struct mapistore_message *) msg + forKey: (NSString *) childKey + inTable: (MAPIStoreTable *) table +{ + NSString *name, *email; + NSArray *attendees; + iCalPerson *person; + id event; + struct SRowSet *recipients; + int count, max, rc; + + rc = [super openMessage: msg forKey: childKey inTable: table]; + + if (rc == MAPI_E_SUCCESS && table == messageTable) + { + event = [[table lookupChild: childKey] component: NO secure: NO]; + attendees = [event attendees]; + max = [attendees count]; + + recipients = msg->recipients; + recipients->cRows = max; + recipients->aRow = talloc_array (recipients, struct SRow, max); + + for (count = 0; count < max; count++) + { + recipients->aRow[count].ulAdrEntryPad = 0; + recipients->aRow[count].cValues = 3; + recipients->aRow[count].lpProps = talloc_array (recipients->aRow, + struct SPropValue, + 3); + + // TODO (0x01 = primary recipient) + set_SPropValue_proptag (&(recipients->aRow[count].lpProps[0]), + PR_RECIPIENT_TYPE, + MAPILongValue (memCtx, 0x01)); + + person = [attendees objectAtIndex: count]; + + name = [person cn]; + if (!name) + name = @""; + + email = [person email]; + if (!email) + email = @""; + + set_SPropValue_proptag (&(recipients->aRow[count].lpProps[1]), + PR_DISPLAY_NAME, + [name asUnicodeInMemCtx: recipients->aRow[count].lpProps]); + set_SPropValue_proptag (&(recipients->aRow[count].lpProps[2]), + PR_EMAIL_ADDRESS, + [email asUnicodeInMemCtx: recipients->aRow[count].lpProps]); + + } + } + + return rc; +} + @end