oc: Implement Sharing Message Object

It acts as a proxy of MAPIStoreMailMessage and it manages the properties
defined in [MS-OXSHARE] Section 2.2 by storing them in the mail message
as eXtensible MIME headers which starts with X-MS-Sharing.
This commit is contained in:
Enrique J. Hernández Blasco
2015-03-02 23:41:04 +01:00
parent 575600cabc
commit 316ade13f8
6 changed files with 575 additions and 4 deletions

View File

@@ -51,6 +51,7 @@
#import "MAPIStoreMailFolder.h"
#import "MAPIStoreMapping.h"
#import "MAPIStoreSamDBUtils.h"
#import "MAPIStoreSharingMessage.h"
#import "MAPIStoreTypes.h"
#import "MAPIStoreUserContext.h"
@@ -115,6 +116,7 @@ static Class NSExceptionK;
{
mimeKey = nil;
mailIsEvent = NO;
mailIsSharingObject = NO;
headerCharset = nil;
headerEncoding = nil;
headerMimeType = nil;
@@ -201,9 +203,11 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
- (void) _fetchHeaderData
{
MAPIStoreSharingMessage *sharingMessage;
NSMutableArray *keys;
NSArray *acceptedTypes;
NSDictionary *messageData, *partHeaderData, *parameters;
NSString *sharingHeader;
acceptedTypes = [NSArray arrayWithObjects: @"text/calendar",
@"application/ics",
@@ -228,6 +232,21 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
if ([headerMimeType isEqualToString: @"text/calendar"]
|| [headerMimeType isEqualToString: @"application/ics"])
mailIsEvent = YES;
else
{
sharingHeader = [[sogoObject mailHeaders] objectForKey: @"x-ms-sharing-localtype"];
if (sharingHeader)
{
mailIsSharingObject = YES;
/* It is difficult to subclass this in folder class, that's why
a sharing object is a proxy in a mail message */
sharingMessage = [[MAPIStoreSharingMessage alloc]
initWithMailHeaders: [sogoObject mailHeaders]
andConnectionInfo: [[self context] connectionInfo]];
[self addProxy: sharingMessage];
[sharingMessage release];
}
}
}
headerSetup = YES;
@@ -517,6 +536,8 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
if (mailIsEvent)
[[self _appointmentWrapper] getPidTagMessageClass: data
inMemCtx: memCtx];
else if (mailIsSharingObject)
*data = talloc_strdup (memCtx, "IPM.Sharing");
else
*data = talloc_strdup (memCtx, "IPM.Note");