2011-02-24 21:27:55 +01:00
|
|
|
/* MAPIStoreObject.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:27:55 +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/NSDictionary.h>
|
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
|
|
|
#import <SOGo/SOGoObject.h>
|
2011-07-19 23:49:37 +02:00
|
|
|
#import <SOGo/SOGoUser.h>
|
|
|
|
#import <SOGo/SOGoUserDefaults.h>
|
2011-02-24 21:27:55 +01:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
#import "MAPIStoreContext.h"
|
2011-02-24 21:27:55 +01:00
|
|
|
#import "MAPIStoreFolder.h"
|
2011-04-13 21:59:04 +02:00
|
|
|
#import "MAPIStorePropertySelectors.h"
|
2011-02-24 21:27:55 +01:00
|
|
|
#import "MAPIStoreTypes.h"
|
2012-01-29 20:55:21 +01:00
|
|
|
#import "MAPIStoreUserContext.h"
|
2011-06-07 02:17:46 +02:00
|
|
|
#import "NSDate+MAPIStore.h"
|
2011-02-24 21:27:55 +01:00
|
|
|
#import "NSData+MAPIStore.h"
|
2011-07-20 20:28:37 +02:00
|
|
|
#import "NSObject+MAPIStore.h"
|
2011-02-24 21:27:55 +01:00
|
|
|
#import "NSString+MAPIStore.h"
|
|
|
|
|
|
|
|
#import "MAPIStoreObject.h"
|
|
|
|
|
|
|
|
#undef DEBUG
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <talloc.h>
|
|
|
|
#include <gen_ndr/exchange.h>
|
|
|
|
#include <mapistore/mapistore.h>
|
|
|
|
#include <mapistore/mapistore_errors.h>
|
|
|
|
|
|
|
|
@implementation MAPIStoreObject
|
|
|
|
|
|
|
|
static Class NSExceptionK, MAPIStoreFolderK;
|
|
|
|
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
NSExceptionK = [NSExceptionK class];
|
|
|
|
MAPIStoreFolderK = [MAPIStoreFolder class];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id) mapiStoreObjectWithSOGoObject: (id) newSOGoObject
|
|
|
|
inContainer: (MAPIStoreObject *) newContainer
|
|
|
|
{
|
|
|
|
id newObject;
|
|
|
|
|
|
|
|
newObject = [[self alloc] initWithSOGoObject: newSOGoObject
|
|
|
|
inContainer: newContainer];
|
|
|
|
[newObject autorelease];
|
|
|
|
|
|
|
|
return newObject;
|
|
|
|
}
|
|
|
|
|
2011-06-07 01:59:31 +02:00
|
|
|
+ (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-19 23:57:52 +02:00
|
|
|
{
|
2011-06-07 01:59:31 +02:00
|
|
|
struct SPropTagArray *properties;
|
2011-04-19 23:57:52 +02:00
|
|
|
const MAPIStorePropertyGetter *classGetters;
|
|
|
|
NSUInteger count;
|
|
|
|
enum MAPITAGS propTag;
|
|
|
|
uint16_t propValue;
|
|
|
|
|
2011-08-13 03:52:55 +02:00
|
|
|
properties = talloc_zero (memCtx, struct SPropTagArray);
|
2011-04-19 23:57:52 +02:00
|
|
|
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
|
|
|
|
MAPIStoreSupportedPropertiesCount);
|
|
|
|
classGetters = MAPIStorePropertyGettersForClass (self);
|
|
|
|
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
|
|
|
|
{
|
|
|
|
propTag = MAPIStoreSupportedProperties[count];
|
|
|
|
propValue = (propTag & 0xffff0000) >> 16;
|
|
|
|
if (classGetters[propValue])
|
|
|
|
{
|
|
|
|
properties->aulPropTag[properties->cValues] = propTag;
|
|
|
|
properties->cValues++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-07 01:59:31 +02:00
|
|
|
*propertiesP = properties;
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
2011-04-19 23:57:52 +02:00
|
|
|
}
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
2011-04-13 21:59:04 +02:00
|
|
|
classGetters = (IMP *) MAPIStorePropertyGettersForClass (isa);
|
2011-02-24 21:27:55 +01:00
|
|
|
parentContainersBag = [NSMutableArray new];
|
|
|
|
container = nil;
|
|
|
|
sogoObject = nil;
|
2011-10-26 17:15:17 +02:00
|
|
|
properties = [NSMutableDictionary new];
|
2011-03-07 20:15:16 +01:00
|
|
|
isNew = NO;
|
2011-02-24 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
2011-07-13 23:41:58 +02:00
|
|
|
[self logWithFormat: @"-init"];
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithSOGoObject: (id) newSOGoObject
|
|
|
|
inContainer: (MAPIStoreObject *) newContainer
|
|
|
|
{
|
|
|
|
if ((self = [self init]))
|
|
|
|
{
|
|
|
|
ASSIGN (sogoObject, newSOGoObject);
|
|
|
|
ASSIGN (container, newContainer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
2011-07-13 23:41:58 +02:00
|
|
|
[self logWithFormat: @"-dealloc"];
|
2011-06-07 02:17:46 +02:00
|
|
|
[sogoObject release];
|
2011-10-26 17:15:17 +02:00
|
|
|
[properties release];
|
2011-02-24 21:27:55 +01:00
|
|
|
[parentContainersBag release];
|
|
|
|
[container release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2011-03-07 20:15:16 +01:00
|
|
|
- (void) setIsNew: (BOOL) newIsNew
|
|
|
|
{
|
|
|
|
isNew = newIsNew;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isNew
|
|
|
|
{
|
|
|
|
return isNew;
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
- (id) sogoObject
|
|
|
|
{
|
|
|
|
return sogoObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (MAPIStoreObject *) container
|
|
|
|
{
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) nameInContainer
|
|
|
|
{
|
|
|
|
return [sogoObject nameInContainer];
|
|
|
|
}
|
|
|
|
|
2012-01-29 20:55:21 +01:00
|
|
|
- (MAPIStoreContext *) context
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
|
|
|
return [container context];
|
|
|
|
}
|
|
|
|
|
2012-01-29 20:55:21 +01:00
|
|
|
- (MAPIStoreUserContext *) userContext
|
|
|
|
{
|
|
|
|
return [[self context] userContext];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (MAPIStoreMapping *) mapping
|
|
|
|
{
|
|
|
|
return [[self userContext] mapping];
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
- (void) cleanupCaches
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* helpers */
|
|
|
|
- (uint64_t) objectId
|
|
|
|
{
|
|
|
|
uint64_t objectId;
|
|
|
|
|
|
|
|
if ([container isKindOfClass: MAPIStoreFolderK])
|
|
|
|
objectId = [(MAPIStoreFolder *) container
|
|
|
|
idForObjectWithKey: [sogoObject nameInContainer]];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self errorWithFormat: @"%s: container is not a folder", __PRETTY_FUNCTION__];
|
|
|
|
objectId = (uint64_t) -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return objectId;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) url
|
|
|
|
{
|
|
|
|
NSString *containerURL, *format;
|
|
|
|
|
|
|
|
containerURL = [container url];
|
|
|
|
if ([containerURL hasSuffix: @"/"])
|
|
|
|
format = @"%@%@";
|
|
|
|
else
|
|
|
|
format = @"%@/%@";
|
|
|
|
|
|
|
|
return [NSString stringWithFormat: format,
|
2011-03-31 23:58:23 +02:00
|
|
|
containerURL, [self nameInContainer]];
|
2011-02-24 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
2011-07-19 23:49:37 +02:00
|
|
|
- (NSTimeZone *) ownerTimeZone
|
|
|
|
{
|
|
|
|
NSString *owner;
|
|
|
|
SOGoUserDefaults *ud;
|
|
|
|
NSTimeZone *tz;
|
|
|
|
WOContext *woContext;
|
|
|
|
|
2012-01-29 20:55:21 +01:00
|
|
|
woContext = [[self userContext] woContext];
|
2011-07-19 23:49:37 +02:00
|
|
|
owner = [sogoObject ownerInContext: woContext];
|
|
|
|
ud = [[SOGoUser userWithLogin: owner] userDefaults];
|
|
|
|
tz = [ud timeZone];
|
|
|
|
|
|
|
|
return tz;
|
|
|
|
}
|
|
|
|
|
2011-10-26 17:15:17 +02:00
|
|
|
- (void) addProperties: (NSDictionary *) newNewProperties
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
2011-10-26 17:15:17 +02:00
|
|
|
[properties addEntriesFromDictionary: newNewProperties];
|
2011-02-24 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
2011-10-26 17:15:17 +02:00
|
|
|
- (NSDictionary *) properties
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
2011-10-26 17:15:17 +02:00
|
|
|
return properties;
|
2011-02-24 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getProperty: (void **) data
|
|
|
|
withTag: (enum MAPITAGS) propTag
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
2011-04-13 21:59:04 +02:00
|
|
|
MAPIStorePropertyGetter method = NULL;
|
|
|
|
uint16_t propValue;
|
2011-04-20 00:24:03 +02:00
|
|
|
SEL methodSel;
|
2011-10-27 17:59:50 +02:00
|
|
|
id value;
|
2011-04-13 21:59:04 +02:00
|
|
|
int rc = MAPISTORE_ERR_NOT_FOUND;
|
2011-04-20 00:24:03 +02:00
|
|
|
|
2011-10-27 17:59:50 +02:00
|
|
|
value = [properties objectForKey: MAPIPropertyKey (propTag)];
|
|
|
|
if (value)
|
2011-11-22 18:48:46 +01:00
|
|
|
rc = [value getValue: data forTag: propTag inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
else
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
2011-10-27 17:59:50 +02:00
|
|
|
propValue = (propTag & 0xffff0000) >> 16;
|
|
|
|
methodSel = MAPIStoreSelectorForPropertyGetter (propValue);
|
|
|
|
method = (MAPIStorePropertyGetter) classGetters[propValue];
|
|
|
|
if (method)
|
|
|
|
rc = method (self, methodSel, data, memCtx);
|
2011-02-24 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2011-04-13 21:59:04 +02:00
|
|
|
/* helper getters */
|
2011-09-20 21:38:51 +02:00
|
|
|
- (NSData *) getReplicaKeyFromGlobCnt: (uint64_t) objectCnt
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
|
|
|
struct mapistore_connection_info *connInfo;
|
|
|
|
NSMutableData *replicaKey;
|
|
|
|
char buffer[6];
|
|
|
|
NSUInteger count;
|
|
|
|
|
|
|
|
connInfo = [[self context] connectionInfo];
|
|
|
|
|
|
|
|
for (count = 0; count < 6; count++)
|
|
|
|
{
|
|
|
|
buffer[count] = objectCnt & 0xff;
|
|
|
|
objectCnt >>= 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
replicaKey = [NSMutableData dataWithCapacity: 22];
|
|
|
|
[replicaKey appendBytes: &connInfo->replica_guid
|
|
|
|
length: sizeof (struct GUID)];
|
2011-09-20 21:38:51 +02:00
|
|
|
[replicaKey appendBytes: buffer length: 6];
|
|
|
|
|
|
|
|
return replicaKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getReplicaKey: (void **) data
|
|
|
|
fromGlobCnt: (uint64_t) objectCnt
|
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
|
|
|
{
|
|
|
|
*data = [[self getReplicaKeyFromGlobCnt: objectCnt] asBinaryInMemCtx: memCtx];
|
2011-06-07 02:17:46 +02:00
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-04-13 21:59:04 +02:00
|
|
|
/* getters */
|
2011-06-07 02:17:46 +02:00
|
|
|
- (int) getPrDisplayName: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
*data = [[sogoObject displayName] asUnicodeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrSearchKey: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-13 21:59:04 +02:00
|
|
|
{
|
|
|
|
NSString *stringValue;
|
|
|
|
|
|
|
|
stringValue = [sogoObject nameInContainer];
|
|
|
|
*data = [[stringValue dataUsingEncoding: NSASCIIStringEncoding]
|
|
|
|
asBinaryInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrGenerateExchangeViews: (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 getNo: data inMemCtx: memCtx];
|
2011-04-13 21:59:04 +02:00
|
|
|
}
|
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
- (int) getPrParentSourceKey: (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 getReplicaKey: data fromGlobCnt: [container objectId] >> 16
|
|
|
|
inMemCtx: memCtx];
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrSourceKey: (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 getReplicaKey: data fromGlobCnt: [self objectId] >> 16
|
|
|
|
inMemCtx: memCtx];
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (uint64_t) objectVersion
|
|
|
|
{
|
2011-08-11 18:36:30 +02:00
|
|
|
[self subclassResponsibility: _cmd];
|
2011-06-07 02:17:46 +02:00
|
|
|
|
2011-10-07 20:30:15 +02:00
|
|
|
return ULLONG_MAX;
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrChangeKey: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
2011-07-29 22:58:04 +02:00
|
|
|
int rc;
|
|
|
|
uint64_t obVersion;
|
|
|
|
|
|
|
|
obVersion = [self objectVersion];
|
2011-10-07 20:30:15 +02:00
|
|
|
if (obVersion == ULLONG_MAX)
|
2011-07-29 22:58:04 +02:00
|
|
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
else
|
|
|
|
rc = [self getReplicaKey: data fromGlobCnt: obVersion
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: memCtx];
|
2011-07-29 22:58:04 +02:00
|
|
|
|
|
|
|
return rc;
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrChangeNum: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
2011-07-29 22:58:04 +02:00
|
|
|
int rc;
|
|
|
|
uint64_t obVersion;
|
2011-06-07 02:17:46 +02:00
|
|
|
|
2011-07-29 22:58:04 +02:00
|
|
|
obVersion = [self objectVersion];
|
2011-10-07 20:30:15 +02:00
|
|
|
if (obVersion == ULLONG_MAX)
|
2011-07-29 22:58:04 +02:00
|
|
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*data = MAPILongLongValue (memCtx, ((obVersion << 16)
|
|
|
|
| 0x0001));
|
|
|
|
rc = MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrCreationTime: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
|
|
|
*data = [[self creationTime] asFileTimeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getPrLastModificationTime: (void **) data
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
|
|
|
*data = [[self lastModificationTime] asFileTimeInMemCtx: memCtx];
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-06-07 01:59:31 +02:00
|
|
|
- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-04-19 23:57:52 +02:00
|
|
|
{
|
2011-10-27 17:59:50 +02:00
|
|
|
NSUInteger count;
|
|
|
|
struct SPropTagArray *availableProps;
|
|
|
|
enum MAPITAGS propTag;
|
|
|
|
|
|
|
|
availableProps = talloc_zero (memCtx, struct SPropTagArray);
|
|
|
|
availableProps->aulPropTag = talloc_array (availableProps, enum MAPITAGS,
|
|
|
|
MAPIStoreSupportedPropertiesCount);
|
|
|
|
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
|
|
|
|
{
|
|
|
|
propTag = MAPIStoreSupportedProperties[count];
|
|
|
|
if ([self canGetProperty: propTag])
|
|
|
|
{
|
|
|
|
availableProps->aulPropTag[availableProps->cValues] = propTag;
|
|
|
|
availableProps->cValues++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*propertiesP = availableProps;
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) canGetProperty: (enum MAPITAGS) propTag
|
|
|
|
{
|
|
|
|
uint16_t propValue;
|
|
|
|
|
|
|
|
propValue = (propTag & 0xffff0000) >> 16;
|
|
|
|
|
|
|
|
return (classGetters[propValue]
|
|
|
|
|| [properties objectForKey: MAPIPropertyKey (propTag)]);
|
2011-04-19 23:57:52 +02:00
|
|
|
}
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
- (int) getProperties: (struct mapistore_property_data *) data
|
|
|
|
withTags: (enum MAPITAGS *) tags
|
|
|
|
andCount: (uint16_t) columnCount
|
2011-07-11 23:40:47 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
|
|
|
uint16_t count;
|
|
|
|
|
|
|
|
for (count = 0; count < columnCount; count++)
|
|
|
|
data[count].error = [self getProperty: &data[count].data
|
2011-07-11 23:40:47 +02:00
|
|
|
withTag: tags[count]
|
|
|
|
inMemCtx: memCtx];
|
2011-02-24 21:27:55 +01:00
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-10-26 17:15:17 +02:00
|
|
|
- (int) addPropertiesFromRow: (struct SRow *) aRow
|
2011-02-24 21:27:55 +01:00
|
|
|
{
|
|
|
|
struct SPropValue *cValue;
|
|
|
|
NSUInteger counter;
|
2011-11-07 16:07:37 +01:00
|
|
|
NSMutableDictionary *newProperties;
|
2011-02-24 21:27:55 +01:00
|
|
|
|
2011-11-07 16:07:37 +01:00
|
|
|
newProperties = [NSMutableDictionary dictionaryWithCapacity: aRow->cValues];
|
2011-02-24 21:27:55 +01:00
|
|
|
for (counter = 0; counter < aRow->cValues; counter++)
|
|
|
|
{
|
|
|
|
cValue = aRow->lpProps + counter;
|
2011-12-08 21:42:44 +01:00
|
|
|
if ((cValue->ulPropTag & 0xfff) == PT_STRING8)
|
2011-12-07 17:14:03 +01:00
|
|
|
[self warnWithFormat:
|
|
|
|
@"attempting to set string property as PR_STRING8: %.8x",
|
|
|
|
cValue->ulPropTag];
|
2011-11-07 16:07:37 +01:00
|
|
|
[newProperties setObject: NSObjectFromSPropValue (cValue)
|
|
|
|
forKey: MAPIPropertyKey (cValue->ulPropTag)];
|
2011-02-24 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
2011-11-07 16:07:37 +01:00
|
|
|
[self addProperties: newProperties];
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* subclasses */
|
2011-06-07 02:17:46 +02:00
|
|
|
- (NSDate *) creationTime
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSDate *) lastModificationTime
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2011-07-28 02:47:02 +02:00
|
|
|
/* logging */
|
|
|
|
- (NSString *) loggingPrefix
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat:@"<%@:%p:%@>",
|
2011-10-27 17:59:50 +02:00
|
|
|
NSStringFromClass (isa), self, [self nameInContainer]];
|
2011-07-28 02:47:02 +02:00
|
|
|
}
|
|
|
|
|
2011-02-24 21:27:55 +01:00
|
|
|
@end
|