2011-02-24 21:30:01 +01:00
|
|
|
/* MAPIStoreMessage.m - this file is part of SOGo
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Inverse inc
|
|
|
|
*
|
|
|
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2011-08-12 17:02:01 +02:00
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
2011-02-24 21:30:01 +01:00
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/NSArray.h>
|
2011-11-09 16:02:04 +01:00
|
|
|
#import <Foundation/NSBundle.h>
|
2011-09-30 22:01:50 +02:00
|
|
|
#import <Foundation/NSData.h>
|
2011-07-13 23:41:58 +02:00
|
|
|
#import <Foundation/NSDictionary.h>
|
2011-02-24 21:30:01 +01:00
|
|
|
#import <Foundation/NSString.h>
|
2011-04-13 21:59:04 +02:00
|
|
|
#import <Foundation/NSURL.h>
|
2011-02-24 21:30:01 +01:00
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
|
|
|
#import <SOGo/SOGoObject.h>
|
2011-07-13 23:41:58 +02:00
|
|
|
#import <SOGo/SOGoUser.h>
|
2011-02-24 21:30:01 +01:00
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
#import "MAPIStoreActiveTables.h"
|
|
|
|
#import "MAPIStoreAttachment.h"
|
2011-04-20 00:26:47 +02:00
|
|
|
#import "MAPIStoreAttachmentTable.h"
|
2011-04-13 21:59:04 +02:00
|
|
|
#import "MAPIStoreContext.h"
|
2011-07-13 23:41:58 +02:00
|
|
|
#import "MAPIStoreFolder.h"
|
2011-09-30 22:01:50 +02:00
|
|
|
#import "MAPIStorePropertySelectors.h"
|
2011-02-24 21:30:01 +01:00
|
|
|
#import "MAPIStoreTypes.h"
|
2011-09-30 22:01:50 +02:00
|
|
|
#import "NSData+MAPIStore.h"
|
2011-07-20 20:28:37 +02:00
|
|
|
#import "NSObject+MAPIStore.h"
|
2011-02-24 21:30:01 +01:00
|
|
|
#import "NSString+MAPIStore.h"
|
|
|
|
|
|
|
|
#import "MAPIStoreMessage.h"
|
|
|
|
|
2011-11-09 16:02:04 +01:00
|
|
|
#include <unrtf.h>
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
#undef DEBUG
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <gen_ndr/exchange.h>
|
|
|
|
#include <mapistore/mapistore.h>
|
|
|
|
#include <mapistore/mapistore_errors.h>
|
|
|
|
#include <mapistore/mapistore_nameid.h>
|
|
|
|
|
2011-11-09 16:02:04 +01:00
|
|
|
static NSString *resourcesDir = nil;
|
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
NSData *
|
2011-11-17 17:15:38 +01:00
|
|
|
MAPIStoreInternalEntryId (struct ldb_context *samCtx, NSString *username)
|
2011-09-30 22:01:50 +02:00
|
|
|
{
|
2011-11-17 17:15:38 +01:00
|
|
|
NSMutableData *entryId = nil;
|
|
|
|
TALLOC_CTX *memCtx;
|
|
|
|
struct ldb_result *res = NULL;
|
|
|
|
const char * const attrs[] = { "legacyExchangeDN", NULL };
|
|
|
|
const char *legacyDn;
|
|
|
|
int ret;
|
|
|
|
static const uint8_t const providerUid[] = { 0xdc, 0xa7, 0x40, 0xc8,
|
|
|
|
0xc0, 0x42, 0x10, 0x1a,
|
|
|
|
0xb4, 0xb9, 0x08, 0x00,
|
|
|
|
0x2b, 0x2f, 0xe1, 0x82 };
|
2011-09-30 22:01:50 +02:00
|
|
|
|
|
|
|
/* structure:
|
|
|
|
flags: 32
|
|
|
|
provideruid: 32 * 4
|
|
|
|
version: 32
|
|
|
|
type: 32
|
|
|
|
X500DN: variable */
|
|
|
|
|
2011-11-17 17:15:38 +01:00
|
|
|
memCtx = talloc_zero(NULL, TALLOC_CTX);
|
2011-09-30 22:01:50 +02:00
|
|
|
|
2011-11-17 17:15:38 +01:00
|
|
|
/* Search mapistoreURI given partial URI */
|
|
|
|
ret = ldb_search (samCtx, memCtx, &res, ldb_get_default_basedn(samCtx),
|
|
|
|
LDB_SCOPE_SUBTREE, attrs,
|
|
|
|
"(&(objectClass=user)(sAMAccountName=%s))",
|
|
|
|
[username UTF8String]);
|
|
|
|
if (ret == LDB_SUCCESS && res->count == 1)
|
|
|
|
{
|
|
|
|
legacyDn = ldb_msg_find_attr_as_string (res->msgs[0], attrs[0], NULL);
|
|
|
|
if (legacyDn)
|
|
|
|
{
|
|
|
|
entryId = [NSMutableData dataWithCapacity: 256];
|
|
|
|
[entryId appendUInt32: 0]; // flags
|
|
|
|
[entryId appendBytes: providerUid length: 16]; // provideruid
|
|
|
|
[entryId appendUInt32: 1]; // version
|
|
|
|
[entryId appendUInt32: 0]; // type (local mail user)
|
|
|
|
[entryId appendBytes: legacyDn length: strlen (legacyDn) + 1]; // x500dn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
talloc_free(memCtx);
|
2011-09-30 22:01:50 +02:00
|
|
|
|
|
|
|
return entryId;
|
|
|
|
}
|
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
NSData *
|
|
|
|
MAPIStoreExternalEntryId (NSString *cn, NSString *email)
|
2011-09-30 22:01:50 +02:00
|
|
|
{
|
|
|
|
NSMutableData *entryId;
|
|
|
|
static uint8_t providerUid[] = { 0x81, 0x2b, 0x1f, 0xa4,
|
|
|
|
0xbe, 0xa3, 0x10, 0x19,
|
|
|
|
0x9d, 0x6e, 0x00, 0xdd,
|
|
|
|
0x01, 0x0f, 0x54, 0x02 };
|
|
|
|
uint8_t flags21, flags22;
|
|
|
|
|
|
|
|
/* structure:
|
|
|
|
flags: 32
|
|
|
|
provideruid: 32 * 4
|
|
|
|
version: 16
|
|
|
|
{
|
|
|
|
PaD: 1
|
|
|
|
MAE: 2
|
|
|
|
Format: 4
|
|
|
|
M: 1
|
|
|
|
U: 1
|
|
|
|
R: 2
|
|
|
|
L: 1
|
|
|
|
Pad: 4
|
|
|
|
}
|
|
|
|
DisplayName: variable
|
|
|
|
AddressType: variable
|
|
|
|
EmailAddress: variable */
|
|
|
|
|
|
|
|
entryId = [NSMutableData dataWithCapacity: 256];
|
|
|
|
[entryId appendUInt32: 0]; // flags
|
|
|
|
[entryId appendBytes: providerUid length: 16]; // provideruid
|
|
|
|
[entryId appendUInt16: 0]; // version
|
|
|
|
|
|
|
|
flags21 = 0; /* PaD, MAE, R, Pad = 0 */
|
|
|
|
flags21 |= 0x16; /* Format: text and HTML */
|
|
|
|
flags21 |= 0x01; /* M: mime format */
|
|
|
|
|
|
|
|
flags22 = 0x90; /* U: unicode, L: no lookup */
|
|
|
|
[entryId appendUInt8: flags21];
|
|
|
|
[entryId appendUInt8: flags22];
|
|
|
|
|
|
|
|
/* DisplayName */
|
|
|
|
if (!cn)
|
|
|
|
cn = @"";
|
|
|
|
[entryId
|
|
|
|
appendData: [cn dataUsingEncoding: NSUTF16LittleEndianStringEncoding]];
|
|
|
|
[entryId appendUInt16: 0];
|
|
|
|
|
|
|
|
/* AddressType */
|
|
|
|
[entryId
|
|
|
|
appendData: [@"SMTP" dataUsingEncoding: NSUTF16LittleEndianStringEncoding]];
|
|
|
|
[entryId appendUInt16: 0];
|
|
|
|
|
|
|
|
/* EMailAddress */
|
|
|
|
if (!email)
|
|
|
|
email = @"";
|
|
|
|
[entryId
|
|
|
|
appendData: [email dataUsingEncoding: NSUTF16LittleEndianStringEncoding]];
|
|
|
|
[entryId appendUInt16: 0];
|
|
|
|
|
|
|
|
return entryId;
|
|
|
|
}
|
|
|
|
|
2011-11-09 16:02:04 +01:00
|
|
|
/* rtf conversion via unrtf */
|
|
|
|
static int
|
|
|
|
unrtf_data_output (void *data, const char *str, size_t str_len)
|
|
|
|
{
|
|
|
|
NSMutableData *rtfData = data;
|
|
|
|
|
|
|
|
[rtfData appendBytes: str length: str_len];
|
|
|
|
|
|
|
|
return str_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NSData *
|
|
|
|
uncompressRTF (NSData *compressedRTF)
|
|
|
|
{
|
|
|
|
NSData *rtfData = nil;
|
|
|
|
DATA_BLOB *rtf;
|
|
|
|
TALLOC_CTX *mem_ctx;
|
|
|
|
|
|
|
|
mem_ctx = talloc_zero (NULL, TALLOC_CTX);
|
|
|
|
rtf = talloc_zero (mem_ctx, DATA_BLOB);
|
|
|
|
|
|
|
|
if (uncompress_rtf (mem_ctx,
|
|
|
|
(uint8_t *) [compressedRTF bytes], [compressedRTF length],
|
|
|
|
rtf)
|
|
|
|
== MAPI_E_SUCCESS)
|
|
|
|
rtfData = [NSData dataWithBytes: rtf->data length: rtf->length];
|
|
|
|
|
|
|
|
talloc_free (mem_ctx);
|
|
|
|
|
|
|
|
return rtfData;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NSData *
|
|
|
|
rtf2html (NSData *compressedRTF)
|
|
|
|
{
|
|
|
|
NSData *rtf;
|
|
|
|
NSMutableData *html = nil;
|
|
|
|
int rc;
|
|
|
|
struct unRTFOptions unrtfOptions;
|
|
|
|
|
|
|
|
rtf = uncompressRTF (compressedRTF);
|
|
|
|
if (rtf)
|
|
|
|
{
|
|
|
|
html = [NSMutableData data];
|
|
|
|
memset (&unrtfOptions, 0, sizeof (struct unRTFOptions));
|
|
|
|
unrtf_set_output_device (&unrtfOptions, unrtf_data_output, html);
|
|
|
|
unrtfOptions.config_directory = [resourcesDir UTF8String];
|
|
|
|
unrtfOptions.output_format = "html";
|
|
|
|
unrtfOptions.nopict_mode = YES;
|
|
|
|
rc = unrtf_convert_from_string (&unrtfOptions,
|
|
|
|
[rtf bytes], [rtf length]);
|
|
|
|
if (!rc)
|
|
|
|
html = nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
return html;
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
@interface SOGoObject (MAPIStoreProtocol)
|
|
|
|
|
|
|
|
- (NSString *) davEntityTag;
|
|
|
|
- (NSString *) davContentLength;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation MAPIStoreMessage
|
|
|
|
|
2011-11-09 16:02:04 +01:00
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (!resourcesDir)
|
|
|
|
{
|
|
|
|
resourcesDir = [[NSBundle bundleForClass: self] resourcePath];
|
|
|
|
[resourcesDir retain];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
2011-07-15 22:22:27 +02:00
|
|
|
attachmentParts = [NSMutableDictionary new];
|
2011-03-07 20:15:16 +01:00
|
|
|
activeTables = [NSMutableArray new];
|
2011-02-24 21:30:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
[attachmentKeys release];
|
|
|
|
[attachmentParts release];
|
2011-03-07 20:15:16 +01:00
|
|
|
[activeTables release];
|
2011-02-24 21:30:01 +01:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
- (void) getMessageData: (struct mapistore_message **) dataPtr
|
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-02-24 21:30:01 +01:00
|
|
|
{
|
|
|
|
void *propValue;
|
2011-07-13 23:41:58 +02:00
|
|
|
struct mapistore_message *msgData;
|
2011-02-24 21:30:01 +01:00
|
|
|
|
|
|
|
// [self logWithFormat: @"INCOMPLETE METHOD '%s' (%d): no recipient handling",
|
|
|
|
// __FUNCTION__, __LINE__];
|
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
msgData = talloc_zero (memCtx, struct mapistore_message);
|
|
|
|
|
2011-09-30 22:01:50 +02:00
|
|
|
if ([self getPrSubjectPrefix: &propValue
|
|
|
|
inMemCtx: msgData] == MAPISTORE_SUCCESS
|
|
|
|
&& propValue)
|
|
|
|
msgData->subject_prefix = propValue;
|
|
|
|
else
|
|
|
|
msgData->subject_prefix = "";
|
|
|
|
|
|
|
|
if ([self getPrNormalizedSubject: &propValue
|
|
|
|
inMemCtx: msgData] == MAPISTORE_SUCCESS
|
|
|
|
&& propValue)
|
|
|
|
msgData->normalized_subject = propValue;
|
|
|
|
else
|
|
|
|
msgData->normalized_subject = "";
|
|
|
|
|
|
|
|
msgData->columns = talloc_zero(msgData, struct SPropTagArray);
|
|
|
|
msgData->recipients_count = 0;
|
2011-07-13 23:41:58 +02:00
|
|
|
*dataPtr = msgData;
|
|
|
|
}
|
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
- (NSDictionary *) _convertRecipient: (struct mapistore_message_recipient *) recipient
|
|
|
|
andColumns: (struct SPropTagArray *) columns
|
2011-07-13 23:41:58 +02:00
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
NSMutableDictionary *recipientProperties;
|
2011-07-13 23:41:58 +02:00
|
|
|
SOGoUser *recipientUser;
|
2011-10-28 15:10:47 +02:00
|
|
|
NSUInteger count;
|
2011-10-03 22:53:56 +02:00
|
|
|
id value;
|
2011-07-13 23:41:58 +02:00
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
recipientProperties = [NSMutableDictionary dictionaryWithCapacity: columns->cValues + 2];
|
2011-07-13 23:41:58 +02:00
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
if (recipient->username)
|
2011-07-13 23:41:58 +02:00
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
value = [NSString stringWithUTF8String: recipient->username];
|
|
|
|
[recipientProperties setObject: value forKey: @"x500dn"];
|
2011-07-13 23:41:58 +02:00
|
|
|
|
|
|
|
recipientUser = [SOGoUser userWithLogin: [value lowercaseString]];
|
|
|
|
if (recipientUser)
|
|
|
|
{
|
|
|
|
value = [recipientUser cn];
|
|
|
|
if ([value length] > 0)
|
2011-10-28 15:10:47 +02:00
|
|
|
[recipientProperties setObject: value forKey: @"fullName"];
|
2011-07-13 23:41:58 +02:00
|
|
|
value = [[recipientUser allEmails] objectAtIndex: 0];
|
|
|
|
if ([value length] > 0)
|
2011-10-28 15:10:47 +02:00
|
|
|
[recipientProperties setObject: value forKey: @"email"];
|
2011-07-13 23:41:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
if (recipient->data[0])
|
2011-07-13 23:41:58 +02:00
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
value = [NSString stringWithUTF8String: recipient->data[0]];
|
|
|
|
if ([value length] > 0)
|
|
|
|
[recipientProperties setObject: value forKey: @"fullName"];
|
2011-07-13 23:41:58 +02:00
|
|
|
}
|
2011-10-28 15:10:47 +02:00
|
|
|
if (recipient->data[1])
|
2011-07-13 23:41:58 +02:00
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
value = [NSString stringWithUTF8String: recipient->data[1]];
|
|
|
|
if ([value length] > 0)
|
|
|
|
[recipientProperties setObject: value forKey: @"email"];
|
2011-07-13 23:41:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-03 22:53:56 +02:00
|
|
|
for (count = 0; count < columns->cValues; count++)
|
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
if (recipient->data[count])
|
2011-10-03 22:53:56 +02:00
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
value = NSObjectFromValuePointer (columns->aulPropTag[count],
|
|
|
|
recipient->data[count]);
|
|
|
|
if (value)
|
|
|
|
[recipientProperties setObject: value
|
|
|
|
forKey: MAPIPropertyKey (columns->aulPropTag[count])];
|
2011-10-03 22:53:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
return recipientProperties;
|
2011-07-13 23:41:58 +02:00
|
|
|
}
|
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
- (int) modifyRecipientsWithRecipients: (struct mapistore_message_recipient *) newRecipients
|
|
|
|
andCount: (NSUInteger) max
|
|
|
|
andColumns: (struct SPropTagArray *) columns;
|
2011-07-13 23:41:58 +02:00
|
|
|
{
|
|
|
|
static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
|
|
|
NSDictionary *recipientProperties;
|
|
|
|
NSMutableDictionary *recipients;
|
|
|
|
NSMutableArray *list;
|
|
|
|
NSString *recType;
|
2011-10-28 15:10:47 +02:00
|
|
|
struct mapistore_message_recipient *recipient;
|
2011-07-13 23:41:58 +02:00
|
|
|
NSUInteger count;
|
|
|
|
|
|
|
|
[self logWithFormat: @"METHOD '%s'", __FUNCTION__];
|
|
|
|
|
|
|
|
recipients = [NSMutableDictionary new];
|
|
|
|
recipientProperties = [NSDictionary dictionaryWithObject: recipients
|
|
|
|
forKey: @"recipients"];
|
|
|
|
[recipients release];
|
|
|
|
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
recipient = newRecipients + count;
|
2011-07-13 23:41:58 +02:00
|
|
|
|
2011-10-28 15:10:47 +02:00
|
|
|
if (recipient->type >= MAPI_ORIG && recipient->type <= MAPI_BCC)
|
2011-07-13 23:41:58 +02:00
|
|
|
{
|
2011-10-28 15:10:47 +02:00
|
|
|
recType = recTypes[recipient->type];
|
2011-07-13 23:41:58 +02:00
|
|
|
list = [recipients objectForKey: recType];
|
|
|
|
if (!list)
|
|
|
|
{
|
|
|
|
list = [NSMutableArray new];
|
|
|
|
[recipients setObject: list forKey: recType];
|
|
|
|
[list release];
|
|
|
|
}
|
2011-10-03 22:53:56 +02:00
|
|
|
[list addObject:
|
2011-10-28 15:10:47 +02:00
|
|
|
[self _convertRecipient: recipient andColumns: columns]];
|
2011-07-13 23:41:58 +02:00
|
|
|
}
|
|
|
|
}
|
2011-10-26 17:15:17 +02:00
|
|
|
[self addProperties: recipientProperties];
|
2011-07-13 23:41:58 +02:00
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-11-09 16:02:04 +01:00
|
|
|
- (void) addProperties: (NSDictionary *) newNewProperties
|
|
|
|
{
|
|
|
|
NSData *htmlData, *rtfData;
|
|
|
|
static NSNumber *htmlKey = nil, *rtfKey = nil;
|
|
|
|
|
|
|
|
[super addProperties: newNewProperties];
|
|
|
|
|
|
|
|
if (!htmlKey)
|
|
|
|
{
|
|
|
|
htmlKey = MAPIPropertyKey (PR_HTML);
|
|
|
|
[htmlKey retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rtfKey)
|
|
|
|
{
|
|
|
|
rtfKey = MAPIPropertyKey (PR_RTF_COMPRESSED);
|
|
|
|
[rtfKey retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (![properties objectForKey: htmlKey])
|
|
|
|
{
|
|
|
|
rtfData = [properties objectForKey: rtfKey];
|
|
|
|
if (rtfData)
|
|
|
|
{
|
|
|
|
htmlData = rtf2html (rtfData);
|
|
|
|
[properties setObject: htmlData forKey: htmlKey];
|
|
|
|
[properties removeObjectForKey: rtfKey];
|
|
|
|
[properties removeObjectForKey: MAPIPropertyKey (PR_RTF_IN_SYNC)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-15 22:22:27 +02:00
|
|
|
- (MAPIStoreAttachment *) createAttachment
|
|
|
|
{
|
|
|
|
MAPIStoreAttachment *newAttachment;
|
|
|
|
uint32_t newAid;
|
|
|
|
NSString *newKey;
|
|
|
|
|
2011-07-26 22:13:10 +02:00
|
|
|
newAid = [[self attachmentKeys] count];
|
2011-07-15 22:22:27 +02:00
|
|
|
|
|
|
|
newAttachment = [MAPIStoreAttachment
|
|
|
|
mapiStoreObjectWithSOGoObject: nil
|
|
|
|
inContainer: self];
|
|
|
|
[newAttachment setIsNew: YES];
|
|
|
|
[newAttachment setAID: newAid];
|
|
|
|
newKey = [NSString stringWithFormat: @"%ul", newAid];
|
|
|
|
[attachmentParts setObject: newAttachment
|
|
|
|
forKey: newKey];
|
2011-07-26 22:13:10 +02:00
|
|
|
[attachmentKeys release];
|
|
|
|
attachmentKeys = nil;
|
2011-07-15 22:22:27 +02:00
|
|
|
|
|
|
|
return newAttachment;
|
|
|
|
}
|
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
- (int) createAttachment: (MAPIStoreAttachment **) attachmentPtr
|
|
|
|
inAID: (uint32_t *) aidPtr
|
|
|
|
{
|
|
|
|
MAPIStoreAttachment *attachment;
|
|
|
|
int rc = MAPISTORE_SUCCESS;
|
|
|
|
|
|
|
|
attachment = [self createAttachment];
|
|
|
|
if (attachment)
|
|
|
|
{
|
|
|
|
*attachmentPtr = attachment;
|
|
|
|
*aidPtr = [attachment AID];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2011-07-26 21:02:45 +02:00
|
|
|
- (id) lookupAttachment: (NSString *) childKey
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
- (int) getAttachment: (MAPIStoreAttachment **) attachmentPtr
|
|
|
|
withAID: (uint32_t) aid
|
|
|
|
{
|
|
|
|
MAPIStoreAttachment *attachment;
|
|
|
|
NSArray *keys;
|
|
|
|
int rc = MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
|
2011-07-26 22:13:10 +02:00
|
|
|
keys = [self attachmentKeys];
|
2011-07-13 23:41:58 +02:00
|
|
|
if (aid < [keys count])
|
|
|
|
{
|
2011-07-26 21:02:45 +02:00
|
|
|
attachment = [self lookupAttachment: [keys objectAtIndex: aid]];
|
2011-07-13 23:41:58 +02:00
|
|
|
if (attachment)
|
|
|
|
{
|
|
|
|
*attachmentPtr = attachment;
|
|
|
|
rc = MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getAttachmentTable: (MAPIStoreAttachmentTable **) tablePtr
|
|
|
|
andRowCount: (uint32_t *) countPtr
|
|
|
|
{
|
|
|
|
MAPIStoreAttachmentTable *attTable;
|
|
|
|
int rc = MAPISTORE_SUCCESS;
|
|
|
|
|
|
|
|
attTable = [self attachmentTable];
|
|
|
|
if (attTable)
|
|
|
|
{
|
|
|
|
*tablePtr = attTable;
|
2011-07-26 22:13:10 +02:00
|
|
|
*countPtr = [[attTable childKeys] count];
|
2011-07-13 23:41:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) activeContainerMessageTables
|
|
|
|
{
|
|
|
|
return [[MAPIStoreActiveTables activeTables]
|
|
|
|
activeTablesForFMID: [container objectId]
|
|
|
|
andType: MAPISTORE_MESSAGE_TABLE];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) saveMessage
|
|
|
|
{
|
|
|
|
NSArray *containerTables;
|
|
|
|
NSUInteger count, max;
|
|
|
|
struct mapistore_object_notification_parameters *notif_parameters;
|
|
|
|
uint64_t folderId;
|
|
|
|
struct mapistore_context *mstoreCtx;
|
|
|
|
|
|
|
|
/* notifications */
|
|
|
|
folderId = [(MAPIStoreFolder *) container objectId];
|
|
|
|
mstoreCtx = [[self context] connectionInfo]->mstore_ctx;
|
|
|
|
|
|
|
|
/* folder modified */
|
|
|
|
notif_parameters
|
|
|
|
= talloc_zero(NULL, struct mapistore_object_notification_parameters);
|
|
|
|
notif_parameters->object_id = folderId;
|
|
|
|
if (isNew)
|
|
|
|
{
|
|
|
|
notif_parameters->tag_count = 3;
|
|
|
|
notif_parameters->tags = talloc_array (notif_parameters,
|
|
|
|
enum MAPITAGS, 3);
|
|
|
|
notif_parameters->tags[0] = PR_CONTENT_COUNT;
|
|
|
|
notif_parameters->tags[1] = PR_MESSAGE_SIZE;
|
|
|
|
notif_parameters->tags[2] = PR_NORMAL_MESSAGE_SIZE;
|
|
|
|
notif_parameters->new_message_count = true;
|
|
|
|
notif_parameters->message_count
|
|
|
|
= [[(MAPIStoreFolder *) container messageKeys] count] + 1;
|
|
|
|
}
|
|
|
|
mapistore_push_notification (mstoreCtx,
|
|
|
|
MAPISTORE_FOLDER, MAPISTORE_OBJECT_MODIFIED,
|
|
|
|
notif_parameters);
|
|
|
|
talloc_free (notif_parameters);
|
|
|
|
|
|
|
|
/* message created */
|
|
|
|
if (isNew)
|
|
|
|
{
|
|
|
|
notif_parameters
|
|
|
|
= talloc_zero(NULL,
|
|
|
|
struct mapistore_object_notification_parameters);
|
|
|
|
notif_parameters->object_id = [self objectId];
|
|
|
|
notif_parameters->folder_id = folderId;
|
|
|
|
|
|
|
|
notif_parameters->tag_count = 0xffff;
|
|
|
|
mapistore_push_notification (mstoreCtx,
|
|
|
|
MAPISTORE_MESSAGE, MAPISTORE_OBJECT_CREATED,
|
|
|
|
notif_parameters);
|
|
|
|
talloc_free (notif_parameters);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we ensure the table caches are loaded so that old and new state
|
|
|
|
can be compared */
|
|
|
|
containerTables = [self activeContainerMessageTables];
|
|
|
|
max = [containerTables count];
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
[[containerTables objectAtIndex: count] restrictedChildKeys];
|
|
|
|
|
|
|
|
[self save];
|
|
|
|
|
|
|
|
/* table modified */
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
[[containerTables objectAtIndex: count]
|
|
|
|
notifyChangesForChild: self];
|
|
|
|
[self setIsNew: NO];
|
2011-11-07 16:11:22 +01:00
|
|
|
[properties removeAllObjects];
|
2011-07-13 23:41:58 +02:00
|
|
|
[container cleanupCaches];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
2011-02-24 21:30:01 +01:00
|
|
|
}
|
|
|
|
|
2011-04-13 21:59:04 +02:00
|
|
|
/* helper getters */
|
2011-07-11 23:40:47 +02:00
|
|
|
- (int) getSMTPAddrType: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
|
2011-02-24 21:30:01 +01:00
|
|
|
{
|
2011-04-13 21:59:04 +02:00
|
|
|
*data = [@"SMTP" asUnicodeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* getters */
|
|
|
|
- (int) getPrInstId: (void **) data // TODO: DOUBT
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
/* we return a unique id based on the key */
|
|
|
|
*data = MAPILongLongValue (memCtx, [[sogoObject nameInContainer] hash]);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrInstanceNum: (void **) data // TODO: DOUBT
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getLongZero: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrRowType: (void **) data // TODO: DOUBT
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, TBL_LEAF_ROW);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrDepth: (void **) data // TODO: DOUBT
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongLongValue (memCtx, 0);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrAccess: (void **) data // TODO
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, 0x03);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrAccessLevel: (void **) data // TODO
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, 0x01);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
// - (int) getPrViewStyle: (void **) data
|
|
|
|
// {
|
2011-07-11 23:40:47 +02:00
|
|
|
// return [self getLongZero: data inMemCtx: memCtx];
|
2011-06-07 02:17:46 +02:00
|
|
|
// }
|
2011-04-13 21:59:04 +02:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
// - (int) getPrViewMajorversion: (void **) data
|
|
|
|
// {
|
2011-07-11 23:40:47 +02:00
|
|
|
// return [self getLongZero: data inMemCtx: memCtx];
|
2011-06-07 02:17:46 +02:00
|
|
|
// }
|
2011-04-13 21:59:04 +02:00
|
|
|
|
|
|
|
- (int) getPidLidSideEffects: (void **) data // TODO
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getLongZero: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPidLidCurrentVersion: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, 115608); // Outlook 11.5608
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPidLidCurrentVersionName: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = [@"11.0" asUnicodeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPidLidAutoProcessState: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, 0x00000000);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPidNameContentClass: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = [@"Sharing" asUnicodeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrFid: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongLongValue (memCtx, [container objectId]);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrMid: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongLongValue (memCtx, [self objectId]);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrMessageLocaleId: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, 0x0409);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrMessageFlags: (void **) data // TODO
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, MSGFLAG_FROMME | MSGFLAG_READ | MSGFLAG_UNMODIFIED);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrMessageSize: (void **) data // TODO
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
/* TODO: choose another name in SOGo for that method */
|
|
|
|
*data = MAPILongValue (memCtx, [[sogoObject davContentLength] intValue]);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrMsgStatus: (void **) data // TODO
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getLongZero: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrImportance: (void **) data // TODO -> subclass?
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPILongValue (memCtx, 1);
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrPriority: (void **) data // TODO -> subclass?
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getLongZero: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrSensitivity: (void **) data // TODO -> subclass in calendar
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getLongZero: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrSubject: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
|
|
|
return MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrNormalizedSubject: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getPrSubject: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrOriginalSubject: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getPrNormalizedSubject: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrConversationTopic: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getPrNormalizedSubject: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrSubjectPrefix: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getEmptyString: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrDisplayTo: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getEmptyString: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrDisplayCc: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getEmptyString: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrDisplayBcc: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getEmptyString: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
// - (int) getPrOriginalDisplayTo: (void **) data
|
|
|
|
// {
|
|
|
|
// return [self getPrDisplayTo: data];
|
|
|
|
// }
|
2011-04-13 21:59:04 +02:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
// - (int) getPrOriginalDisplayCc: (void **) data
|
|
|
|
// {
|
|
|
|
// return [self getPrDisplayCc: data];
|
|
|
|
// }
|
2011-04-13 21:59:04 +02:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
// - (int) getPrOriginalDisplayBcc: (void **) data
|
|
|
|
// {
|
|
|
|
// return [self getPrDisplayBcc: data];
|
|
|
|
// }
|
2011-04-13 21:59:04 +02:00
|
|
|
|
|
|
|
- (int) getPrLastModifierName: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
NSURL *contextUrl;
|
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
contextUrl = (NSURL *) [[self context] url];
|
2011-04-13 21:59:04 +02:00
|
|
|
*data = [[contextUrl user] asUnicodeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrMessageClass: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
|
|
|
return MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrOrigMessageClass: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getPrMessageClass: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrHasattach: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = MAPIBoolValue (memCtx,
|
2011-07-26 22:13:10 +02:00
|
|
|
[[self attachmentKeys] count] > 0);
|
2011-04-13 21:59:04 +02:00
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
- (int) getPrAssociated: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
2011-07-11 23:40:47 +02:00
|
|
|
return [self getNo: data inMemCtx: memCtx];;
|
2011-11-01 02:00:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) setReadFlag: (uint8_t) flag
|
|
|
|
{
|
2011-11-02 21:28:42 +01:00
|
|
|
// [self subclassResponsibility: _cmd];
|
2011-11-01 02:00:33 +01:00
|
|
|
|
|
|
|
return MAPISTORE_ERROR;
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
- (void) save
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
2011-07-26 22:13:10 +02:00
|
|
|
- (NSArray *) attachmentKeys
|
|
|
|
{
|
|
|
|
if (!attachmentKeys)
|
|
|
|
{
|
|
|
|
attachmentKeys = [self attachmentKeysMatchingQualifier: nil
|
|
|
|
andSortOrderings: nil];
|
|
|
|
[attachmentKeys retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
return attachmentKeys;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) attachmentKeysMatchingQualifier: (EOQualifier *) qualifier
|
|
|
|
andSortOrderings: (NSArray *) sortOrderings
|
2011-02-24 21:30:01 +01:00
|
|
|
{
|
2011-07-15 22:22:27 +02:00
|
|
|
if (qualifier)
|
|
|
|
[self errorWithFormat: @"qualifier is not used for attachments"];
|
|
|
|
if (sortOrderings)
|
|
|
|
[self errorWithFormat: @"sort orderings are not used for attachments"];
|
|
|
|
|
2011-07-26 22:13:10 +02:00
|
|
|
return [attachmentParts allKeys];
|
2011-02-24 21:30:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (MAPIStoreAttachmentTable *) attachmentTable
|
|
|
|
{
|
2011-04-20 00:26:47 +02:00
|
|
|
return [MAPIStoreAttachmentTable tableForContainer: self];
|
2011-02-24 21:30:01 +01:00
|
|
|
}
|
|
|
|
|
2011-03-07 20:15:16 +01:00
|
|
|
- (void) addActiveTable: (MAPIStoreTable *) activeTable
|
|
|
|
{
|
|
|
|
[activeTables addObject: activeTable];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) removeActiveTable: (MAPIStoreTable *) activeTable
|
|
|
|
{
|
|
|
|
[activeTables removeObject: activeTable];
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
@end
|