Monotone-Parent: efc513aec8f8216ade9f9e1724fbe47cad52f200
Monotone-Revision: 1e6a6ef91a600782e846f11a352429b61e59c2a9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-13T21:40:50 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
2c2d84c65e
commit
bc120fc377
21
ChangeLog
21
ChangeLog
|
@ -9,11 +9,6 @@
|
||||||
|
|
||||||
2010-10-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2010-10-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* OpenChange/MAPIStoreContext.m
|
|
||||||
(-getMessageTableChildproperty:atURL:withTag:inFolder:withFID:):
|
|
||||||
added missing "break" statement, leading PR_FID to get the value
|
|
||||||
of PR_MID.
|
|
||||||
|
|
||||||
* OpenChange/MAPIStoreMapping.m (-registerURL:): commented method out.
|
* OpenChange/MAPIStoreMapping.m (-registerURL:): commented method out.
|
||||||
(-_setupFixedMapping): new method that registers well-known ids
|
(-_setupFixedMapping): new method that registers well-known ids
|
||||||
with well-known urls.
|
with well-known urls.
|
||||||
|
@ -21,6 +16,22 @@
|
||||||
* OpenChange/MAPIStoreContext.m (+contextFromURI:): no longer
|
* OpenChange/MAPIStoreContext.m (+contextFromURI:): no longer
|
||||||
register the URI mapping since the basic ones are always
|
register the URI mapping since the basic ones are always
|
||||||
registered.
|
registered.
|
||||||
|
(-setURI:andMemCtx:): new method,
|
||||||
|
replacing setMemCtx, which also stores the context uri in the new
|
||||||
|
"uri" ivar.
|
||||||
|
(-getMessageTableChildproperty:atURL:withTag:inFolder:withFID:)
|
||||||
|
added assertions for context id searches. Make the context id
|
||||||
|
search without the "sogo://" prefix.
|
||||||
|
Added missing "break" statement, leading PR_FID to get the value
|
||||||
|
of PR_MID.
|
||||||
|
(-parentFID): simply returns fid...
|
||||||
|
(-getPath:ofFMID:withTableType:): implemented.
|
||||||
|
(-getFoldersList:withFMID:): new temporary store method,
|
||||||
|
implemented.
|
||||||
|
|
||||||
|
* OpenChange/NSArray+MAPIStore.m: new category module.
|
||||||
|
(-asFoldersListInCtx:): new method returning a properly populated
|
||||||
|
"struct struct indexing_folders_list *" from an array of fids.
|
||||||
|
|
||||||
2010-10-13 Francis Lachapelle <flachapelle@inverse.ca>
|
2010-10-13 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ $(MAPISTORESOGO)_OBJC_FILES += \
|
||||||
\
|
\
|
||||||
SOGoGCSFolder+MAPIStore.m \
|
SOGoGCSFolder+MAPIStore.m \
|
||||||
\
|
\
|
||||||
|
NSArray+MAPIStore.m \
|
||||||
NSCalendarDate+MAPIStore.m \
|
NSCalendarDate+MAPIStore.m \
|
||||||
NSString+MAPIStore.m
|
NSString+MAPIStore.m
|
||||||
|
|
||||||
|
|
|
@ -55,22 +55,26 @@ extern uint64_t *MAPILongLongValue (void *, uint64_t);
|
||||||
struct mapistore_context *memCtx;
|
struct mapistore_context *memCtx;
|
||||||
void *ldbCtx;
|
void *ldbCtx;
|
||||||
|
|
||||||
|
BOOL baseContextSet;
|
||||||
|
|
||||||
|
NSString *uri;
|
||||||
|
|
||||||
NSMutableDictionary *objectCache;
|
NSMutableDictionary *objectCache;
|
||||||
MAPIStoreAuthenticator *authenticator;
|
MAPIStoreAuthenticator *authenticator;
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
NSMutableDictionary *messageCache;
|
NSMutableDictionary *messageCache;
|
||||||
NSMutableDictionary *subfolderCache;
|
NSMutableDictionary *subfolderCache;
|
||||||
SOGoFolder *moduleFolder;
|
SOGoFolder *moduleFolder;
|
||||||
NSString *lastObjectURL;
|
|
||||||
id lastObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) contextFromURI: (const char *) newUri;
|
+ (id) contextFromURI: (const char *) newUri
|
||||||
|
inMemCtx: (struct mapistore_context *) newMemCtx;
|
||||||
|
|
||||||
|
- (void) setURI: (NSString *) newUri
|
||||||
|
andMemCtx: (struct mapistore_context *) newMemCtx;
|
||||||
|
|
||||||
- (void) setupModuleFolder;
|
- (void) setupModuleFolder;
|
||||||
|
|
||||||
- (void) setMemCtx: (struct mapistore_context *) newMemCtx;
|
|
||||||
|
|
||||||
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator;
|
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator;
|
||||||
- (MAPIStoreAuthenticator *) authenticator;
|
- (MAPIStoreAuthenticator *) authenticator;
|
||||||
|
|
||||||
|
@ -80,6 +84,10 @@ extern uint64_t *MAPILongLongValue (void *, uint64_t);
|
||||||
- (id) lookupObject: (NSString *) objectURLString;
|
- (id) lookupObject: (NSString *) objectURLString;
|
||||||
|
|
||||||
/* backend methods */
|
/* backend methods */
|
||||||
|
- (int) getPath: (char **) path
|
||||||
|
ofFMID: (uint64_t) fmid
|
||||||
|
withTableType: (uint8_t) tableType;
|
||||||
|
|
||||||
- (int) getFID: (uint64_t *) fid
|
- (int) getFID: (uint64_t *) fid
|
||||||
byName: (const char *) foldername
|
byName: (const char *) foldername
|
||||||
inParentFID: (uint64_t) parent_fid;
|
inParentFID: (uint64_t) parent_fid;
|
||||||
|
@ -142,6 +150,9 @@ extern uint64_t *MAPILongLongValue (void *, uint64_t);
|
||||||
inFolder: (SOGoFolder *) folder
|
inFolder: (SOGoFolder *) folder
|
||||||
withFID: (uint64_t) fid;
|
withFID: (uint64_t) fid;
|
||||||
|
|
||||||
|
- (int) getFoldersList: (struct indexing_folders_list **) folders_list
|
||||||
|
withFMID: (uint64_t) fmid;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* MAPISTORECONTEXT_H */
|
#endif /* MAPISTORECONTEXT_H */
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#import <Mailer/SOGoMailAccount.h>
|
#import <Mailer/SOGoMailAccount.h>
|
||||||
#import <Mailer/SOGoMailFolder.h>
|
#import <Mailer/SOGoMailFolder.h>
|
||||||
|
|
||||||
|
#import "NSArray+MAPIStore.h"
|
||||||
|
|
||||||
#import "MAPIApplication.h"
|
#import "MAPIApplication.h"
|
||||||
#import "MAPIStoreAuthenticator.h"
|
#import "MAPIStoreAuthenticator.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
|
@ -124,6 +126,7 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) contextFromURI: (const char *) newUri
|
+ (id) contextFromURI: (const char *) newUri
|
||||||
|
inMemCtx: (struct mapistore_context *) newMemCtx
|
||||||
{
|
{
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
MAPIStoreAuthenticator *authenticator;
|
MAPIStoreAuthenticator *authenticator;
|
||||||
|
@ -161,6 +164,7 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
if (contextClass)
|
if (contextClass)
|
||||||
{
|
{
|
||||||
context = [NSClassFromString (contextClass) new];
|
context = [NSClassFromString (contextClass) new];
|
||||||
|
[context setURI: completeURLString andMemCtx: newMemCtx];
|
||||||
[context autorelease];
|
[context autorelease];
|
||||||
|
|
||||||
authenticator = [MAPIStoreAuthenticator new];
|
authenticator = [MAPIStoreAuthenticator new];
|
||||||
|
@ -193,6 +197,8 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
woContext = [WOContext contextWithRequest: nil];
|
woContext = [WOContext contextWithRequest: nil];
|
||||||
[woContext retain];
|
[woContext retain];
|
||||||
moduleFolder = nil;
|
moduleFolder = nil;
|
||||||
|
uri = nil;
|
||||||
|
baseContextSet = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self logWithFormat: @"-init"];
|
[self logWithFormat: @"-init"];
|
||||||
|
@ -211,9 +217,23 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
[woContext release];
|
[woContext release];
|
||||||
[authenticator release];
|
[authenticator release];
|
||||||
|
|
||||||
|
[uri release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setURI: (NSString *) newUri
|
||||||
|
andMemCtx: (struct mapistore_context *) newMemCtx
|
||||||
|
{
|
||||||
|
struct loadparm_context *lpCtx;
|
||||||
|
|
||||||
|
ASSIGN (uri, newUri);
|
||||||
|
memCtx = newMemCtx;
|
||||||
|
|
||||||
|
lpCtx = loadparm_init (newMemCtx);
|
||||||
|
ldbCtx = mapiproxy_server_openchange_ldb_init (lpCtx);
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator
|
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator
|
||||||
{
|
{
|
||||||
ASSIGN (authenticator, newAuthenticator);
|
ASSIGN (authenticator, newAuthenticator);
|
||||||
|
@ -224,15 +244,6 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
return authenticator;
|
return authenticator;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setMemCtx: (struct mapistore_context *) newMemCtx
|
|
||||||
{
|
|
||||||
struct loadparm_context *lpCtx;
|
|
||||||
memCtx = newMemCtx;
|
|
||||||
|
|
||||||
lpCtx = loadparm_init (newMemCtx);
|
|
||||||
ldbCtx = mapiproxy_server_openchange_ldb_init (lpCtx);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setupRequest
|
- (void) setupRequest
|
||||||
{
|
{
|
||||||
NSMutableDictionary *info;
|
NSMutableDictionary *info;
|
||||||
|
@ -403,17 +414,19 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
parentFolderURL = [mapping urlFromID: parentFID];
|
parentFolderURL = [mapping urlFromID: parentFID];
|
||||||
if (!parentFolderURL)
|
if (!parentFolderURL)
|
||||||
[self errorWithFormat: @"No url found for FID: %lld", parentFID];
|
[self errorWithFormat: @"No url found for FID: %lld", parentFID];
|
||||||
if (parentFolderURL) {
|
if (parentFolderURL)
|
||||||
folderURL = [self _createFolder: aRow inParentURL: parentFolderURL];
|
{
|
||||||
if (folderURL) {
|
folderURL = [self _createFolder: aRow inParentURL: parentFolderURL];
|
||||||
[mapping registerURL: folderURL withID: fid];
|
if (folderURL)
|
||||||
// if ([sogoFolder isKindOfClass: SOGoMailAccountK])
|
{
|
||||||
// [sogoFolder subscribe];
|
[mapping registerURL: folderURL withID: fid];
|
||||||
rc = MAPISTORE_SUCCESS;
|
// if ([sogoFolder isKindOfClass: SOGoMailAccountK])
|
||||||
|
// [sogoFolder subscribe];
|
||||||
|
rc = MAPISTORE_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
rc = MAPISTORE_ERR_NO_DIRECTORY;
|
rc = MAPISTORE_ERR_NO_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
@ -617,6 +630,7 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
int rc;
|
int rc;
|
||||||
uint32_t contextId;
|
uint32_t contextId;
|
||||||
uint64_t mappingId;
|
uint64_t mappingId;
|
||||||
|
NSString *folderURL;
|
||||||
id child;
|
id child;
|
||||||
|
|
||||||
rc = MAPI_E_SUCCESS;
|
rc = MAPI_E_SUCCESS;
|
||||||
|
@ -648,9 +662,13 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
{
|
{
|
||||||
openchangedb_get_new_folderID (ldbCtx, &mappingId);
|
openchangedb_get_new_folderID (ldbCtx, &mappingId);
|
||||||
[mapping registerURL: childURL withID: mappingId];
|
[mapping registerURL: childURL withID: mappingId];
|
||||||
mapistore_search_context_by_uri (memCtx,
|
folderURL = [mapping urlFromID: fid];
|
||||||
[[mapping urlFromID: fid] UTF8String],
|
NSAssert (folderURL != nil,
|
||||||
|
@"folder URL is expected to be known here");
|
||||||
|
contextId = 0;
|
||||||
|
mapistore_search_context_by_uri (memCtx, [uri UTF8String] + 7,
|
||||||
&contextId);
|
&contextId);
|
||||||
|
NSAssert (contextId > 0, @"no matching context found");
|
||||||
mapistore_indexing_record_add_mid (memCtx, contextId, mappingId);
|
mapistore_indexing_record_add_mid (memCtx, contextId, mappingId);
|
||||||
}
|
}
|
||||||
*data = MAPILongLongValue (memCtx, mappingId);
|
*data = MAPILongLongValue (memCtx, mappingId);
|
||||||
|
@ -735,7 +753,7 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
uint32_t contextId;
|
uint32_t contextId;
|
||||||
uint64_t mappingId;
|
uint64_t mappingId;
|
||||||
int rc;
|
int rc;
|
||||||
NSString *parentURL;
|
NSString *folderURL;
|
||||||
|
|
||||||
rc = MAPI_E_SUCCESS;
|
rc = MAPI_E_SUCCESS;
|
||||||
switch (proptag)
|
switch (proptag)
|
||||||
|
@ -746,9 +764,13 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
{
|
{
|
||||||
openchangedb_get_new_folderID (ldbCtx, &mappingId);
|
openchangedb_get_new_folderID (ldbCtx, &mappingId);
|
||||||
[mapping registerURL: childURL withID: mappingId];
|
[mapping registerURL: childURL withID: mappingId];
|
||||||
mapistore_search_context_by_uri (memCtx,
|
folderURL = [mapping urlFromID: fid];
|
||||||
[[mapping urlFromID: fid] UTF8String],
|
NSAssert (folderURL != nil,
|
||||||
|
@"folder URL is expected to be known here");
|
||||||
|
contextId = 0;
|
||||||
|
mapistore_search_context_by_uri (memCtx, [uri UTF8String] + 7,
|
||||||
&contextId);
|
&contextId);
|
||||||
|
NSAssert (contextId > 0, @"no matching context found");
|
||||||
mapistore_indexing_record_add_fid (memCtx, contextId, mappingId);
|
mapistore_indexing_record_add_fid (memCtx, contextId, mappingId);
|
||||||
}
|
}
|
||||||
// mappingId = [mapping idFromURL: childURL];
|
// mappingId = [mapping idFromURL: childURL];
|
||||||
|
@ -756,30 +778,7 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
*data = MAPILongLongValue (memCtx, mappingId);
|
*data = MAPILongLongValue (memCtx, mappingId);
|
||||||
break;
|
break;
|
||||||
case PR_PARENT_FID:
|
case PR_PARENT_FID:
|
||||||
parentURL = [self _parentURLFromURL: childURL];
|
*data = MAPILongLongValue (memCtx, fid);
|
||||||
if (parentURL)
|
|
||||||
{
|
|
||||||
mappingId = [mapping idFromURL: parentURL];
|
|
||||||
NSAssert (mappingId != NSNotFound,
|
|
||||||
@"parent folder should be known at this stage");
|
|
||||||
// if (mappingId == NSNotFound)
|
|
||||||
// {
|
|
||||||
// [NSException raise: @"MAPIStoreSOGoException"
|
|
||||||
// format: @"This should never happen"
|
|
||||||
// // openchangedb_get_new_folderID (ldbCtx, &mappingId);
|
|
||||||
// // [mapping registerURL: childURL withID: mappingId];
|
|
||||||
// // mapistore_search_context_by_uri (memCtx, [childURL UTF8String], &contextId);
|
|
||||||
// // mapistore_indexing_record_add_fid (memCtx, contextId, mappingId);
|
|
||||||
// // [mapping registerURL: parentURL];
|
|
||||||
// // mappingId = [mapping idFromURL: parentURL];
|
|
||||||
// }
|
|
||||||
*data = MAPILongLongValue (memCtx, mappingId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*data = NULL;
|
|
||||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PR_ATTR_HIDDEN:
|
case PR_ATTR_HIDDEN:
|
||||||
case PR_ATTR_SYSTEM:
|
case PR_ATTR_SYSTEM:
|
||||||
|
@ -896,7 +895,6 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (int) openMessage: (struct mapistore_message *) msg
|
- (int) openMessage: (struct mapistore_message *) msg
|
||||||
withMID: (uint64_t) mid
|
withMID: (uint64_t) mid
|
||||||
inFID: (uint64_t) fid
|
inFID: (uint64_t) fid
|
||||||
|
@ -949,6 +947,25 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
return MAPI_E_SUCCESS;
|
return MAPI_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int) getPath: (char **) path
|
||||||
|
ofFMID: (uint64_t) fmid
|
||||||
|
withTableType: (uint8_t) tableType
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
NSString *objectURL;
|
||||||
|
|
||||||
|
objectURL = [mapping urlFromID: fmid];
|
||||||
|
if (objectURL)
|
||||||
|
{
|
||||||
|
*path = [[objectURL substringFromIndex: 7] asUnicodeInMemCtx: memCtx];
|
||||||
|
rc = MAPISTORE_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = MAPI_E_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
- (int) getFID: (uint64_t *) fid
|
- (int) getFID: (uint64_t *) fid
|
||||||
byName: (const char *) foldername
|
byName: (const char *) foldername
|
||||||
inParentFID: (uint64_t) parent_fid
|
inParentFID: (uint64_t) parent_fid
|
||||||
|
@ -984,4 +1001,47 @@ static MAPIStoreMapping *mapping = nil;
|
||||||
return MAPI_E_SUCCESS;
|
return MAPI_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int) getFoldersList: (struct indexing_folders_list **) folders_list
|
||||||
|
withFMID: (uint64_t) fmid
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
NSString *currentURL;
|
||||||
|
NSMutableArray *nsFolderList;
|
||||||
|
uint64_t fid;
|
||||||
|
|
||||||
|
rc = MAPI_E_SUCCESS;
|
||||||
|
|
||||||
|
currentURL = [mapping urlFromID: fmid];
|
||||||
|
if (currentURL && ![currentURL isEqualToString: uri])
|
||||||
|
{
|
||||||
|
nsFolderList = [NSMutableArray arrayWithCapacity: 32];
|
||||||
|
currentURL = [self _parentURLFromURL: currentURL];
|
||||||
|
while (currentURL && rc == MAPI_E_SUCCESS
|
||||||
|
&& ![currentURL isEqualToString: uri])
|
||||||
|
{
|
||||||
|
fid = [mapping idFromURL: currentURL];
|
||||||
|
if (fid == NSNotFound)
|
||||||
|
rc = MAPI_E_NOT_FOUND;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[nsFolderList insertObject: [NSNumber numberWithUnsignedLongLong: fid]
|
||||||
|
atIndex: 0];
|
||||||
|
currentURL = [self _parentURLFromURL: currentURL];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc != MAPI_E_NOT_FOUND)
|
||||||
|
{
|
||||||
|
fid = [mapping idFromURL: uri];
|
||||||
|
[nsFolderList insertObject: [NSNumber numberWithUnsignedLongLong: fid]
|
||||||
|
atIndex: 0];
|
||||||
|
*folders_list = [nsFolderList asFoldersListInCtx: memCtx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = MAPI_E_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -65,12 +65,13 @@ static int sogo_create_context(TALLOC_CTX *mem_ctx, const char *uri, void **priv
|
||||||
|
|
||||||
DEBUG(0, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
DEBUG(0, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||||
|
|
||||||
context = [MAPIStoreContext contextFromURI: uri];
|
context = [MAPIStoreContext contextFromURI: uri
|
||||||
[context setMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
[context retain];
|
[context retain];
|
||||||
|
|
||||||
cContext = talloc_zero(mem_ctx, sogo_context);
|
cContext = talloc_zero(mem_ctx, sogo_context);
|
||||||
cContext->objcContext = context;
|
cContext->objcContext = context;
|
||||||
|
|
||||||
*private_data = cContext;
|
*private_data = cContext;
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
@ -148,21 +149,23 @@ static int sogo_get_path(void *private_data, uint64_t fmid,
|
||||||
uint8_t type, char **path)
|
uint8_t type, char **path)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
sogo_context *cContext;
|
||||||
|
MAPIStoreContext *context;
|
||||||
|
int rc;
|
||||||
|
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
cContext = private_data;
|
||||||
|
context = cContext->objcContext;
|
||||||
|
[context setupRequest];
|
||||||
|
|
||||||
switch (type) {
|
rc = [context getPath: path ofFMID: fmid withTableType: type];
|
||||||
case MAPISTORE_FOLDER:
|
|
||||||
break;
|
[context tearDownRequest];
|
||||||
case MAPISTORE_MESSAGE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
return MAPISTORE_SUCCESS;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sogo_op_get_fid_by_name(void *private_data, uint64_t parent_fid, const char* foldername, uint64_t *fid)
|
static int sogo_op_get_fid_by_name(void *private_data, uint64_t parent_fid, const char* foldername, uint64_t *fid)
|
||||||
|
@ -535,6 +538,29 @@ static int sogo_op_deletemessage(void *private_data,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sogo_op_get_folders_list(void *private_data,
|
||||||
|
uint64_t fmid,
|
||||||
|
struct indexing_folders_list **folders_list)
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
|
sogo_context *cContext;
|
||||||
|
MAPIStoreContext *context;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
cContext = private_data;
|
||||||
|
context = cContext->objcContext;
|
||||||
|
[context setupRequest];
|
||||||
|
|
||||||
|
rc = [context getFoldersList: folders_list withFMID: fmid];
|
||||||
|
|
||||||
|
[context tearDownRequest];
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\details Entry point for mapistore SOGO backend
|
\details Entry point for mapistore SOGO backend
|
||||||
|
|
||||||
|
@ -580,6 +606,7 @@ int mapistore_init_backend(void)
|
||||||
backend.op_get_fid_by_name = sogo_op_get_fid_by_name;
|
backend.op_get_fid_by_name = sogo_op_get_fid_by_name;
|
||||||
backend.op_setprops = sogo_op_setprops;
|
backend.op_setprops = sogo_op_setprops;
|
||||||
backend.op_deletemessage = sogo_op_deletemessage;
|
backend.op_deletemessage = sogo_op_deletemessage;
|
||||||
|
backend.op_get_folders_list = sogo_op_get_folders_list;
|
||||||
|
|
||||||
/* Register ourselves with the MAPISTORE subsystem */
|
/* Register ourselves with the MAPISTORE subsystem */
|
||||||
ret = mapistore_backend_register(&backend);
|
ret = mapistore_backend_register(&backend);
|
||||||
|
|
34
OpenChange/NSArray+MAPIStore.h
Normal file
34
OpenChange/NSArray+MAPIStore.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* NSArray+MAPIStore.h - this file is part of SOGo
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Inverse inc.
|
||||||
|
*
|
||||||
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NSARRAY_MAPISTORE_H
|
||||||
|
#define NSARRAY_MAPISTORE_H
|
||||||
|
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
|
|
||||||
|
@interface NSArray (MAPIStoreFolders)
|
||||||
|
|
||||||
|
- (struct indexing_folders_list *) asFoldersListInCtx: (void *) memCtx;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* NSARRAY+MAPISTORE_H */
|
50
OpenChange/NSArray+MAPIStore.m
Normal file
50
OpenChange/NSArray+MAPIStore.m
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/* NSArray+MAPIStore.m - this file is part of SOGo
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Inverse inc.
|
||||||
|
*
|
||||||
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/NSValue.h>
|
||||||
|
|
||||||
|
#import "NSArray+MAPIStore.h"
|
||||||
|
|
||||||
|
#undef DEBUG
|
||||||
|
#include <talloc.h>
|
||||||
|
#include <mapistore/mapistore.h>
|
||||||
|
|
||||||
|
@implementation NSArray (MAPIStoreFolders)
|
||||||
|
|
||||||
|
- (struct indexing_folders_list *) asFoldersListInCtx: (void *) memCtx
|
||||||
|
{
|
||||||
|
struct indexing_folders_list *flist;
|
||||||
|
NSInteger count, max;
|
||||||
|
|
||||||
|
max = [self count];
|
||||||
|
|
||||||
|
flist = talloc_zero(memCtx, struct indexing_folders_list);
|
||||||
|
flist->folderID = talloc_array(flist, uint64_t, max);
|
||||||
|
flist->count = max;
|
||||||
|
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
|
*(flist->folderID + count) = [[self objectAtIndex: count] unsignedLongLongValue];
|
||||||
|
|
||||||
|
return flist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
Loading…
Reference in a new issue