Monotone-Parent: a92e511f060bf8edffe8e0c8bfe66d20ee35d18e

Monotone-Revision: f097a1cc5cb254dca09ba971f32de7339f109a97

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-12-30T14:47:27
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-12-30 14:47:27 +00:00
parent 415a01b20b
commit 4e60090b52
3 changed files with 60 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2010-12-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/NSData+MAPIStore.m (+dataWithFlatUID)
(-asFlatUIDInMemCtx:, +dataWithGUID:, asGUIDInMemCtx:): new
methods for handling the two GUID mapistore types.
* OpenChange/MAPIStoreContext.m
(-createMessageOfClass:inFolderAtURL:): renamed from
"-createMessageInFolder:", taking an additional message class

View File

@ -33,6 +33,12 @@
+ (id) dataWithShortBinary: (const struct SBinary_short *) binData;
- (struct SBinary_short *) asShortBinaryInMemCtx: (void *) memCtx;
+ (id) dataWithFlatUID: (const struct FlatUID_r *) flatUID;
- (struct FlatUID_r *) asFlatUIDInMemCtx: (void *) memCtx;
+ (id) dataWithGUID: (const struct GUID *) guid;
- (struct GUID *) asGUIDInMemCtx: (void *) memCtx;
@end
#endif /* NSDATA_MAPISTORE_H */

View File

@ -67,4 +67,54 @@
return binary;
}
+ (id) dataWithFlatUID: (const struct FlatUID_r *) flatUID
{
return [NSData dataWithBytes: flatUID->ab length: 16];
}
- (struct FlatUID_r *) asFlatUIDInMemCtx: (void *) memCtx
{
struct FlatUID_r *flatUID;
flatUID = talloc_zero (memCtx, struct FlatUID_r);
[self getBytes: flatUID->ab];
return flatUID;
}
+ (id) dataWithGUID: (const struct GUID *) guid
{
struct FlatUID_r flatUID;
flatUID.ab[0] = (guid->time_low & 0xFF);
flatUID.ab[1] = ((guid->time_low >> 8) & 0xFF);
flatUID.ab[2] = ((guid->time_low >> 16) & 0xFF);
flatUID.ab[3] = ((guid->time_low >> 24) & 0xFF);
flatUID.ab[4] = (guid->time_mid & 0xFF);
flatUID.ab[5] = ((guid->time_mid >> 8) & 0xFF);
flatUID.ab[6] = (guid->time_hi_and_version & 0xFF);
flatUID.ab[7] = ((guid->time_hi_and_version >> 8) & 0xFF);
memcpy (flatUID.ab + 8, guid->clock_seq, sizeof (uint8_t) * 2);
memcpy (flatUID.ab + 10, guid->node, sizeof (uint8_t) * 6);
return [self dataWithFlatUID: &flatUID];
}
- (struct GUID *) asGUIDInMemCtx: (void *) memCtx
{
struct GUID *guid;
uint8_t bytes[16];
[self getBytes: bytes];
guid = talloc_zero (memCtx, struct GUID);
guid->time_low = (bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]);
guid->time_mid = (bytes[5] << 8 | bytes[4]);
guid->time_hi_and_version = (bytes[7] << 8 | bytes[6]);
memcpy (guid->clock_seq, bytes + 8, sizeof (uint8_t) * 2);
memcpy (guid->node, bytes + 10, sizeof (uint8_t) * 6);
return guid;
}
@end