From a18e6f3dbfae8508c962be4605feda313fe6715a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 30 Dec 2010 14:49:54 +0000 Subject: [PATCH] Monotone-Parent: f097a1cc5cb254dca09ba971f32de7339f109a97 Monotone-Revision: e356443889853160f98a31849aede88bc4bac6bd Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-12-30T14:49:54 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++++++ OpenChange/MAPIStoreTypes.h | 1 + OpenChange/MAPIStoreTypes.m | 33 ++++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8598248d6..f30f2de30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-12-30 Wolfgang Sourdeau + * OpenChange/MAPIStoreTypes.m (MAPIDoubleValue): new wrapper + methods for generating data of "double" type. + (NSObjectFromMAPISPropValue, NSObjectFromSPropValue): now handle + the PT_CLSID mapi type. + ( + (MAPIStoreDumpMessageProperties): enhanced logging of property + keys. + * OpenChange/NSData+MAPIStore.m (+dataWithFlatUID) (-asFlatUIDInMemCtx:, +dataWithGUID:, asGUIDInMemCtx:): new methods for handling the two GUID mapistore types. diff --git a/OpenChange/MAPIStoreTypes.h b/OpenChange/MAPIStoreTypes.h index 206d8c3e4..fc2aa964a 100644 --- a/OpenChange/MAPIStoreTypes.h +++ b/OpenChange/MAPIStoreTypes.h @@ -34,6 +34,7 @@ uint8_t *MAPIBoolValue (void *memCtx, BOOL value); uint32_t *MAPILongValue (void *memCtx, uint32_t value); uint64_t *MAPILongLongValue (void *memCtx, uint64_t value); +double *MAPIDoubleValue (void *memCtx, double value); id NSObjectFromSPropValue (const struct SPropValue *); id NSObjectFromMAPISPropValue (const struct mapi_SPropValue *); diff --git a/OpenChange/MAPIStoreTypes.m b/OpenChange/MAPIStoreTypes.m index 919f241ff..fc8735bff 100644 --- a/OpenChange/MAPIStoreTypes.m +++ b/OpenChange/MAPIStoreTypes.m @@ -71,6 +71,17 @@ MAPILongLongValue (void *memCtx, uint64_t value) return llongValue; } +double * +MAPIDoubleValue (void *memCtx, double value) +{ + double *doubleValue; + + doubleValue = talloc_zero (memCtx, double); + *doubleValue = value; + + return doubleValue; +} + id NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value) { @@ -105,10 +116,12 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value) result = [NSCalendarDate dateFromFileTime: &(value->value.ft)]; break; case PT_BINARY: - // lpProps->value.bin = *((const struct Binary_r *)data); - result = [NSData dataWithShortBinary: &value->value.bin]; break; + case PT_CLSID: + result = [NSData dataWithGUID: &value->value.lpguid]; + break; + default: // #define PT_UNSPECIFIED 0x0 // #define PT_I2 0x2 @@ -117,7 +130,6 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value) // #define PT_ERROR 0xa // #define PT_OBJECT 0xd // #define PT_I8 0x14 -// #define PT_CLSID 0x48 // #define PT_SVREID 0xFB // #define PT_SRESTRICT 0xFD // #define PT_ACTIONS 0xFE @@ -169,6 +181,10 @@ NSObjectFromSPropValue (const struct SPropValue *value) = [NSData dataWithBinary: (const struct Binary_r *) &(value->value.bin)]; break; + case PT_CLSID: + result = [NSData dataWithFlatUID: value->value.lpguid]; + break; + default: // #define PT_UNSPECIFIED 0x0 // #define PT_I2 0x2 @@ -177,7 +193,6 @@ NSObjectFromSPropValue (const struct SPropValue *value) // #define PT_ERROR 0xa // #define PT_OBJECT 0xd // #define PT_I8 0x14 -// #define PT_CLSID 0x48 // #define PT_SVREID 0xFB // #define PT_SRESTRICT 0xFD // #define PT_ACTIONS 0xFE @@ -224,7 +239,6 @@ MAPIStoreDumpMessageProperties (NSDictionary *properties) NSNumber *key; NSArray *allKeys; NSUInteger keyAsInt, count, max; - const char *name; id value; allKeys = [properties allKeys]; @@ -243,12 +257,9 @@ MAPIStoreDumpMessageProperties (NSDictionary *properties) { keyAsInt = [key intValue]; value = [properties objectForKey: key]; - name = get_proptag_name (keyAsInt); - if (!name) - name = "unknown"; - NSLog (@" 0x%.8x (%s): %@ (%@)", - keyAsInt, name, - value, NSStringFromClass ([value class])); + NSLog (@" 0x%.4x: %@ (%@)", + keyAsInt, value, + NSStringFromClass ([value class])); } } }