Merge pull request #49 from Zentyal/Contrib
Several patches for the OpenChange integrationpull/3/head
commit
a263939d8a
|
@ -133,7 +133,8 @@ $(PLREADER_TOOL)_OBJC_FILES += \
|
||||||
|
|
||||||
DBMSGREADER_TOOL = dbmsgreader
|
DBMSGREADER_TOOL = dbmsgreader
|
||||||
$(DBMSGREADER_TOOL)_OBJC_FILES += \
|
$(DBMSGREADER_TOOL)_OBJC_FILES += \
|
||||||
dbmsgreader.m
|
dbmsgreader.m \
|
||||||
|
NSObject+PropertyList.m
|
||||||
|
|
||||||
$(DBMSGREADER_TOOL)_LIB_DIRS += \
|
$(DBMSGREADER_TOOL)_LIB_DIRS += \
|
||||||
-L../SoObjects/SOGo/SOGo.framework/ -lSOGo \
|
-L../SoObjects/SOGo/SOGo.framework/ -lSOGo \
|
||||||
|
|
|
@ -1218,7 +1218,9 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
NSRange range;
|
||||||
NSString *stringValue;
|
NSString *stringValue;
|
||||||
|
NSString *trimingString = @"\r\n\n";
|
||||||
|
|
||||||
/* FIXME: there is a confusion in NGCards around "comment" and "description" */
|
/* FIXME: there is a confusion in NGCards around "comment" and "description" */
|
||||||
stringValue = [event comment];
|
stringValue = [event comment];
|
||||||
|
@ -1226,6 +1228,14 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||||
&& ![stringValue isEqualToString: @"\r\n"]
|
&& ![stringValue isEqualToString: @"\r\n"]
|
||||||
&& ![stringValue isEqualToString: @"\n"])
|
&& ![stringValue isEqualToString: @"\n"])
|
||||||
{
|
{
|
||||||
|
/* Avoiding those trail weird characters at event description */
|
||||||
|
range = [stringValue rangeOfString: trimingString
|
||||||
|
options: NSBackwardsSearch];
|
||||||
|
if (range.location > 0)
|
||||||
|
{
|
||||||
|
stringValue = [stringValue substringToIndex: (NSMaxRange(range) -1)];
|
||||||
|
}
|
||||||
|
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
+ (enum mapistore_error) createRootFolder: (NSString **) mapistoreUriP
|
+ (enum mapistore_error) createRootFolder: (NSString **) mapistoreUriP
|
||||||
withFID: (uint64_t ) fid
|
withFID: (uint64_t ) fid
|
||||||
|
@ -75,11 +75,11 @@
|
||||||
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
||||||
withURI: (const char *) newUri
|
withURI: (const char *) newUri
|
||||||
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
andTDBIndexing: (struct indexing_context *) indexing;
|
||||||
|
|
||||||
- (id) initFromURL: (NSURL *) newUri
|
- (id) initFromURL: (NSURL *) newUri
|
||||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
andTDBIndexing: (struct indexing_context *) indexing;
|
||||||
|
|
||||||
- (NSURL *) url;
|
- (NSURL *) url;
|
||||||
- (struct mapistore_connection_info *) connectionInfo;
|
- (struct mapistore_connection_info *) connectionInfo;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *list, *current;
|
struct mapistore_contexts_list *list, *current;
|
||||||
|
@ -112,7 +112,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
|
||||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
[userContext activateWithUser: [userContext sogoUser]];
|
[userContext activateWithUser: [userContext sogoUser]];
|
||||||
|
|
||||||
classes = GSObjCAllSubclassesOfClass (self);
|
classes = GSObjCAllSubclassesOfClass (self);
|
||||||
|
@ -121,7 +121,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
{
|
{
|
||||||
currentClass = [classes objectAtIndex: count];
|
currentClass = [classes objectAtIndex: count];
|
||||||
current = [currentClass listContextsForUser: userName
|
current = [currentClass listContextsForUser: userName
|
||||||
withTDBIndexing: indexingTdb
|
withIndexing: indexing
|
||||||
inMemCtx: memCtx];
|
inMemCtx: memCtx];
|
||||||
if (current)
|
if (current)
|
||||||
DLIST_CONCATENATE(list, current, void);
|
DLIST_CONCATENATE(list, current, void);
|
||||||
|
@ -131,7 +131,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -216,7 +216,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
||||||
withURI: (const char *) newUri
|
withURI: (const char *) newUri
|
||||||
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb
|
andTDBIndexing: (struct indexing_context *) indexing
|
||||||
{
|
{
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
Class contextClass;
|
Class contextClass;
|
||||||
|
@ -239,7 +239,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
{
|
{
|
||||||
context = [[contextClass alloc] initFromURL: baseURL
|
context = [[contextClass alloc] initFromURL: baseURL
|
||||||
withConnectionInfo: newConnInfo
|
withConnectionInfo: newConnInfo
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
if (context)
|
if (context)
|
||||||
{
|
{
|
||||||
[context autorelease];
|
[context autorelease];
|
||||||
|
@ -272,7 +272,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
|
|
||||||
- (id) initFromURL: (NSURL *) newUrl
|
- (id) initFromURL: (NSURL *) newUrl
|
||||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb
|
andTDBIndexing: (struct indexing_context *) indexing
|
||||||
{
|
{
|
||||||
NSString *username;
|
NSString *username;
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
|
|
||||||
ASSIGN (userContext,
|
ASSIGN (userContext,
|
||||||
[MAPIStoreUserContext userContextWithUsername: username
|
[MAPIStoreUserContext userContextWithUsername: username
|
||||||
andTDBIndexing: indexingTdb]);
|
andTDBIndexing: indexing]);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
mapistore_mgmt_backend_register_user (newConnInfo,
|
mapistore_mgmt_backend_register_user (newConnInfo,
|
||||||
|
@ -374,17 +374,14 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
{
|
{
|
||||||
if ([objectURL hasPrefix: url])
|
if ([objectURL hasPrefix: url])
|
||||||
{
|
{
|
||||||
*path = [[objectURL substringFromIndex: 7]
|
*path = [[objectURL substringFromIndex: 7] asUnicodeInMemCtx: memCtx];
|
||||||
asUnicodeInMemCtx: memCtx];
|
[self logWithFormat: @"found path '%s' for fmid 0x%.16"PRIx64"", *path, fmid];
|
||||||
[self logWithFormat: @"found path '%s' for fmid %.16x",
|
|
||||||
*path, fmid];
|
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logWithFormat: @"context (%@, %@) does not contain"
|
[self logWithFormat: @"context (%@, %@) does not contain "
|
||||||
@" found fmid: 0x%.16x",
|
@"found fmid: 0x%.16"PRIx64"", objectURL, url, fmid];
|
||||||
objectURL, url, fmid];
|
|
||||||
*path = NULL;
|
*path = NULL;
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +531,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
{
|
{
|
||||||
//[self warnWithFormat: @"no id exist yet for '%@', requesting one...",
|
//[self warnWithFormat: @"no id exist yet for '%@', requesting one...",
|
||||||
// childURL];
|
// childURL];
|
||||||
openchangedb_get_new_folderID (connInfo->oc_ctx, &mappingId);
|
mapistore_indexing_get_new_folderID (connInfo->mstore_ctx, &mappingId);
|
||||||
[mapping registerURL: childURL withID: mappingId];
|
[mapping registerURL: childURL withID: mappingId];
|
||||||
contextId = 0;
|
contextId = 0;
|
||||||
|
|
||||||
|
@ -597,9 +594,9 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
memCtx = talloc_zero(NULL, TALLOC_CTX);
|
memCtx = talloc_zero(NULL, TALLOC_CTX);
|
||||||
newFMIDs = [NSMutableArray arrayWithCapacity: max];
|
newFMIDs = [NSMutableArray arrayWithCapacity: max];
|
||||||
|
|
||||||
if (openchangedb_get_new_folderIDs (connInfo->oc_ctx,
|
if (mapistore_indexing_get_new_folderIDs (connInfo->mstore_ctx,
|
||||||
memCtx, max, &numbers)
|
memCtx, max, &numbers)
|
||||||
!= MAPI_E_SUCCESS || numbers->cValues != max)
|
!= MAPISTORE_SUCCESS || numbers->cValues != max)
|
||||||
abort ();
|
abort ();
|
||||||
for (count = 0; count < max; count++)
|
for (count = 0; count < max; count++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
inContainer: nil];
|
inContainer: nil];
|
||||||
[root setOwner: userName];
|
[root setOwner: userName];
|
||||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
[userContext ensureFolderTableExists];
|
[userContext ensureFolderTableExists];
|
||||||
[root setTableUrl: [userContext folderTableURL]];
|
[root setTableUrl: [userContext folderTableURL]];
|
||||||
names = [root toManyRelationshipKeys];
|
names = [root toManyRelationshipKeys];
|
||||||
|
|
|
@ -433,10 +433,16 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) deleteFolder
|
- (void) deleteFolderImpl
|
||||||
{
|
{
|
||||||
|
// TODO: raise exception in case underlying delete fails?
|
||||||
// [propsMessage delete];
|
// [propsMessage delete];
|
||||||
[dbFolder delete];
|
[dbFolder delete];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) deleteFolder
|
||||||
|
{
|
||||||
|
[self deleteFolderImpl];
|
||||||
|
|
||||||
[self cleanupCaches];
|
[self cleanupCaches];
|
||||||
|
|
||||||
|
@ -890,7 +896,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
{
|
{
|
||||||
fmid = [mapping idFromURL: [self url]];
|
fmid = [mapping idFromURL: [self url]];
|
||||||
[mapping unregisterURLWithID: fmid];
|
[mapping unregisterURLWithID: fmid];
|
||||||
[self deleteFolder];
|
[self deleteFolderImpl];
|
||||||
[mapping registerURL: [newFolder url]
|
[mapping registerURL: [newFolder url]
|
||||||
withID: fmid];
|
withID: fmid];
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
if (moduleName)
|
if (moduleName)
|
||||||
{
|
{
|
||||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
parentFolder = [[userContext rootFolders] objectForKey: moduleName];
|
parentFolder = [[userContext rootFolders] objectForKey: moduleName];
|
||||||
baseUrl = [NSString stringWithFormat: @"sogo://%@@%@/",
|
baseUrl = [NSString stringWithFormat: @"sogo://%@@%@/",
|
||||||
userName, moduleName];
|
userName, moduleName];
|
||||||
|
|
|
@ -83,7 +83,7 @@ MakeDisplayFolderName (NSString *folderName)
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||||
|
@ -100,7 +100,7 @@ MakeDisplayFolderName (NSString *folderName)
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
|
|
||||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
||||||
woContext = [userContext woContext];
|
woContext = [userContext woContext];
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ MakeDisplayFolderName (NSString *folderName)
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
@ -256,7 +256,7 @@ MakeDisplayFolderName (NSString *folderName)
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
|
|
||||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
||||||
woContext = [userContext woContext];
|
woContext = [userContext woContext];
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||||
msgData->recipients_count = max;
|
msgData->recipients_count = max;
|
||||||
msgData->recipients = talloc_array (msgData, struct mapistore_message_recipient, max);
|
msgData->recipients = talloc_array (msgData, struct mapistore_message_recipient, max);
|
||||||
current = 0;
|
current = 0;
|
||||||
for (type = 0; type < 4; type++)
|
for (type = MAPI_ORIG; type <= MAPI_BCC; type++)
|
||||||
{
|
{
|
||||||
recipients = [allRecipients objectForKey: recTypes[type]];
|
recipients = [allRecipients objectForKey: recTypes[type]];
|
||||||
recipientsMax = [recipients count];
|
recipientsMax = [recipients count];
|
||||||
|
@ -541,7 +541,7 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||||
NSArray *list;
|
NSArray *list;
|
||||||
NSCalendarDate *date;
|
NSCalendarDate *date;
|
||||||
NSDictionary *recipients;
|
NSDictionary *recipients;
|
||||||
NSUInteger type, bccLimit;
|
enum ulRecipClass type, bccLimit;
|
||||||
SOGoUser *activeUser;
|
SOGoUser *activeUser;
|
||||||
NSNumber *priority;
|
NSNumber *priority;
|
||||||
|
|
||||||
|
@ -561,8 +561,8 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||||
bccLimit = MAPI_BCC;
|
bccLimit = MAPI_BCC;
|
||||||
else
|
else
|
||||||
bccLimit = MAPI_CC;
|
bccLimit = MAPI_CC;
|
||||||
bccLimit++;
|
|
||||||
for (type = MAPI_TO; type < bccLimit; type++)
|
for (type = MAPI_TO; type <= bccLimit; type++)
|
||||||
{
|
{
|
||||||
recId = recTypes[type];
|
recId = recTypes[type];
|
||||||
list = MakeRecipientsList ([recipients objectForKey: recId]);
|
list = MakeRecipientsList ([recipients objectForKey: recId]);
|
||||||
|
@ -865,7 +865,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||||
NSMutableArray *recipientEmails;
|
NSMutableArray *recipientEmails;
|
||||||
NSArray *list;
|
NSArray *list;
|
||||||
NSString *recId, *from, *msgClass;
|
NSString *recId, *from, *msgClass;
|
||||||
NSUInteger count;
|
enum ulRecipClass type;
|
||||||
SOGoUser *activeUser;
|
SOGoUser *activeUser;
|
||||||
SOGoDomainDefaults *dd;
|
SOGoDomainDefaults *dd;
|
||||||
NSException *error;
|
NSException *error;
|
||||||
|
@ -881,9 +881,9 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||||
|
|
||||||
recipientEmails = [NSMutableArray arrayWithCapacity: 32];
|
recipientEmails = [NSMutableArray arrayWithCapacity: 32];
|
||||||
recipients = [properties objectForKey: @"recipients"];
|
recipients = [properties objectForKey: @"recipients"];
|
||||||
for (count = 0; count < 3; count++)
|
for (type = MAPI_ORIG; type <= MAPI_BCC; type++)
|
||||||
{
|
{
|
||||||
recId = recTypes[count];
|
recId = recTypes[type];
|
||||||
list = [recipients objectForKey: recId];
|
list = [recipients objectForKey: recId];
|
||||||
[recipientEmails
|
[recipientEmails
|
||||||
addObjectsFromArray: [list objectsForKey: @"email"
|
addObjectsFromArray: [list objectsForKey: @"email"
|
||||||
|
|
|
@ -32,17 +32,15 @@
|
||||||
{
|
{
|
||||||
void *memCtx;
|
void *memCtx;
|
||||||
NSString *username;
|
NSString *username;
|
||||||
struct tdb_wrap *indexing;
|
struct indexing_context *indexing;
|
||||||
NSMutableDictionary *mapping; /* FID/MID -> url */
|
|
||||||
NSMutableDictionary *reverseMapping; /* url -> FID/MID */
|
|
||||||
NSUInteger useCount;
|
NSUInteger useCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) mappingForUsername: (NSString *) username
|
+ (id) mappingForUsername: (NSString *) username
|
||||||
withIndexing: (struct tdb_wrap *) indexing;
|
withIndexing: (struct indexing_context *) indexing;
|
||||||
|
|
||||||
- (id) initForUsername: (NSString *) username
|
- (id) initForUsername: (NSString *) username
|
||||||
withIndexing: (struct tdb_wrap *) indexing;
|
withIndexing: (struct indexing_context *) indexing;
|
||||||
|
|
||||||
|
|
||||||
- (void) increaseUseCount;
|
- (void) increaseUseCount;
|
||||||
|
|
|
@ -33,16 +33,15 @@
|
||||||
|
|
||||||
#import <SOGo/NSString+Utilities.h>
|
#import <SOGo/NSString+Utilities.h>
|
||||||
|
|
||||||
|
#undef DEBUG
|
||||||
|
#include <mapistore/mapistore.h>
|
||||||
|
#include <mapistore/mapistore_errors.h>
|
||||||
|
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
|
|
||||||
#include <talloc.h>
|
#include <talloc.h>
|
||||||
#include <tdb.h>
|
|
||||||
|
|
||||||
struct tdb_wrap {
|
|
||||||
struct tdb_context *tdb;
|
|
||||||
};
|
|
||||||
|
|
||||||
static NSMutableDictionary *mappingRegistry = nil;
|
static NSMutableDictionary *mappingRegistry = nil;
|
||||||
|
|
||||||
|
@ -59,51 +58,9 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||||
return [NSString stringWithUnsignedLongLong: idNbr];
|
return [NSString stringWithUnsignedLongLong: idNbr];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
NSMutableDictionary *mapping;
|
|
||||||
id idKey;
|
|
||||||
NSString *uri;
|
|
||||||
char *idStr, *uriStr;
|
|
||||||
uint64_t idNbr;
|
|
||||||
|
|
||||||
// get the key
|
|
||||||
// key examples : key(18) = "0x6900000000000001"
|
|
||||||
// key(31) = "SOFT_DELETED:0xb100020000000001"
|
|
||||||
//
|
|
||||||
idStr = (char *) data1.dptr;
|
|
||||||
idKey = nil;
|
|
||||||
|
|
||||||
if (strncmp(idStr, "SOFT_DELETED:", 13) != 0)
|
|
||||||
{
|
|
||||||
// It's very important here to use strtoull and NOT strtoll as
|
|
||||||
// the latter will overflow a long long with typical key values.
|
|
||||||
idNbr = strtoull(idStr, NULL, 0);
|
|
||||||
// idKey = [NSNumber numberWithUnsignedLongLong: idNbr];
|
|
||||||
idKey = MAPIStoreMappingKeyFromId(idNbr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the value and null-terminate it
|
|
||||||
uriStr = (char *)malloc(sizeof(char *) * data2.dsize+1);
|
|
||||||
memset(uriStr, 0, data2.dsize+1);
|
|
||||||
memcpy(uriStr, (const char *) data2.dptr, data2.dsize);
|
|
||||||
uri = [NSString stringWithUTF8String: uriStr];
|
|
||||||
free (uriStr);
|
|
||||||
|
|
||||||
mapping = data;
|
|
||||||
|
|
||||||
if (uri && idKey)
|
|
||||||
{
|
|
||||||
[mapping setObject: uri forKey: idKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id) mappingForUsername: (NSString *) username
|
+ (id) mappingForUsername: (NSString *) username
|
||||||
withIndexing: (struct tdb_wrap *) indexing
|
withIndexing: (struct indexing_context *) indexing
|
||||||
{
|
{
|
||||||
id mapping;
|
id mapping;
|
||||||
|
|
||||||
|
@ -123,8 +80,6 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
{
|
{
|
||||||
memCtx = talloc_zero (NULL, TALLOC_CTX);
|
memCtx = talloc_zero (NULL, TALLOC_CTX);
|
||||||
mapping = [NSMutableDictionary new];
|
|
||||||
reverseMapping = [NSMutableDictionary new];
|
|
||||||
indexing = NULL;
|
indexing = NULL;
|
||||||
useCount = 0;
|
useCount = 0;
|
||||||
}
|
}
|
||||||
|
@ -153,29 +108,12 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initForUsername: (NSString *) newUsername
|
- (id) initForUsername: (NSString *) newUsername
|
||||||
withIndexing: (struct tdb_wrap *) newIndexing
|
withIndexing: (struct indexing_context *) newIndexing
|
||||||
{
|
{
|
||||||
NSString *idNbr, *uri;
|
|
||||||
NSArray *keys;
|
|
||||||
NSUInteger count, max;
|
|
||||||
|
|
||||||
if ((self = [self init]))
|
if ((self = [self init]))
|
||||||
{
|
{
|
||||||
ASSIGN (username, newUsername);
|
ASSIGN (username, newUsername);
|
||||||
indexing = newIndexing;
|
indexing = newIndexing;
|
||||||
(void) talloc_reference (memCtx, newIndexing);
|
|
||||||
tdb_traverse_read (indexing->tdb, MAPIStoreMappingTDBTraverse, mapping);
|
|
||||||
keys = [mapping allKeys];
|
|
||||||
max = [keys count];
|
|
||||||
for (count = 0; count < max; count++)
|
|
||||||
{
|
|
||||||
idNbr = [keys objectAtIndex: count];
|
|
||||||
uri = [mapping objectForKey: idNbr];
|
|
||||||
//[self logWithFormat: @"preregistered id '%@' for url '%@'", idNbr, uri];
|
|
||||||
[reverseMapping setObject: idNbr forKey: uri];
|
|
||||||
}
|
|
||||||
|
|
||||||
//[self logWithFormat: @"Complete mapping: %@ \nComplete reverse mapping: %@", mapping, reverseMapping];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -184,83 +122,72 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[username release];
|
[username release];
|
||||||
[mapping release];
|
|
||||||
[reverseMapping release];
|
|
||||||
talloc_free (memCtx);
|
talloc_free (memCtx);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) urlFromID: (uint64_t) idNbr
|
- (NSString *) urlFromID: (uint64_t) idNbr
|
||||||
{
|
{
|
||||||
return [mapping objectForKey: MAPIStoreMappingKeyFromId (idNbr)];
|
char* url = NULL;
|
||||||
|
enum mapistore_error ret;
|
||||||
|
bool soft_delete = false;
|
||||||
|
|
||||||
|
ret = indexing->get_uri(indexing, [username UTF8String],
|
||||||
|
memCtx, idNbr, &url, &soft_delete);
|
||||||
|
if (ret != MAPISTORE_SUCCESS)
|
||||||
|
return NULL;
|
||||||
|
NSString *res = [[[NSString alloc] initWithUTF8String:url] autorelease];
|
||||||
|
talloc_free(url);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (uint64_t) idFromURL: (NSString *) url
|
- (uint64_t) idFromURL: (NSString *) url
|
||||||
{
|
{
|
||||||
id key;
|
enum mapistore_error ret;
|
||||||
uint64_t idNbr;
|
uint64_t idNbr;
|
||||||
|
bool softDeleted;
|
||||||
|
|
||||||
key = [reverseMapping objectForKey: url];
|
ret = indexing->get_fmid(indexing, [username UTF8String], [url UTF8String],
|
||||||
if (key)
|
false, &idNbr, &softDeleted);
|
||||||
idNbr = [key unsignedLongLongValue];
|
|
||||||
|
if (ret == MAPISTORE_SUCCESS && !softDeleted)
|
||||||
|
return idNbr;
|
||||||
else
|
else
|
||||||
idNbr = NSNotFound;
|
return NSNotFound;
|
||||||
|
|
||||||
return idNbr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _updateFolderWithURL: (NSString *) oldURL
|
- (void) _updateFolderWithURL: (NSString *) oldURL
|
||||||
withURL: (NSString *) urlString
|
withURL: (NSString *) urlString
|
||||||
{
|
{
|
||||||
NSArray *allKeys;
|
const char *searchURL;
|
||||||
NSUInteger count, max;
|
uint64_t idNbr;
|
||||||
NSString *currentKey, *newKey;
|
bool softDeleted;
|
||||||
id idKey;
|
NSString *current;
|
||||||
TDB_DATA key, dbuf;
|
NSString *newURL;
|
||||||
|
|
||||||
[oldURL retain];
|
if ([oldURL isEqualToString: urlString]) return;
|
||||||
|
|
||||||
allKeys = [reverseMapping allKeys];
|
searchURL = [[oldURL stringByAppendingString:@"*"] UTF8String];
|
||||||
max = [allKeys count];
|
|
||||||
for (count = 0; count < max; count++)
|
|
||||||
{
|
|
||||||
currentKey = [allKeys objectAtIndex: count];
|
|
||||||
if ([currentKey hasPrefix: oldURL])
|
|
||||||
{
|
|
||||||
newKey = [currentKey stringByReplacingPrefix: oldURL
|
|
||||||
withPrefix: urlString];
|
|
||||||
|
|
||||||
idKey = [reverseMapping objectForKey: currentKey];
|
while (indexing->get_fmid(indexing, [username UTF8String],
|
||||||
[mapping setObject: newKey forKey: idKey];
|
searchURL,true, &idNbr, &softDeleted) == MAPISTORE_SUCCESS)
|
||||||
[reverseMapping setObject: idKey forKey: newKey];
|
{
|
||||||
[reverseMapping removeObjectForKey: currentKey];
|
// Ignore deleted
|
||||||
|
if (softDeleted) continue;
|
||||||
|
|
||||||
/* update the record in the indexing database */
|
current = [self urlFromID:idNbr];
|
||||||
key.dptr = (unsigned char *) talloc_asprintf (NULL, "0x%.16"PRIx64,
|
newURL = [current stringByReplacingPrefix: oldURL withPrefix: urlString];
|
||||||
(uint64_t) [idKey unsignedLongLongValue]);
|
indexing->update_fmid(indexing, [username UTF8String], idNbr, [newURL UTF8String]);
|
||||||
key.dsize = strlen ((const char *) key.dptr);
|
}
|
||||||
|
|
||||||
dbuf.dptr = (unsigned char *) talloc_strdup (NULL,
|
|
||||||
[newKey UTF8String]);
|
|
||||||
dbuf.dsize = strlen ((const char *) dbuf.dptr);
|
|
||||||
tdb_store (indexing->tdb, key, dbuf, TDB_MODIFY);
|
|
||||||
talloc_free (key.dptr);
|
|
||||||
talloc_free (dbuf.dptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[oldURL release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) updateID: (uint64_t) idNbr
|
- (void) updateID: (uint64_t) idNbr
|
||||||
withURL: (NSString *) urlString
|
withURL: (NSString *) urlString
|
||||||
{
|
{
|
||||||
NSString *oldURL;
|
NSString *oldURL;
|
||||||
id idKey;
|
|
||||||
TDB_DATA key, dbuf;
|
|
||||||
|
|
||||||
idKey = MAPIStoreMappingKeyFromId (idNbr);
|
oldURL = [self urlFromID: idNbr];
|
||||||
oldURL = [mapping objectForKey: idKey];
|
|
||||||
if (oldURL)
|
if (oldURL)
|
||||||
{
|
{
|
||||||
if ([oldURL hasSuffix: @"/"]) /* is container ? */
|
if ([oldURL hasSuffix: @"/"]) /* is container ? */
|
||||||
|
@ -268,28 +195,16 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
if (![urlString hasSuffix: @"/"])
|
if (![urlString hasSuffix: @"/"])
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"a container url must have an ending '/'"];
|
format: @"a container url must have an ending '/'"];
|
||||||
tdb_transaction_start (indexing->tdb);
|
|
||||||
[self _updateFolderWithURL: oldURL withURL: urlString];
|
[self _updateFolderWithURL: oldURL withURL: urlString];
|
||||||
tdb_transaction_commit (indexing->tdb);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ([urlString hasSuffix: @"/"])
|
if ([urlString hasSuffix: @"/"])
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"a leaf url must not have an ending '/'"];
|
format: @"a leaf url must not have an ending '/'"];
|
||||||
[mapping setObject: urlString forKey: idKey];
|
|
||||||
[reverseMapping setObject: idKey forKey: urlString];
|
|
||||||
[reverseMapping removeObjectForKey: oldURL];
|
|
||||||
|
|
||||||
/* update the record in the indexing database */
|
indexing->update_fmid(indexing, [username UTF8String],
|
||||||
key.dptr = (unsigned char *) talloc_asprintf(NULL, "0x%.16"PRIx64, idNbr);
|
idNbr, [urlString UTF8String]);
|
||||||
key.dsize = strlen((const char *) key.dptr);
|
|
||||||
|
|
||||||
dbuf.dptr = (unsigned char *) talloc_strdup (NULL, [urlString UTF8String]);
|
|
||||||
dbuf.dsize = strlen((const char *) dbuf.dptr);
|
|
||||||
tdb_store (indexing->tdb, key, dbuf, TDB_MODIFY);
|
|
||||||
talloc_free (key.dptr);
|
|
||||||
talloc_free (dbuf.dptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,37 +212,37 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
- (BOOL) registerURL: (NSString *) urlString
|
- (BOOL) registerURL: (NSString *) urlString
|
||||||
withID: (uint64_t) idNbr
|
withID: (uint64_t) idNbr
|
||||||
{
|
{
|
||||||
id idKey;
|
NSString *oldURL;
|
||||||
BOOL rc;
|
uint64_t oldIdNbr;
|
||||||
TDB_DATA key, dbuf;
|
bool rc;
|
||||||
|
|
||||||
idKey = MAPIStoreMappingKeyFromId (idNbr);
|
oldURL = [self urlFromID: idNbr];
|
||||||
if ([mapping objectForKey: idKey]
|
if (oldURL != NULL)
|
||||||
|| [reverseMapping objectForKey: urlString])
|
|
||||||
{
|
{
|
||||||
[self errorWithFormat:
|
[self errorWithFormat:
|
||||||
@"attempt to double register an entry ('%@', %lld,"
|
@"url with idNbr already registered: (oldUrl='%@', newUrl='%@', id=x%.16"PRIx64")",
|
||||||
@" 0x%.16"PRIx64")",
|
oldURL, urlString, idNbr];
|
||||||
urlString, idNbr, idNbr];
|
return NO;
|
||||||
rc = NO;
|
}
|
||||||
|
|
||||||
|
oldIdNbr = [self idFromURL: urlString];
|
||||||
|
if (oldIdNbr != NSNotFound)
|
||||||
|
{
|
||||||
|
[self errorWithFormat:
|
||||||
|
@"attempt to double register an entry with idNbr ('%@', %lld,"
|
||||||
|
@" 0x%.16"PRIx64", oldid=0x%.16"PRIx64")",
|
||||||
|
urlString, idNbr, idNbr, oldIdNbr];
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[mapping setObject: urlString forKey: idKey];
|
|
||||||
[reverseMapping setObject: idKey forKey: urlString];
|
|
||||||
rc = YES;
|
rc = YES;
|
||||||
// [self logWithFormat: @"registered url '%@' with id %lld (0x%.16"PRIx64")",
|
// [self logWithFormat: @"registered url '%@' with id %lld (0x%.16"PRIx64")",
|
||||||
// urlString, idNbr, idNbr];
|
// urlString, idNbr, idNbr];
|
||||||
|
|
||||||
/* Add the record given its fid and mapistore_uri */
|
/* Add the record given its fid and mapistore_uri */
|
||||||
key.dptr = (unsigned char *) talloc_asprintf(NULL, "0x%.16"PRIx64, idNbr);
|
indexing->add_fmid(indexing, [username UTF8String],
|
||||||
key.dsize = strlen((const char *) key.dptr);
|
idNbr, [urlString UTF8String]);
|
||||||
|
|
||||||
dbuf.dptr = (unsigned char *) talloc_strdup(NULL, [urlString UTF8String]);
|
|
||||||
dbuf.dsize = strlen((const char *) dbuf.dptr);
|
|
||||||
tdb_store (indexing->tdb, key, dbuf, TDB_INSERT);
|
|
||||||
talloc_free (key.dptr);
|
|
||||||
talloc_free (dbuf.dptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -341,7 +256,6 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
max = [urlStrings count];
|
max = [urlStrings count];
|
||||||
if (max == [idNbrs count])
|
if (max == [idNbrs count])
|
||||||
{
|
{
|
||||||
tdb_transaction_start (indexing->tdb);
|
|
||||||
for (count = 0; count < max; count++)
|
for (count = 0; count < max; count++)
|
||||||
{
|
{
|
||||||
newID = [[idNbrs objectAtIndex: count]
|
newID = [[idNbrs objectAtIndex: count]
|
||||||
|
@ -349,7 +263,6 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
[self registerURL: [urlStrings objectAtIndex: count]
|
[self registerURL: [urlStrings objectAtIndex: count]
|
||||||
withID: newID];
|
withID: newID];
|
||||||
}
|
}
|
||||||
tdb_transaction_commit (indexing->tdb);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -358,26 +271,8 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2,
|
||||||
|
|
||||||
- (void) unregisterURLWithID: (uint64_t) idNbr
|
- (void) unregisterURLWithID: (uint64_t) idNbr
|
||||||
{
|
{
|
||||||
NSString *urlString;
|
indexing->del_fmid(indexing, [username UTF8String],
|
||||||
id idKey;
|
idNbr, MAPISTORE_PERMANENT_DELETE);
|
||||||
TDB_DATA key;
|
|
||||||
|
|
||||||
idKey = MAPIStoreMappingKeyFromId (idNbr);
|
|
||||||
urlString = [mapping objectForKey: idKey];
|
|
||||||
if (urlString)
|
|
||||||
{
|
|
||||||
// [self logWithFormat: @"unregistering url '%@' with id %lld (0x%.16"PRIx64")",
|
|
||||||
// urlString, idNbr, idNbr];
|
|
||||||
[reverseMapping removeObjectForKey: urlString];
|
|
||||||
[mapping removeObjectForKey: idKey];
|
|
||||||
|
|
||||||
/* We hard-delete the entry from the indexing database */
|
|
||||||
key.dptr = (unsigned char *) talloc_asprintf(NULL, "0x%.16"PRIx64, idNbr);
|
|
||||||
key.dsize = strlen((const char *) key.dptr);
|
|
||||||
|
|
||||||
tdb_delete(indexing->tdb, key);
|
|
||||||
talloc_free(key.dptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withIndexing: (struct indexing_context *) indexing
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
|
|
@ -49,9 +49,32 @@
|
||||||
|
|
||||||
#include <mapistore/mapistore.h>
|
#include <mapistore/mapistore.h>
|
||||||
#include <mapistore/mapistore_errors.h>
|
#include <mapistore/mapistore_errors.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
|
||||||
static Class MAPIStoreContextK = Nil;
|
static Class MAPIStoreContextK = Nil;
|
||||||
static BOOL leakDebugging = NO;
|
static BOOL leakDebugging = NO;
|
||||||
|
static BOOL initialization_done = NO;
|
||||||
|
|
||||||
|
#define NS_CURRENT_THREAD_REGISTER() \
|
||||||
|
BOOL __nsrct_thread_registered = GSRegisterCurrentThread(); \
|
||||||
|
if (!initialization_done) { \
|
||||||
|
DEBUG(5, ("[SOGo: %s:%d] You should call sogo_backend_init() first. Current thread: %p, pid: %d\n", \
|
||||||
|
__FUNCTION__, __LINE__, GSCurrentThread(), getpid())); \
|
||||||
|
}
|
||||||
|
#define NS_CURRENT_THREAD_TRY_UNREGISTER() \
|
||||||
|
if (__nsrct_thread_registered) { \
|
||||||
|
GSUnregisterCurrentThread(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TRYCATCH_START @try {
|
||||||
|
#define TRYCATCH_END(pool) \
|
||||||
|
} @catch (NSException * e) { \
|
||||||
|
enum mapistore_error ret = sogo_backend_handle_objc_exception(e, __PRETTY_FUNCTION__, __LINE__); \
|
||||||
|
[pool release]; \
|
||||||
|
NS_CURRENT_THREAD_TRY_UNREGISTER(); \
|
||||||
|
return ret; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static enum mapistore_error
|
static enum mapistore_error
|
||||||
sogo_backend_unexpected_error()
|
sogo_backend_unexpected_error()
|
||||||
|
@ -61,6 +84,35 @@ sogo_backend_unexpected_error()
|
||||||
return MAPISTORE_SUCCESS;
|
return MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum mapistore_error
|
||||||
|
sogo_backend_handle_objc_exception(NSException *e, const char *fn_name, const int line_no)
|
||||||
|
{
|
||||||
|
NSString *callStackSymbols = nil;
|
||||||
|
if ([e respondsToSelector:@selector(callStackSymbols)])
|
||||||
|
{
|
||||||
|
callStackSymbols = [[e callStackSymbols] componentsJoinedByString:@"\n\t"];
|
||||||
|
}
|
||||||
|
NSLog(@"[SOGo: %s:%d] - EXCEPTION: %@, reason: %@, backtrace: \n\t%@\n",
|
||||||
|
fn_name, line_no, [e name], [e reason], callStackSymbols);
|
||||||
|
|
||||||
|
// Another point of view on the stack trace
|
||||||
|
{
|
||||||
|
void *frames[128];
|
||||||
|
int i, len = backtrace(frames, 128);
|
||||||
|
char **symbols = backtrace_symbols(frames, len);
|
||||||
|
NSLog(@"Backtrace using execinfo.h:\n");
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
NSLog(@"\t%s", symbols[i]);
|
||||||
|
free(symbols);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([[e name] isEqual:@"NotImplementedException"])
|
||||||
|
{
|
||||||
|
return MAPISTORE_ERR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
return MAPISTORE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sogo_backend_atexit (void)
|
sogo_backend_atexit (void)
|
||||||
{
|
{
|
||||||
|
@ -73,6 +125,7 @@ sogo_backend_atexit (void)
|
||||||
GSUnregisterCurrentThread ();
|
GSUnregisterCurrentThread ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\details Initialize sogo mapistore backend
|
\details Initialize sogo mapistore backend
|
||||||
|
|
||||||
|
@ -88,7 +141,13 @@ sogo_backend_init (void)
|
||||||
SoProductRegistry *registry;
|
SoProductRegistry *registry;
|
||||||
char *argv[] = { SAMBA_PREFIX "/sbin/samba", NULL };
|
char *argv[] = { SAMBA_PREFIX "/sbin/samba", NULL };
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
GSRegisterCurrentThread();
|
||||||
|
|
||||||
|
if (initialization_done) {
|
||||||
|
DEBUG(0, ("SOGo backend already initialized.\n"));
|
||||||
|
return MAPISTORE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
/* Here we work around a bug in GNUstep which decodes XML user
|
/* Here we work around a bug in GNUstep which decodes XML user
|
||||||
|
@ -130,6 +189,9 @@ sogo_backend_init (void)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
|
DEBUG(0, ("[SOGo: %s:%d] backend init SUCCESS. Current thread: %p, pid: %d\n", __FUNCTION__, __LINE__, GSCurrentThread(), getpid()));
|
||||||
|
initialization_done = YES;
|
||||||
|
|
||||||
return MAPISTORE_SUCCESS;
|
return MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +206,7 @@ sogo_backend_init (void)
|
||||||
static enum mapistore_error
|
static enum mapistore_error
|
||||||
sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
||||||
struct mapistore_connection_info *conn_info,
|
struct mapistore_connection_info *conn_info,
|
||||||
struct tdb_wrap *indexingTdb,
|
struct indexing_context *indexing,
|
||||||
const char *uri, void **context_object)
|
const char *uri, void **context_object)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
@ -153,23 +215,25 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
||||||
|
|
||||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
if (MAPIStoreContextK)
|
if (MAPIStoreContextK)
|
||||||
{
|
{
|
||||||
|
TRYCATCH_START
|
||||||
rc = [MAPIStoreContextK openContext: &context
|
rc = [MAPIStoreContextK openContext: &context
|
||||||
withURI: uri
|
withURI: uri
|
||||||
connectionInfo: conn_info
|
connectionInfo: conn_info
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*context_object = [context tallocWrapper: mem_ctx];
|
*context_object = [context tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = MAPISTORE_ERROR;
|
rc = MAPISTORE_ERROR;
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +242,7 @@ static enum mapistore_error
|
||||||
sogo_backend_create_root_folder (const char *username,
|
sogo_backend_create_root_folder (const char *username,
|
||||||
enum mapistore_context_role role,
|
enum mapistore_context_role role,
|
||||||
uint64_t fid, const char *name,
|
uint64_t fid, const char *name,
|
||||||
// struct tdb_wrap *indexingTdb,
|
// struct indexing_context *indexing,
|
||||||
TALLOC_CTX *mem_ctx, char **mapistore_urip)
|
TALLOC_CTX *mem_ctx, char **mapistore_urip)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
@ -188,11 +252,12 @@ sogo_backend_create_root_folder (const char *username,
|
||||||
|
|
||||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
if (MAPIStoreContextK)
|
if (MAPIStoreContextK)
|
||||||
{
|
{
|
||||||
|
TRYCATCH_START
|
||||||
userName = [NSString stringWithUTF8String: username];
|
userName = [NSString stringWithUTF8String: username];
|
||||||
folderName = [NSString stringWithUTF8String: name];
|
folderName = [NSString stringWithUTF8String: name];
|
||||||
rc = [MAPIStoreContextK createRootFolder: &mapistoreUri
|
rc = [MAPIStoreContextK createRootFolder: &mapistoreUri
|
||||||
|
@ -202,18 +267,19 @@ sogo_backend_create_root_folder (const char *username,
|
||||||
withRole: role];
|
withRole: role];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*mapistore_urip = [mapistoreUri asUnicodeInMemCtx: mem_ctx];
|
*mapistore_urip = [mapistoreUri asUnicodeInMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = MAPISTORE_ERROR;
|
rc = MAPISTORE_ERROR;
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum mapistore_error
|
static enum mapistore_error
|
||||||
sogo_backend_list_contexts(const char *username, struct tdb_wrap *indexingTdb,
|
sogo_backend_list_contexts(const char *username, struct indexing_context *indexing,
|
||||||
TALLOC_CTX *mem_ctx,
|
TALLOC_CTX *mem_ctx,
|
||||||
struct mapistore_contexts_list **contexts_listp)
|
struct mapistore_contexts_list **contexts_listp)
|
||||||
{
|
{
|
||||||
|
@ -223,22 +289,24 @@ sogo_backend_list_contexts(const char *username, struct tdb_wrap *indexingTdb,
|
||||||
|
|
||||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
if (MAPIStoreContextK)
|
if (MAPIStoreContextK)
|
||||||
{
|
{
|
||||||
|
TRYCATCH_START
|
||||||
userName = [NSString stringWithUTF8String: username];
|
userName = [NSString stringWithUTF8String: username];
|
||||||
*contexts_listp = [MAPIStoreContextK listAllContextsForUser: userName
|
*contexts_listp = [MAPIStoreContextK listAllContextsForUser: userName
|
||||||
withTDBIndexing: indexingTdb
|
withIndexing: indexing
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
|
TRYCATCH_END(pool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = MAPISTORE_ERROR;
|
rc = MAPISTORE_ERROR;
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -273,11 +341,15 @@ sogo_context_get_path(void *backend_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = backend_object;
|
wrapper = backend_object;
|
||||||
context = wrapper->instance;
|
context = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [context getPath: path ofFMID: fmid inMemCtx: mem_ctx];
|
rc = [context getPath: path ofFMID: fmid inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -303,13 +375,17 @@ sogo_context_get_root_folder(void *backend_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = backend_object;
|
wrapper = backend_object;
|
||||||
context = wrapper->instance;
|
context = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [context getRootFolder: &folder withFID: fid];
|
rc = [context getRootFolder: &folder withFID: fid];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*folder_object = [folder tallocWrapper: mem_ctx];
|
*folder_object = [folder tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -342,14 +418,18 @@ sogo_folder_open_folder(void *folder_object, TALLOC_CTX *mem_ctx, uint64_t fid,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder openFolder: &childFolder withFID: fid];
|
rc = [folder openFolder: &childFolder withFID: fid];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*childfolder_object = [childFolder tallocWrapper: mem_ctx];
|
*childfolder_object = [childFolder tallocWrapper: mem_ctx];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -382,13 +462,17 @@ sogo_folder_create_folder(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder createFolder: &childFolder withRow: aRow andFID: fid];
|
rc = [folder createFolder: &childFolder withRow: aRow andFID: fid];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*childfolder_object = [childFolder tallocWrapper: mem_ctx];
|
*childfolder_object = [childFolder tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -421,11 +505,15 @@ sogo_folder_delete(void *folder_object)
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder deleteFolder];
|
rc = [folder deleteFolder];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -449,11 +537,15 @@ sogo_folder_get_child_count(void *folder_object, enum mapistore_table_type table
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder getChildCount: child_count ofTableType: table_type];
|
rc = [folder getChildCount: child_count ofTableType: table_type];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -481,16 +573,20 @@ sogo_folder_open_message(void *folder_object,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder openMessage: &message
|
rc = [folder openMessage: &message
|
||||||
withMID: mid
|
withMID: mid
|
||||||
forWriting: write_access
|
forWriting: write_access
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*message_object = [message tallocWrapper: mem_ctx];
|
*message_object = [message tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -519,15 +615,19 @@ sogo_folder_create_message(void *folder_object,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder createMessage: &message
|
rc = [folder createMessage: &message
|
||||||
withMID: mid
|
withMID: mid
|
||||||
isAssociated: associated];
|
isAssociated: associated];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*message_object = [message tallocWrapper: mem_ctx];
|
*message_object = [message tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -551,11 +651,15 @@ sogo_folder_delete_message(void *folder_object, uint64_t mid, uint8_t flags)
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder deleteMessageWithMID: mid andFlags: flags];
|
rc = [folder deleteMessageWithMID: mid andFlags: flags];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -589,8 +693,10 @@ sogo_folder_move_copy_messages(void *folder_object,
|
||||||
wrapper = source_folder_object;
|
wrapper = source_folder_object;
|
||||||
sourceFolder = wrapper->instance;
|
sourceFolder = wrapper->instance;
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [targetFolder moveCopyMessagesWithMIDs: src_mids
|
rc = [targetFolder moveCopyMessagesWithMIDs: src_mids
|
||||||
andCount: mid_count
|
andCount: mid_count
|
||||||
fromFolder: sourceFolder
|
fromFolder: sourceFolder
|
||||||
|
@ -598,8 +704,10 @@ sogo_folder_move_copy_messages(void *folder_object,
|
||||||
andChangeKeys: target_change_keys
|
andChangeKeys: target_change_keys
|
||||||
wantCopy: want_copy
|
wantCopy: want_copy
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -632,7 +740,7 @@ sogo_folder_move_folder(void *folder_object, void *target_folder_object,
|
||||||
else
|
else
|
||||||
targetFolder = nil;
|
targetFolder = nil;
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
if (new_folder_name)
|
if (new_folder_name)
|
||||||
|
@ -640,14 +748,16 @@ sogo_folder_move_folder(void *folder_object, void *target_folder_object,
|
||||||
else
|
else
|
||||||
newFolderName = nil;
|
newFolderName = nil;
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [moveFolder moveCopyToFolder: targetFolder
|
rc = [moveFolder moveCopyToFolder: targetFolder
|
||||||
withNewName: newFolderName
|
withNewName: newFolderName
|
||||||
isMove: YES
|
isMove: YES
|
||||||
isRecursive: YES
|
isRecursive: YES
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -677,19 +787,21 @@ sogo_folder_copy_folder(void *folder_object, void *target_folder_object, TALLOC_
|
||||||
wrapper = target_folder_object;
|
wrapper = target_folder_object;
|
||||||
targetFolder = wrapper->instance;
|
targetFolder = wrapper->instance;
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
newFolderName = [NSString stringWithUTF8String: new_folder_name];
|
newFolderName = [NSString stringWithUTF8String: new_folder_name];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [copyFolder moveCopyToFolder: targetFolder
|
rc = [copyFolder moveCopyToFolder: targetFolder
|
||||||
withNewName: newFolderName
|
withNewName: newFolderName
|
||||||
isMove: NO
|
isMove: NO
|
||||||
isRecursive: recursive
|
isRecursive: recursive
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -715,15 +827,19 @@ sogo_folder_get_deleted_fmids(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder getDeletedFMIDs: fmidsp
|
rc = [folder getDeletedFMIDs: fmidsp
|
||||||
andCN: cnp
|
andCN: cnp
|
||||||
fromChangeNumber: change_num
|
fromChangeNumber: change_num
|
||||||
inTableType: table_type
|
inTableType: table_type
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -750,16 +866,20 @@ sogo_folder_open_table(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder getTable: &table
|
rc = [folder getTable: &table
|
||||||
andRowCount: row_count
|
andRowCount: row_count
|
||||||
tableType: table_type
|
tableType: table_type
|
||||||
andHandleId: handle_id];
|
andHandleId: handle_id];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*table_object = [table tallocWrapper: mem_ctx];
|
*table_object = [table tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -785,13 +905,17 @@ sogo_folder_modify_permissions(void *folder_object, uint8_t flags,
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder modifyPermissions: permissions
|
rc = [folder modifyPermissions: permissions
|
||||||
withCount: pcount
|
withCount: pcount
|
||||||
andFlags: flags];
|
andFlags: flags];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -815,12 +939,16 @@ sogo_folder_preload_message_bodies(void *folder_object, enum mapistore_table_typ
|
||||||
{
|
{
|
||||||
wrapper = folder_object;
|
wrapper = folder_object;
|
||||||
folder = wrapper->instance;
|
folder = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [folder preloadMessageBodiesWithMIDs: mids
|
rc = [folder preloadMessageBodiesWithMIDs: mids
|
||||||
ofTableType: table_type];
|
ofTableType: table_type];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -846,12 +974,16 @@ sogo_message_get_message_data(void *message_object,
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
[message getMessageData: msg_dataP
|
[message getMessageData: msg_dataP
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -877,14 +1009,18 @@ sogo_message_create_attachment (void *message_object, TALLOC_CTX *mem_ctx, void
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message createAttachment: &attachment inAID: aidp];
|
rc = [message createAttachment: &attachment inAID: aidp];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*attachment_object = [attachment tallocWrapper: mem_ctx];
|
*attachment_object = [attachment tallocWrapper: mem_ctx];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -910,14 +1046,18 @@ sogo_message_open_attachment (void *message_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message getAttachment: &attachment withAID: aid];
|
rc = [message getAttachment: &attachment withAID: aid];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*attachment_object = [attachment tallocWrapper: mem_ctx];
|
*attachment_object = [attachment tallocWrapper: mem_ctx];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -942,15 +1082,19 @@ sogo_message_get_attachment_table (void *message_object, TALLOC_CTX *mem_ctx, vo
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message getAttachmentTable: &table
|
rc = [message getAttachmentTable: &table
|
||||||
andRowCount: row_count];
|
andRowCount: row_count];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*table_object = [table tallocWrapper: mem_ctx];
|
*table_object = [table tallocWrapper: mem_ctx];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -977,14 +1121,18 @@ sogo_message_modify_recipients (void *message_object,
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message modifyRecipientsWithRecipients: recipients
|
rc = [message modifyRecipientsWithRecipients: recipients
|
||||||
andCount: count
|
andCount: count
|
||||||
andColumns: columns];
|
andColumns: columns];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1008,12 +1156,16 @@ sogo_message_set_read_flag (void *message_object, uint8_t flag)
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message setReadFlag: flag];
|
rc = [message setReadFlag: flag];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1037,12 +1189,16 @@ sogo_message_save (void *message_object, TALLOC_CTX *mem_ctx)
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message saveMessage: mem_ctx];
|
rc = [message saveMessage: mem_ctx];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1066,12 +1222,16 @@ sogo_message_submit (void *message_object, enum SubmitFlags flags)
|
||||||
{
|
{
|
||||||
wrapper = message_object;
|
wrapper = message_object;
|
||||||
message = wrapper->instance;
|
message = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [message submitWithFlags: flags];
|
rc = [message submitWithFlags: flags];
|
||||||
// [context tearDownRequest];
|
// [context tearDownRequest];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1100,16 +1260,20 @@ sogo_message_attachment_open_embedded_message (void *attachment_object,
|
||||||
{
|
{
|
||||||
wrapper = attachment_object;
|
wrapper = attachment_object;
|
||||||
attachment = wrapper->instance;
|
attachment = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [attachment openEmbeddedMessage: &message
|
rc = [attachment openEmbeddedMessage: &message
|
||||||
withMID: midP
|
withMID: midP
|
||||||
withMAPIStoreMsg: msg
|
withMAPIStoreMsg: msg
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
*message_object = [message tallocWrapper: mem_ctx];
|
*message_object = [message tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1137,15 +1301,19 @@ sogo_message_attachment_create_embedded_message (void *attachment_object,
|
||||||
{
|
{
|
||||||
wrapper = attachment_object;
|
wrapper = attachment_object;
|
||||||
attachment = wrapper->instance;
|
attachment = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
rc = [attachment createEmbeddedMessage: &message
|
|
||||||
withMAPIStoreMsg: msg
|
TRYCATCH_START
|
||||||
inMemCtx: mem_ctx];
|
rc = [attachment createEmbeddedMessage: &message
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
withMAPIStoreMsg: msg
|
||||||
*message_object = [message tallocWrapper: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
|
*message_object = [message tallocWrapper: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1169,11 +1337,15 @@ static enum mapistore_error sogo_table_get_available_properties(void *table_obje
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [table getAvailableProperties: propertiesP inMemCtx: mem_ctx];
|
rc = [table getAvailableProperties: propertiesP inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1197,12 +1369,16 @@ sogo_table_set_columns (void *table_object, uint16_t count, enum MAPITAGS *prope
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [table setColumns: properties
|
rc = [table setColumns: properties
|
||||||
withCount: count];
|
withCount: count];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1226,14 +1402,18 @@ sogo_table_set_restrictions (void *table_object, struct mapi_SRestriction *restr
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
[table setRestrictions: restrictions];
|
[table setRestrictions: restrictions];
|
||||||
//[table cleanupCaches];
|
//[table cleanupCaches];
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
*table_status = TBLSTAT_COMPLETE;
|
*table_status = TBLSTAT_COMPLETE;
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1257,14 +1437,18 @@ sogo_table_set_sort_order (void *table_object, struct SSortOrderSet *sort_order,
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
[table setSortOrder: sort_order];
|
[table setSortOrder: sort_order];
|
||||||
[table cleanupCaches];
|
[table cleanupCaches];
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
*table_status = TBLSTAT_COMPLETE;
|
*table_status = TBLSTAT_COMPLETE;
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1290,12 +1474,16 @@ sogo_table_get_row (void *table_object, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [table getRow: data withRowID: row_id andQueryType: query_type
|
rc = [table getRow: data withRowID: row_id andQueryType: query_type
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1321,12 +1509,16 @@ sogo_table_get_row_count (void *table_object,
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [table getRowCount: row_countp
|
rc = [table getRowCount: row_countp
|
||||||
withQueryType: query_type];
|
withQueryType: query_type];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1350,11 +1542,15 @@ sogo_table_handle_destructor (void *table_object, uint32_t handle_id)
|
||||||
{
|
{
|
||||||
wrapper = table_object;
|
wrapper = table_object;
|
||||||
table = wrapper->instance;
|
table = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
[table destroyHandle: handle_id];
|
[table destroyHandle: handle_id];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1380,11 +1576,15 @@ static enum mapistore_error sogo_properties_get_available_properties(void *objec
|
||||||
{
|
{
|
||||||
wrapper = object;
|
wrapper = object;
|
||||||
propObject = wrapper->instance;
|
propObject = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [propObject getAvailableProperties: propertiesP inMemCtx: mem_ctx];
|
rc = [propObject getAvailableProperties: propertiesP inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1411,13 +1611,17 @@ sogo_properties_get_properties (void *object,
|
||||||
{
|
{
|
||||||
wrapper = object;
|
wrapper = object;
|
||||||
propObject = wrapper->instance;
|
propObject = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [propObject getProperties: data withTags: properties
|
rc = [propObject getProperties: data withTags: properties
|
||||||
andCount: count
|
andCount: count
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1441,11 +1645,15 @@ sogo_properties_set_properties (void *object, struct SRow *aRow)
|
||||||
{
|
{
|
||||||
wrapper = object;
|
wrapper = object;
|
||||||
propObject = wrapper->instance;
|
propObject = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
rc = [propObject addPropertiesFromRow: aRow];
|
rc = [propObject addPropertiesFromRow: aRow];
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1472,9 +1680,10 @@ sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||||
|
|
||||||
/* This fixes a crash occurring during the instantiation of the
|
/* This fixes a crash occurring during the instantiation of the
|
||||||
NSAutoreleasePool below. */
|
NSAutoreleasePool below. */
|
||||||
GSRegisterCurrentThread ();
|
NS_CURRENT_THREAD_REGISTER();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
TRYCATCH_START
|
||||||
// printf("rootURI = %s\n", rootURI);
|
// printf("rootURI = %s\n", rootURI);
|
||||||
if (rootURI)
|
if (rootURI)
|
||||||
partialURLString = [NSString stringWithUTF8String: rootURI];
|
partialURLString = [NSString stringWithUTF8String: rootURI];
|
||||||
|
@ -1494,9 +1703,10 @@ sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||||
|
|
||||||
// printf("uri = %s\n", [partialURLString UTF8String]);
|
// printf("uri = %s\n", [partialURLString UTF8String]);
|
||||||
*uri = talloc_strdup (mem_ctx, [partialURLString UTF8String]);
|
*uri = talloc_strdup (mem_ctx, [partialURLString UTF8String]);
|
||||||
|
TRYCATCH_END(pool)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||||
|
|
||||||
return MAPISTORE_SUCCESS;
|
return MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,10 +63,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) userContextWithUsername: (NSString *) username
|
+ (id) userContextWithUsername: (NSString *) username
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
andTDBIndexing: (struct indexing_context *) indexing;
|
||||||
|
|
||||||
- (id) initWithUsername: (NSString *) newUsername
|
- (id) initWithUsername: (NSString *) newUsername
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
andTDBIndexing: (struct indexing_context *) indexing;
|
||||||
|
|
||||||
- (NSString *) username;
|
- (NSString *) username;
|
||||||
- (SOGoUser *) sogoUser;
|
- (SOGoUser *) sogoUser;
|
||||||
|
|
|
@ -60,7 +60,7 @@ static NSMapTable *contextsTable = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) userContextWithUsername: (NSString *) username
|
+ (id) userContextWithUsername: (NSString *) username
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
andTDBIndexing: (struct indexing_context *) indexing;
|
||||||
{
|
{
|
||||||
id userContext;
|
id userContext;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ static NSMapTable *contextsTable = nil;
|
||||||
if (!userContext)
|
if (!userContext)
|
||||||
{
|
{
|
||||||
userContext = [[self alloc] initWithUsername: username
|
userContext = [[self alloc] initWithUsername: username
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexing];
|
||||||
[userContext autorelease];
|
[userContext autorelease];
|
||||||
[contextsTable setObject: userContext forKey: username];
|
[contextsTable setObject: userContext forKey: username];
|
||||||
}
|
}
|
||||||
|
@ -100,16 +100,12 @@ static NSMapTable *contextsTable = nil;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) _readUserPassword: (NSString *) newUsername
|
- (NSString *) _readPasswordFile: (NSString *) path
|
||||||
{
|
{
|
||||||
NSString *password, *path;
|
NSString *password;
|
||||||
NSData *content;
|
NSData *content;
|
||||||
|
|
||||||
password = nil;
|
|
||||||
|
|
||||||
path = [NSString stringWithFormat: SAMBA_PRIVATE_DIR
|
|
||||||
@"/mapistore/%@/password", newUsername];
|
|
||||||
|
|
||||||
|
password = nil;
|
||||||
content = [NSData dataWithContentsOfFile: path];
|
content = [NSData dataWithContentsOfFile: path];
|
||||||
|
|
||||||
if (content)
|
if (content)
|
||||||
|
@ -124,8 +120,26 @@ static NSMapTable *contextsTable = nil;
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) _readUserPassword: (NSString *) newUsername
|
||||||
|
{
|
||||||
|
NSString *password, *path;
|
||||||
|
|
||||||
|
path = [NSString stringWithFormat: SAMBA_PRIVATE_DIR
|
||||||
|
@"/mapistore/%@/password", newUsername];
|
||||||
|
|
||||||
|
password = [self _readPasswordFile: path];
|
||||||
|
if (password == nil)
|
||||||
|
{
|
||||||
|
// Try to get master password
|
||||||
|
path = [NSString stringWithFormat: SAMBA_PRIVATE_DIR @"/mapistore/master.password"];
|
||||||
|
password = [self _readPasswordFile: path];
|
||||||
|
}
|
||||||
|
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithUsername: (NSString *) newUsername
|
- (id) initWithUsername: (NSString *) newUsername
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb
|
andTDBIndexing: (struct indexing_context *) indexing
|
||||||
{
|
{
|
||||||
NSString *userPassword;
|
NSString *userPassword;
|
||||||
|
|
||||||
|
@ -133,9 +147,9 @@ static NSMapTable *contextsTable = nil;
|
||||||
{
|
{
|
||||||
/* "username" will be retained by table */
|
/* "username" will be retained by table */
|
||||||
username = newUsername;
|
username = newUsername;
|
||||||
if (indexingTdb)
|
if (indexing)
|
||||||
ASSIGN (mapping, [MAPIStoreMapping mappingForUsername: username
|
ASSIGN (mapping, [MAPIStoreMapping mappingForUsername: username
|
||||||
withIndexing: indexingTdb]);
|
withIndexing: indexing]);
|
||||||
|
|
||||||
authenticator = [MAPIStoreAuthenticator new];
|
authenticator = [MAPIStoreAuthenticator new];
|
||||||
[authenticator setUsername: username];
|
[authenticator setUsername: username];
|
||||||
|
|
|
@ -47,13 +47,13 @@ MAPIStoreTallocWrapperDestroy (void *data)
|
||||||
struct MAPIStoreTallocWrapper *wrapper;
|
struct MAPIStoreTallocWrapper *wrapper;
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
GSRegisterCurrentThread ();
|
// GSRegisterCurrentThread ();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
wrapper = data;
|
wrapper = data;
|
||||||
//NSLog (@"destroying wrapped object (wrapper: %p; object: %p (%@))...\n", wrapper, wrapper->instance, NSStringFromClass([wrapper->instance class]));
|
//NSLog (@"destroying wrapped object (wrapper: %p; object: %p (%@))...\n", wrapper, wrapper->instance, NSStringFromClass([wrapper->instance class]));
|
||||||
[wrapper->instance release];
|
[wrapper->instance release];
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
// GSUnregisterCurrentThread ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* dbmsgdump.m - this file is part of SOGo
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Kamen Mazdrashki <kmazdrashki@zentyal.com>
|
||||||
|
*
|
||||||
|
* Based on implementation done by 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 3, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A format-agnostic dump extensions for:
|
||||||
|
* NSArray
|
||||||
|
* NSObject
|
||||||
|
* NSDictionary
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NSOBJECT_PROPERTYLIST_H
|
||||||
|
#define NSOBJECT_PROPERTYLIST_H
|
||||||
|
|
||||||
|
#import <Foundation/NSObject.h>
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
|
#import <Foundation/NSDictionary.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSObject (plext)
|
||||||
|
|
||||||
|
- (void) displayWithIndentation: (NSInteger) anInt;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSDictionary (plext)
|
||||||
|
|
||||||
|
- (void) displayKey: (NSString *) key
|
||||||
|
withIndentation: (NSInteger) anInt;
|
||||||
|
|
||||||
|
- (void) displayWithIndentation: (NSInteger) anInt;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSArray (plext)
|
||||||
|
|
||||||
|
- (void) displayCount: (NSUInteger) count
|
||||||
|
withIndentation: (NSInteger) anInt;
|
||||||
|
|
||||||
|
- (void) displayWithIndentation: (NSInteger) anInt;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* NSOBJECT_PROPERTYLIST_H */
|
|
@ -32,14 +32,10 @@
|
||||||
#import <NGExtensions/NSNull+misc.h>
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
|
|
||||||
#import <SOGo/BSONCodec.h>
|
#import <SOGo/BSONCodec.h>
|
||||||
|
#import "NSObject+PropertyList.h"
|
||||||
|
|
||||||
const char *indentationStep = " ";
|
const char *indentationStep = " ";
|
||||||
|
|
||||||
@interface NSObject (plext)
|
|
||||||
|
|
||||||
- (void) displayWithIndentation: (NSInteger) anInt;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation NSObject (plext)
|
@implementation NSObject (plext)
|
||||||
|
|
||||||
|
@ -139,46 +135,3 @@ const char *indentationStep = " ";
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static void
|
|
||||||
OCDumpPListData (NSData *content)
|
|
||||||
{
|
|
||||||
//NSDictionary *d;
|
|
||||||
//NSPropertyListFormat format;
|
|
||||||
//NSString *error = nil;
|
|
||||||
//const char *formatName;
|
|
||||||
|
|
||||||
//d = [NSPropertyListSerialization propertyListFromData: content
|
|
||||||
// mutabilityOption: NSPropertyListImmutable
|
|
||||||
// format: &format
|
|
||||||
// errorDescription: &error];
|
|
||||||
//d = [content BSONValue];
|
|
||||||
|
|
||||||
// if (d)
|
|
||||||
// {
|
|
||||||
// switch (format)
|
|
||||||
// {
|
|
||||||
// case NSPropertyListOpenStepFormat:
|
|
||||||
// formatName = "OpenStep";
|
|
||||||
// break;
|
|
||||||
// case NSPropertyListXMLFormat_v1_0:
|
|
||||||
// formatName = "XML";
|
|
||||||
// break;
|
|
||||||
// case NSPropertyListBinaryFormat_v1_0:
|
|
||||||
// formatName = "Binary";
|
|
||||||
// break;
|
|
||||||
// case NSPropertyListGNUstepFormat:
|
|
||||||
// formatName = "GNUstep";
|
|
||||||
// break;
|
|
||||||
// case NSPropertyListGNUstepBinaryFormat:
|
|
||||||
// formatName = "GNUstep binary";
|
|
||||||
// break;
|
|
||||||
// default: formatName = "unknown";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// printf ("File format is: %s\n", formatName);
|
|
||||||
// [d displayWithIndentation: 0];
|
|
||||||
// printf ("\n");
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// printf ("an error occurred: %s\n", [error UTF8String]);
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,10 +36,20 @@
|
||||||
#import "MAPIStoreUserContext.h"
|
#import "MAPIStoreUserContext.h"
|
||||||
#import <SOGo/SOGoCacheGCSObject.h>
|
#import <SOGo/SOGoCacheGCSObject.h>
|
||||||
|
|
||||||
#import "NSObject+PropertyList.m"
|
#import <SOGo/BSONCodec.h>
|
||||||
|
#import "NSObject+PropertyList.h"
|
||||||
|
|
||||||
Class MAPIStoreUserContextK, SOGoMAPIDBObjectK;
|
Class MAPIStoreUserContextK, SOGoMAPIDBObjectK;
|
||||||
|
|
||||||
|
static void
|
||||||
|
DumpBSONData(NSData *data)
|
||||||
|
{
|
||||||
|
NSDictionary *dvalue;
|
||||||
|
dvalue = [data BSONValue];
|
||||||
|
[dvalue displayWithIndentation:0];
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DbDumpObject (NSString *username, NSString *path)
|
DbDumpObject (NSString *username, NSString *path)
|
||||||
{
|
{
|
||||||
|
@ -55,8 +65,9 @@ DbDumpObject (NSString *username, NSString *path)
|
||||||
record = [dbobject lookupRecord: path newerThanVersion: -1];
|
record = [dbobject lookupRecord: path newerThanVersion: -1];
|
||||||
if (record)
|
if (record)
|
||||||
{
|
{
|
||||||
|
printf("record found: %p\n", record);
|
||||||
content = [[record objectForKey: @"c_content"] dataByDecodingBase64];
|
content = [[record objectForKey: @"c_content"] dataByDecodingBase64];
|
||||||
OCDumpPListData (content);
|
DumpBSONData(content);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog (@"record not found");
|
NSLog (@"record not found");
|
||||||
|
@ -99,9 +110,12 @@ int main (int argc, char *argv[], char *envp[])
|
||||||
SOGoMAPIDBObjectK = NSClassFromString (@"SOGoMAPIDBObject");
|
SOGoMAPIDBObjectK = NSClassFromString (@"SOGoMAPIDBObject");
|
||||||
|
|
||||||
arguments = [[NSProcessInfo processInfo] arguments];
|
arguments = [[NSProcessInfo processInfo] arguments];
|
||||||
if ([arguments count] > 2)
|
if ([arguments count] > 2) {
|
||||||
DbDumpObject ([arguments objectAtIndex: 1],
|
DbDumpObject ([arguments objectAtIndex: 1],
|
||||||
[arguments objectAtIndex: 2]);
|
[arguments objectAtIndex: 2]);
|
||||||
|
} else if ([arguments count] > 1) {
|
||||||
|
DumpBSONData([[arguments objectAtIndex:1] dataByDecodingBase64]);
|
||||||
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,15 @@
|
||||||
[start setTimeZone: tz];
|
[start setTimeZone: tz];
|
||||||
if (isAllDay)
|
if (isAllDay)
|
||||||
{
|
{
|
||||||
|
/* when user TZ is positive (East) all-day events were not
|
||||||
|
shown properly in SOGo UI. This day delay fixes it */
|
||||||
|
tzOffset = [userTimeZone secondsFromGMTForDate: value];
|
||||||
|
if (tzOffset > 0)
|
||||||
|
{
|
||||||
|
value = [value dateByAddingYears: 0 months: 0 days: 1
|
||||||
|
hours: 0 minutes: 0
|
||||||
|
seconds: 0];
|
||||||
|
}
|
||||||
[start setDate: value];
|
[start setDate: value];
|
||||||
[start setTimeZone: nil];
|
[start setTimeZone: nil];
|
||||||
}
|
}
|
||||||
|
@ -251,6 +260,15 @@
|
||||||
[end setTimeZone: tz];
|
[end setTimeZone: tz];
|
||||||
if (isAllDay)
|
if (isAllDay)
|
||||||
{
|
{
|
||||||
|
/* when user TZ is positive (East) all-day events were not
|
||||||
|
shown properly in SOGo UI. This day delay fixes it */
|
||||||
|
tzOffset = [userTimeZone secondsFromGMTForDate: value];
|
||||||
|
if (tzOffset > 0)
|
||||||
|
{
|
||||||
|
value = [value dateByAddingYears: 0 months: 0 days: 1
|
||||||
|
hours: 0 minutes: 0
|
||||||
|
seconds: 0];
|
||||||
|
}
|
||||||
[end setDate: value];
|
[end setDate: value];
|
||||||
[end setTimeZone: nil];
|
[end setTimeZone: nil];
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,50 @@
|
||||||
|
|
||||||
#import "NSObject+PropertyList.m"
|
#import "NSObject+PropertyList.m"
|
||||||
|
|
||||||
|
static void
|
||||||
|
OCDumpPListData (NSData *content)
|
||||||
|
{
|
||||||
|
//NSDictionary *d;
|
||||||
|
//NSPropertyListFormat format;
|
||||||
|
//NSString *error = nil;
|
||||||
|
//const char *formatName;
|
||||||
|
|
||||||
|
//d = [NSPropertyListSerialization propertyListFromData: content
|
||||||
|
// mutabilityOption: NSPropertyListImmutable
|
||||||
|
// format: &format
|
||||||
|
// errorDescription: &error];
|
||||||
|
//d = [content BSONValue];
|
||||||
|
|
||||||
|
// if (d)
|
||||||
|
// {
|
||||||
|
// switch (format)
|
||||||
|
// {
|
||||||
|
// case NSPropertyListOpenStepFormat:
|
||||||
|
// formatName = "OpenStep";
|
||||||
|
// break;
|
||||||
|
// case NSPropertyListXMLFormat_v1_0:
|
||||||
|
// formatName = "XML";
|
||||||
|
// break;
|
||||||
|
// case NSPropertyListBinaryFormat_v1_0:
|
||||||
|
// formatName = "Binary";
|
||||||
|
// break;
|
||||||
|
// case NSPropertyListGNUstepFormat:
|
||||||
|
// formatName = "GNUstep";
|
||||||
|
// break;
|
||||||
|
// case NSPropertyListGNUstepBinaryFormat:
|
||||||
|
// formatName = "GNUstep binary";
|
||||||
|
// break;
|
||||||
|
// default: formatName = "unknown";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// printf ("File format is: %s\n", formatName);
|
||||||
|
// [d displayWithIndentation: 0];
|
||||||
|
// printf ("\n");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// printf ("an error occurred: %s\n", [error UTF8String]);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PLReaderDumpPListFile (NSString *filename)
|
PLReaderDumpPListFile (NSString *filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,12 +9,14 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from samba.param import LoadParm
|
||||||
|
|
||||||
imaphost = '127.0.0.1'
|
imaphost = '127.0.0.1'
|
||||||
imapport = 143
|
imapport = 143
|
||||||
|
|
||||||
sambaprivate = '/var/lib/samba/private'
|
samba_lp = LoadParm()
|
||||||
mapistorefolder = "%s/mapistore" % (sambaprivate)
|
sambaprivate = samba_lp.get("private dir")
|
||||||
|
mapistorefolder = samba_lp.private_path("mapistore")
|
||||||
sogoSysDefaultsFile = "/etc/sogo/sogo.conf"
|
sogoSysDefaultsFile = "/etc/sogo/sogo.conf"
|
||||||
sogoUserDefaultsFile = os.path.expanduser("~sogo/GNUstep/Defaults/.GNUstepDefaults")
|
sogoUserDefaultsFile = os.path.expanduser("~sogo/GNUstep/Defaults/.GNUstepDefaults")
|
||||||
|
|
||||||
|
@ -212,7 +214,7 @@ On RHEL, install it using 'yum install MySQL-python'"""
|
||||||
c=conn.cursor()
|
c=conn.cursor()
|
||||||
tablename="sogo_cache_folder_%s" % (username)
|
tablename="sogo_cache_folder_%s" % (username)
|
||||||
c.execute("TRUNCATE TABLE %s" % tablename)
|
c.execute("TRUNCATE TABLE %s" % tablename)
|
||||||
print "Table %s emptied"
|
print "Table %s emptied" % tablename
|
||||||
|
|
||||||
|
|
||||||
def postgresqlCleanup(dbhost, dbport, dbuser, dbpass, dbname, username):
|
def postgresqlCleanup(dbhost, dbport, dbuser, dbpass, dbname, username):
|
||||||
|
|
Loading…
Reference in New Issue