mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-14 16:05:28 +00:00
Monotone-Parent: 4f36a1c10a12396aed17d84ab4be1adc520d1663
Monotone-Revision: dbda0a122c502c53d25654eada72e93bc8865a35 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-22T17:48:46 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user