Monotone-Parent: d6c5da440431c45a715dfdd531f61cc02798d9cd

Monotone-Revision: 37431a093d394dea94622106c07943eca6cb743f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-11-26T21:46:57
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-11-26 21:46:57 +00:00
parent 06d6337152
commit b82eeddedb
3 changed files with 37 additions and 1 deletions

View File

@ -1,4 +1,10 @@
2010-11-24 Wolfgang Sourdeau <root@inverse.ca>
2010-11-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreTypes.m (NSObjectFromStreamData): new
function for returning an NSObject from a property tag and a data
pointer.
2010-11-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/SOGoDraftObject+MAPIStore.m: new category module.
(-setMAPIProperties,-MAPISubmit,-MAPISave): implemented the MAPI

View File

@ -28,6 +28,7 @@
#include <stdbool.h>
#include <gen_ndr/exchange.h>
@class NSData;
@class NSDictionary;
uint8_t *MAPIBoolValue (void *memCtx, BOOL value);
@ -35,6 +36,7 @@ uint32_t *MAPILongValue (void *memCtx, uint32_t value);
uint64_t *MAPILongLongValue (void *memCtx, uint64_t value);
id NSObjectFromSPropValue (const struct SPropValue *);
id NSObjectFromStreamData (enum MAPITAGS property, NSData *streamData);
#if (GS_SIZEOF_LONG == 4)
static inline NSNumber *

View File

@ -29,6 +29,7 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSString.h>
@ -129,6 +130,33 @@ NSObjectFromSPropValue (const struct SPropValue *value)
return result;
}
id NSObjectFromStreamData (enum MAPITAGS property, NSData* streamData)
{
short int valueType;
id result;
valueType = (property & 0xffff);
switch (valueType)
{
case PT_UNICODE:
case PT_STRING8:
result = [NSString stringWithUTF8String: [streamData bytes]];
break;
case PT_BINARY:
result = streamData;
break;
case PT_OBJECT:
result = [NSNull null];
NSLog (@"object type not handled: %d (0x.4x)", valueType, valueType);
break;
default:
[NSException raise: @"MAPIStoreStreamTypeException"
format: @"invalid data type"];
}
return result;
}
void
MAPIStoreDumpMessageProperties (NSDictionary *properties)
{