From a74ce11a7f29c34d6ac40d2c7078071d8abf3d19 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 10 Feb 2011 17:46:47 +0000 Subject: [PATCH] Monotone-Parent: 9c93be42dce13d70eb5f0bc31e7ff8fff3aa82c3 Monotone-Revision: 23f1f1841b0ca1de79b952a793ed0513208ab6a9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-02-10T17:46:47 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ OpenChange/NSArray+MAPIStore.h | 1 + OpenChange/NSArray+MAPIStore.m | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 54264be16..ad27e0360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-02-10 Wolfgang Sourdeau + + * OpenChange/NSArray+MAPIStore.m (-asArrayOfUnicodeStringsInCtx:): + new method for returning array of "PT_UNICODE" values. + 2011-02-09 Wolfgang Sourdeau * OpenChange/MAPIStoreMessageTable.m diff --git a/OpenChange/NSArray+MAPIStore.h b/OpenChange/NSArray+MAPIStore.h index f1997f84a..e619b6a81 100644 --- a/OpenChange/NSArray+MAPIStore.h +++ b/OpenChange/NSArray+MAPIStore.h @@ -28,6 +28,7 @@ @interface NSArray (MAPIStoreFolders) - (struct indexing_folders_list *) asFoldersListInCtx: (void *) memCtx; +- (struct mapi_SPLSTRArrayW *) asArrayOfUnicodeStringsInCtx: (void *) memCtx; @end diff --git a/OpenChange/NSArray+MAPIStore.m b/OpenChange/NSArray+MAPIStore.m index 200d40782..7ee9264e8 100644 --- a/OpenChange/NSArray+MAPIStore.m +++ b/OpenChange/NSArray+MAPIStore.m @@ -22,6 +22,8 @@ #import +#import "NSString+MAPIStore.h" + #import "NSArray+MAPIStore.h" #undef DEBUG @@ -47,4 +49,21 @@ return flist; } +- (struct mapi_SPLSTRArrayW *) asArrayOfUnicodeStringsInCtx: (void *) memCtx +{ + struct mapi_SPLSTRArrayW *list; + NSInteger count, max; + + max = [self count]; + + list = talloc_zero(memCtx, struct mapi_SPLSTRArrayW); + list->cValues = max; + list->strings = talloc_array(memCtx, struct mapi_LPWSTR, max); + + for (count = 0; count < max; count++) + (list->strings + count)->lppszW = [[self objectAtIndex: count] asUnicodeInMemCtx: memCtx]; + + return list; +} + @end