merge of '1c6331f7285001088f0ae617c98daa1544595cc1'
and 'dbda0a122c502c53d25654eada72e93bc8865a35' Monotone-Parent: 1c6331f7285001088f0ae617c98daa1544595cc1 Monotone-Parent: dbda0a122c502c53d25654eada72e93bc8865a35 Monotone-Revision: 8da45ab6716906aaf63acf12643978541601c34c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-22T17:49:25 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
e9425a9281
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2011-11-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/NSObject+MAPIStore.m (-getValue:forTag:inMemCtx:):
|
||||
renamed from "getMAPIValue:...".
|
||||
(-asArrayOfUnicodeStringsInMemCtx:) renamed from "asArrayOfUnicodeStringsInCtx".
|
||||
(-arrayFromMAPIMVLong:, +arrayFromMAPIMVUnicode:)
|
||||
(+arrayFromMAPIMVString:, +arrayFromMAPIMVBinary:)
|
||||
(+arrayFromMAPIMVGuid:, +arrayFromMVShort:, +arrayFromMVLong:)
|
||||
(+arrayFromMVI8:, +arrayFromMVUnicode:, +arrayFromMVString:)
|
||||
(+arrayFromMVBinary:, +arrayFromMVGuid:, +arrayFromMVFileTime:)
|
||||
new constructors for multivalue types.
|
||||
|
||||
2011-11-21 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/WORequest+SOGo.m - for now, we consider iCal 4
|
||||
|
|
|
@ -245,7 +245,7 @@
|
|||
if (!stringValue)
|
||||
stringValue = @"";
|
||||
*data = [[NSArray arrayWithObject: stringValue]
|
||||
asArrayOfUnicodeStringsInCtx: memCtx];
|
||||
asArrayOfUnicodeStringsInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1201,7 +1201,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
|||
value = [[propsMessage properties]
|
||||
objectForKey: MAPIPropertyKey (propTag)];
|
||||
if (value)
|
||||
rc = [value getMAPIValue: data forTag: propTag inMemCtx: memCtx];
|
||||
rc = [value getValue: data forTag: propTag inMemCtx: memCtx];
|
||||
else
|
||||
rc = [super getProperty: data withTag: propTag inMemCtx: memCtx];
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
|||
|
||||
value = [properties objectForKey: MAPIPropertyKey (propTag)];
|
||||
if (value)
|
||||
rc = [value getMAPIValue: data forTag: propTag inMemCtx: memCtx];
|
||||
rc = [value getValue: data forTag: propTag inMemCtx: memCtx];
|
||||
else
|
||||
{
|
||||
propValue = (propTag & 0xffff0000) >> 16;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#import <Foundation/NSNull.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "NSArray+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
|
||||
|
@ -123,6 +124,22 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value)
|
|||
result = [NSData dataWithGUID: &value->value.lpguid];
|
||||
break;
|
||||
|
||||
case PT_MV_LONG:
|
||||
result = [NSArray arrayFromMAPIMVLong: &value->value.MVl];
|
||||
break;
|
||||
case PT_MV_STRING8:
|
||||
result = [NSArray arrayFromMAPIMVString: &value->value.MVszA];
|
||||
break;
|
||||
case PT_MV_UNICODE:
|
||||
result = [NSArray arrayFromMAPIMVUnicode: &value->value.MVszW];
|
||||
break;
|
||||
case PT_MV_CLSID:
|
||||
result = [NSArray arrayFromMAPIMVGuid: &value->value.MVguid];
|
||||
break;
|
||||
case PT_MV_BINARY:
|
||||
result = [NSArray arrayFromMAPIMVBinary: &value->value.MVbin];
|
||||
break;
|
||||
|
||||
default:
|
||||
// #define PT_UNSPECIFIED 0x0
|
||||
// #define PT_I2 0x2
|
||||
|
@ -135,8 +152,9 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value)
|
|||
// #define PT_SRESTRICT 0xFD
|
||||
// #define PT_ACTIONS 0xFE
|
||||
result = [NSNull null];
|
||||
abort();
|
||||
NSLog (@"%s: object type not handled: %d (0x%.4x)",
|
||||
__PRETTY_FUNCTION__, valueType, valueType);
|
||||
__PRETTY_FUNCTION__, valueType, valueType);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -189,6 +207,30 @@ NSObjectFromSPropValue (const struct SPropValue *value)
|
|||
case PT_CLSID:
|
||||
result = [NSData dataWithFlatUID: value->value.lpguid];
|
||||
break;
|
||||
case PT_MV_SHORT:
|
||||
result = [NSArray arrayFromMVShort: &value->value.MVi];
|
||||
break;
|
||||
case PT_MV_LONG:
|
||||
result = [NSArray arrayFromMVLong: &value->value.MVl];
|
||||
break;
|
||||
case PT_MV_I8:
|
||||
result = [NSArray arrayFromMVI8: &value->value.MVi8];
|
||||
break;
|
||||
case PT_MV_STRING8:
|
||||
result = [NSArray arrayFromMVString: &value->value.MVszA];
|
||||
break;
|
||||
case PT_MV_UNICODE:
|
||||
result = [NSArray arrayFromMVUnicode: &value->value.MVszW];
|
||||
break;
|
||||
case PT_MV_CLSID:
|
||||
result = [NSArray arrayFromMVGuid: &value->value.MVguid];
|
||||
break;
|
||||
case PT_MV_BINARY:
|
||||
result = [NSArray arrayFromMVBinary: &value->value.MVbin];
|
||||
break;
|
||||
case PT_MV_SYSTIME:
|
||||
result = [NSArray arrayFromMVFileTime: &value->value.MVft];
|
||||
break;
|
||||
|
||||
default:
|
||||
// #define PT_UNSPECIFIED 0x0
|
||||
|
@ -202,8 +244,9 @@ NSObjectFromSPropValue (const struct SPropValue *value)
|
|||
// #define PT_SRESTRICT 0xFD
|
||||
// #define PT_ACTIONS 0xFE
|
||||
result = [NSNull null];
|
||||
abort();
|
||||
NSLog (@"%s: object type not handled: %d (0x%.4x)",
|
||||
__PRETTY_FUNCTION__, valueType, valueType);
|
||||
__PRETTY_FUNCTION__, valueType, valueType);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -265,6 +308,7 @@ NSObjectFromValuePointer (enum MAPITAGS propTag, void *data)
|
|||
// #define PT_SRESTRICT 0xFD
|
||||
// #define PT_ACTIONS 0xFE
|
||||
result = [NSNull null];
|
||||
abort();
|
||||
NSLog (@"%s: object type not handled: %d (0x%.8x)", __PRETTY_FUNCTION__,
|
||||
propTag, propTag);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ Class NSNumberK;
|
|||
|
||||
value = [[sogoObject properties] objectForKey: MAPIPropertyKey (propTag)];
|
||||
if (value)
|
||||
rc = [value getMAPIValue: data forTag: propTag inMemCtx: memCtx];
|
||||
rc = [value getValue: data forTag: propTag inMemCtx: memCtx];
|
||||
else
|
||||
rc = [super getProperty: data withTag: propTag inMemCtx: memCtx];
|
||||
|
||||
|
|
|
@ -27,8 +27,22 @@
|
|||
|
||||
@interface NSArray (MAPIStoreFolders)
|
||||
|
||||
- (struct WStringArray_r *) asArrayOfUnicodeStringsInCtx: (void *) memCtx;
|
||||
// - (struct mapi_SPLSTRArrayW *) asArrayOfUnicodeStringsInCtx: (void *) memCtx;
|
||||
/* mapi structs */
|
||||
+ (id) arrayFromMAPIMVLong: (const struct mapi_MV_LONG_STRUCT *) mvLong;
|
||||
+ (id) arrayFromMAPIMVUnicode: (const struct mapi_SPLSTRArrayW *) mvUnicode;
|
||||
+ (id) arrayFromMAPIMVString: (const struct mapi_SLPSTRArray *) mvString;
|
||||
+ (id) arrayFromMAPIMVBinary: (const struct mapi_SBinaryArray *) mvBinary;
|
||||
+ (id) arrayFromMAPIMVGuid: (const struct mapi_SGuidArray *) mvGuid;
|
||||
|
||||
+ (id) arrayFromMVShort: (const struct ShortArray_r *) mvShort;
|
||||
+ (id) arrayFromMVLong: (const struct LongArray_r *) mvLong;
|
||||
+ (id) arrayFromMVI8: (const struct I8Array_r *) mvI8;
|
||||
+ (id) arrayFromMVString: (const struct StringArray_r *) mvString;
|
||||
+ (id) arrayFromMVUnicode: (const struct WStringArray_r *) mvUnicode;
|
||||
- (struct WStringArray_r *) asArrayOfUnicodeStringsInMemCtx: (void *) memCtx;
|
||||
+ (id) arrayFromMVBinary: (const struct BinaryArray_r *) mvBinary;
|
||||
+ (id) arrayFromMVGuid: (const struct FlatUIDArray_r *) mvGuid;
|
||||
+ (id) arrayFromMVFileTime: (const struct DateTimeArray_r *) mvGuid;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "NSArray+MAPIStore.h"
|
||||
|
@ -29,11 +31,157 @@
|
|||
#undef DEBUG
|
||||
#include <talloc.h>
|
||||
#include <util/time.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation NSArray (MAPIStoreFolders)
|
||||
|
||||
- (struct WStringArray_r *) asArrayOfUnicodeStringsInCtx: (void *) memCtx
|
||||
+ (id) arrayFromMAPIMVLong: (struct mapi_MV_LONG_STRUCT *) mvLong
|
||||
{
|
||||
NSUInteger count;
|
||||
NSNumber *subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvLong->cValues];
|
||||
for (count = 0; count < mvLong->cValues; count++)
|
||||
{
|
||||
subObject = [NSNumber numberWithLong: mvLong->lpl[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMAPIMVUnicode: (struct mapi_SPLSTRArrayW *) mvUnicode
|
||||
{
|
||||
NSUInteger count;
|
||||
NSString *subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvUnicode->cValues];
|
||||
for (count = 0; count < mvUnicode->cValues; count++)
|
||||
{
|
||||
subObject
|
||||
= [NSString stringWithUTF8String: mvUnicode->strings[count].lppszW];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMAPIMVString: (struct mapi_SLPSTRArray *) mvString
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvString->cValues];
|
||||
for (count = 0; count < mvString->cValues; count++)
|
||||
{
|
||||
subObject = [NSString stringWithUTF8String: mvString->strings[count].lppszA];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMAPIMVBinary: (struct mapi_SBinaryArray *) mvBinary
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvBinary->cValues];
|
||||
for (count = 0; count < mvBinary->cValues; count++)
|
||||
{
|
||||
subObject = [NSData dataWithShortBinary: mvBinary->bin + count];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMAPIMVGuid: (struct mapi_SGuidArray *) mvGuid
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvGuid->cValues];
|
||||
for (count = 0; count < mvGuid->cValues; count++)
|
||||
{
|
||||
subObject = [NSData dataWithGUID: mvGuid->lpguid + count];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVShort: (const struct ShortArray_r *) mvShort
|
||||
{
|
||||
NSUInteger count;
|
||||
NSNumber *subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvShort->cValues];
|
||||
for (count = 0; count < mvShort->cValues; count++)
|
||||
{
|
||||
subObject = [NSNumber numberWithShort: mvShort->lpi[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVLong: (const struct LongArray_r *) mvLong
|
||||
{
|
||||
NSUInteger count;
|
||||
NSNumber *subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvLong->cValues];
|
||||
for (count = 0; count < mvLong->cValues; count++)
|
||||
{
|
||||
subObject = [NSNumber numberWithLong: mvLong->lpl[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVI8: (const struct I8Array_r *) mvI8
|
||||
{
|
||||
NSUInteger count;
|
||||
NSNumber *subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvI8->cValues];
|
||||
for (count = 0; count < mvI8->cValues; count++)
|
||||
{
|
||||
subObject = [NSNumber numberWithLongLong: mvI8->lpi8[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVUnicode: (const struct WStringArray_r *) mvUnicode
|
||||
{
|
||||
NSUInteger count;
|
||||
NSString *subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvUnicode->cValues];
|
||||
for (count = 0; count < mvUnicode->cValues; count++)
|
||||
{
|
||||
subObject = [NSString stringWithUTF8String: mvUnicode->lppszW[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
- (struct WStringArray_r *) asArrayOfUnicodeStringsInMemCtx: (void *) memCtx
|
||||
{
|
||||
struct WStringArray_r *list;
|
||||
NSInteger count, max;
|
||||
|
@ -50,4 +198,68 @@
|
|||
return list;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVString: (const struct StringArray_r *) mvString
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvString->cValues];
|
||||
for (count = 0; count < mvString->cValues; count++)
|
||||
{
|
||||
subObject = [NSString stringWithUTF8String: mvString->lppszA[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVBinary: (const struct BinaryArray_r *) mvBinary
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvBinary->cValues];
|
||||
for (count = 0; count < mvBinary->cValues; count++)
|
||||
{
|
||||
subObject = [NSData dataWithBinary: mvBinary->lpbin + count];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVGuid: (const struct FlatUIDArray_r *) mvGuid
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvGuid->cValues];
|
||||
for (count = 0; count < mvGuid->cValues; count++)
|
||||
{
|
||||
subObject = [NSData dataWithFlatUID: mvGuid->lpguid[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
+ (id) arrayFromMVFileTime: (const struct DateTimeArray_r *) mvFileTime
|
||||
{
|
||||
NSUInteger count;
|
||||
id subObject;
|
||||
NSMutableArray *mvResult;
|
||||
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvFileTime->cValues];
|
||||
for (count = 0; count < mvFileTime->cValues; count++)
|
||||
{
|
||||
subObject = [NSDate dateFromFileTime: mvFileTime->lpft + count];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
return mvResult;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,9 +40,9 @@ struct MAPIStoreTallocWrapper
|
|||
|
||||
@interface NSObject (MAPIStoreDataTypes)
|
||||
|
||||
- (int) getMAPIValue: (void **) data
|
||||
forTag: (enum MAPITAGS) propTag
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getValue: (void **) data
|
||||
forTag: (enum MAPITAGS) propTag
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
/* getter helpers */
|
||||
- (int) getEmptyString: (void **) data inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSArray+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSValue+MAPIStore.h"
|
||||
|
@ -68,9 +69,9 @@ static int MAPIStoreTallocWrapperDestroy (void *data)
|
|||
|
||||
@implementation NSObject (MAPIStoreDataTypes)
|
||||
|
||||
- (int) getMAPIValue: (void **) data
|
||||
forTag: (enum MAPITAGS) propTag
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
- (int) getValue: (void **) data
|
||||
forTag: (enum MAPITAGS) propTag
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
uint16_t valueType;
|
||||
int rc = MAPISTORE_SUCCESS;
|
||||
|
@ -111,9 +112,14 @@ static int MAPIStoreTallocWrapperDestroy (void *data)
|
|||
*data = [(NSData *) self asGUIDInMemCtx: memCtx];
|
||||
break;
|
||||
|
||||
case PT_MV_UNICODE:
|
||||
*data = [(NSArray *) self asArrayOfUnicodeStringsInMemCtx: memCtx];
|
||||
break;
|
||||
|
||||
default:
|
||||
[self errorWithFormat: @"object type not handled: %d (0x%.4x)",
|
||||
valueType, valueType];
|
||||
abort();
|
||||
*data = NULL;
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue