Now handle mem context when saving messages and removed useless debugging.

pull/10/head
Ludovic Marcotte 2013-03-13 15:04:11 -04:00
parent 15e082896c
commit 93f9a7273e
25 changed files with 89 additions and 85 deletions

View File

@ -46,12 +46,12 @@
NSDictionary *properties; NSDictionary *properties;
BOOL rc; BOOL rc;
[self logWithFormat: @"evaluating object '%@'", object]; //[self logWithFormat: @"evaluating object '%@'", object];
properties = [object properties]; properties = [object properties];
rc = [self _evaluateSOGoMAPIDBObject: properties]; rc = [self _evaluateSOGoMAPIDBObject: properties];
[self logWithFormat: @" evaluation result: %d", rc]; //[self logWithFormat: @" evaluation result: %d", rc];
return rc; return rc;
} }
@ -150,9 +150,9 @@ typedef BOOL (*EOComparator) (id, SEL, id);
rc = ((isZero && (intValue & mask) == 0) rc = ((isZero && (intValue & mask) == 0)
|| (!isZero && (intValue & mask) != 0)); || (!isZero && (intValue & mask) != 0));
[self logWithFormat: @"evaluation of bitmask qualifier:" //[self logWithFormat: @"evaluation of bitmask qualifier:"
@" (%.8x & %.8x) %s 0: %d", // @" (%.8x & %.8x) %s 0: %d",
intValue, mask, (isZero ? "==" : "!="), rc]; // intValue, mask, (isZero ? "==" : "!="), rc];
return rc; return rc;
} }

View File

@ -161,7 +161,7 @@
return [self getNo: data inMemCtx: memCtx]; return [self getNo: data inMemCtx: memCtx];
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
// (gdb) po embeddedMessage->properties // (gdb) po embeddedMessage->properties
// 2442592320 = "2012-07-11 22:30:00 +0000"; // 2442592320 = "2012-07-11 22:30:00 +0000";
@ -208,7 +208,8 @@
[[container event] updateFromMAPIProperties: properties [[container event] updateFromMAPIProperties: properties
inUserContext: [self userContext] inUserContext: [self userContext]
withActiveUser: activeUser]; withActiveUser: activeUser
inMemCtx: memCtx];
} }
@end @end

View File

@ -63,7 +63,7 @@
SOGoAppointmentObject *newEntry; SOGoAppointmentObject *newEntry;
NSString *name; NSString *name;
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__]; //[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
name = [NSString stringWithFormat: @"%@.ics", name = [NSString stringWithFormat: @"%@.ics",
[SOGoObject globallyUniqueObjectId]]; [SOGoObject globallyUniqueObjectId]];

View File

@ -200,6 +200,7 @@ static Class NSArrayK;
- (void) dealloc - (void) dealloc
{ {
//NSLog(@"MAPIStoreCalendarMessage: -dealloc (%p)", self);
[calendar release]; [calendar release];
[super dealloc]; [super dealloc];
} }
@ -417,7 +418,7 @@ static Class NSArrayK;
return [self getYes: data inMemCtx: memCtx]; return [self getYes: data inMemCtx: memCtx];
} }
- (NSString *) _uidFromGlobalObjectId - (NSString *) _uidFromGlobalObjectId: (TALLOC_CTX *) memCtx
{ {
NSData *objectId; NSData *objectId;
NSString *uid = nil; NSString *uid = nil;
@ -431,7 +432,7 @@ static Class NSArrayK;
if (objectId) if (objectId)
{ {
length = [objectId length]; length = [objectId length];
bytesDup = talloc_array (NULL, char, length + 1); bytesDup = talloc_array (memCtx, char, length + 1);
memcpy (bytesDup, [objectId bytes], length); memcpy (bytesDup, [objectId bytes], length);
bytesDup[length] = 0; bytesDup[length] = 0;
uidStart = bytesDup + length - 1; uidStart = bytesDup + length - 1;
@ -596,7 +597,7 @@ static Class NSArrayK;
} }
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
// iCalCalendar *vCalendar; // iCalCalendar *vCalendar;
// NSCalendarDate *now; // NSCalendarDate *now;
@ -608,7 +609,7 @@ static Class NSArrayK;
if (isNew) if (isNew)
{ {
uid = [self _uidFromGlobalObjectId]; uid = [self _uidFromGlobalObjectId: memCtx];
if (uid) if (uid)
{ {
/* Hack required because of what's explained in oxocal 3.1.4.7.1: /* Hack required because of what's explained in oxocal 3.1.4.7.1:
@ -650,12 +651,12 @@ static Class NSArrayK;
activeUser = [[self context] activeUser]; activeUser = [[self context] activeUser];
[masterEvent updateFromMAPIProperties: properties [masterEvent updateFromMAPIProperties: properties
inUserContext: [self userContext] inUserContext: [self userContext]
withActiveUser: activeUser]; withActiveUser: activeUser
inMemCtx: memCtx];
[self _updateAttachedEvents]; [self _updateAttachedEvents];
[[self userContext] activateWithUser: activeUser]; [[self userContext] activateWithUser: activeUser];
[sogoObject updateContentWithCalendar: calendar [sogoObject updateContentWithCalendar: calendar
fromRequest: nil]; fromRequest: nil];
[self updateVersions]; [self updateVersions];
} }

View File

@ -224,7 +224,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
NSURL *baseURL; NSURL *baseURL;
int rc = MAPISTORE_ERR_NOT_FOUND; int rc = MAPISTORE_ERR_NOT_FOUND;
NSLog (@"METHOD '%s' (%d) -- uri: '%s'", __FUNCTION__, __LINE__, newUri); //NSLog (@"METHOD '%s' (%d) -- uri: '%s'", __FUNCTION__, __LINE__, newUri);
context = nil; context = nil;
@ -532,8 +532,8 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
mappingId = [mapping idFromURL: childURL]; mappingId = [mapping idFromURL: childURL];
if (mappingId == NSNotFound) if (mappingId == NSNotFound)
{ {
[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); openchangedb_get_new_folderID (connInfo->oc_ctx, &mappingId);
[mapping registerURL: childURL withID: mappingId]; [mapping registerURL: childURL withID: mappingId];
contextId = 0; contextId = 0;

View File

@ -236,7 +236,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
messageKeys = [self messageKeys]; messageKeys = [self messageKeys];
date = [NSCalendarDate date]; date = [NSCalendarDate date];
[self logWithFormat: @"current date: %@", date]; //[self logWithFormat: @"current date: %@", date];
max = [messageKeys count]; max = [messageKeys count];
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
@ -245,7 +245,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
fileDate = [msg lastModificationTime]; fileDate = [msg lastModificationTime];
if ([date laterDate: fileDate] == fileDate) if ([date laterDate: fileDate] == fileDate)
{ {
[self logWithFormat: @"current date: %@", date]; //[self logWithFormat: @"current date: %@", date];
date = fileDate; date = fileDate;
} }

View File

@ -135,7 +135,7 @@
[super addProperties: newNewProperties]; [super addProperties: newNewProperties];
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
uint64_t newVersion; uint64_t newVersion;

View File

@ -65,7 +65,7 @@ static Class MAPIStoreDBMessageK = Nil;
cVersion = exchange_globcnt (([value unsignedLongLongValue] >> 16) cVersion = exchange_globcnt (([value unsignedLongLongValue] >> 16)
& 0x0000ffffffffffffLL); & 0x0000ffffffffffffLL);
version = [NSNumber numberWithUnsignedLongLong: cVersion]; version = [NSNumber numberWithUnsignedLongLong: cVersion];
[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]]; //[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]];
[self logWithFormat: @" version: %.16lx", cVersion]; [self logWithFormat: @" version: %.16lx", cVersion];
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"version" *qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"version"
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo

View File

@ -146,7 +146,7 @@ static Class MAPIStoreAttachmentK;
return ULLONG_MAX; return ULLONG_MAX;
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
} }

View File

@ -51,7 +51,7 @@
return [self getYes: data inMemCtx: memCtx]; return [self getYes: data inMemCtx: memCtx];
} }
- (enum mapistore_error) saveMessage - (enum mapistore_error) saveMessage: (TALLOC_CTX *) memCtx;
{ {
enum mapistore_error rc; enum mapistore_error rc;
MAPIStoreContext *context; MAPIStoreContext *context;
@ -60,7 +60,7 @@
context = [self context]; context = [self context];
ownerUser = [[self userContext] sogoUser]; ownerUser = [[self userContext] sogoUser];
if ([[context activeUser] isEqual: ownerUser]) if ([[context activeUser] isEqual: ownerUser])
rc = [super saveMessage]; rc = [super saveMessage: memCtx];
else else
rc = MAPISTORE_ERR_DENIED; rc = MAPISTORE_ERR_DENIED;

View File

@ -180,7 +180,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
- (void) dealloc - (void) dealloc
{ {
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__]; //[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
// [messageKeys release]; // [messageKeys release];
// [faiMessageKeys release]; // [faiMessageKeys release];
@ -366,7 +366,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
MAPIStoreMapping *mapping; MAPIStoreMapping *mapping;
NSString *childURL; NSString *childURL;
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__]; //[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
mapping = [self mapping]; mapping = [self mapping];
childURL = [mapping urlFromID: fid]; childURL = [mapping urlFromID: fid];
@ -393,7 +393,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
MAPIStoreFolder *childFolder; MAPIStoreFolder *childFolder;
SOGoUser *ownerUser; SOGoUser *ownerUser;
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__]; //[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
ownerUser = [[self userContext] sogoUser]; ownerUser = [[self userContext] sogoUser];
if ([[context activeUser] isEqual: ownerUser] if ([[context activeUser] isEqual: ownerUser]
@ -450,8 +450,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
NSArray *keys; NSArray *keys;
int rc = MAPISTORE_SUCCESS; int rc = MAPISTORE_SUCCESS;
[self logWithFormat: @"METHOD '%s' (%d) -- tableType: %d", //[self logWithFormat: @"METHOD '%s' (%d) -- tableType: %d",
__FUNCTION__, __LINE__, tableType]; //__FUNCTION__, __LINE__, tableType];
if (tableType == MAPISTORE_MESSAGE_TABLE) if (tableType == MAPISTORE_MESSAGE_TABLE)
keys = [self messageKeys]; keys = [self messageKeys];
@ -513,8 +513,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
MAPIStoreMapping *mapping; MAPIStoreMapping *mapping;
SOGoUser *ownerUser; SOGoUser *ownerUser;
[self logWithFormat: @"METHOD '%s' -- mid: 0x%.16llx associated: %d", //[self logWithFormat: @"METHOD '%s' -- mid: 0x%.16llx associated: %d",
__FUNCTION__, mid, isAssociated]; // __FUNCTION__, mid, isAssociated];
context = [self context]; context = [self context];
ownerUser = [[self userContext] sogoUser]; ownerUser = [[self userContext] sogoUser];
@ -699,7 +699,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
if (rc != MAPISTORE_SUCCESS) if (rc != MAPISTORE_SUCCESS)
goto end; goto end;
} }
[destMsg save]; [destMsg save: memCtx];
if (!wantCopy) if (!wantCopy)
rc = [sourceFolder deleteMessageWithMID: srcMid andFlags: 0]; rc = [sourceFolder deleteMessageWithMID: srcMid andFlags: 0];
@ -844,7 +844,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
[mapping registerURL: [targetMessage url] [mapping registerURL: [targetMessage url]
withID: fmid]; withID: fmid];
} }
[targetMessage save]; [targetMessage save: memCtx];
} }
[pool release]; [pool release];
@ -865,7 +865,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
[mapping registerURL: [targetMessage url] [mapping registerURL: [targetMessage url]
withID: fmid]; withID: fmid];
} }
[targetMessage save]; [targetMessage save: memCtx];
} }
[pool release]; [pool release];

View File

@ -92,8 +92,8 @@
value = NSObjectFromMAPISPropValue (&res->lpProp); value = NSObjectFromMAPISPropValue (&res->lpProp);
lastModified = [(MAPIStoreGCSFolder *) lastModified = [(MAPIStoreGCSFolder *)
container lastModifiedFromMessageChangeNumber: value]; container lastModifiedFromMessageChangeNumber: value];
[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]]; //[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]];
[self logWithFormat: @" c_lastmodified: %@", lastModified]; //[self logWithFormat: @" c_lastmodified: %@", lastModified];
if (lastModified) if (lastModified)
{ {
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"c_lastmodified" *qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"c_lastmodified"

View File

@ -390,7 +390,7 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
else else
value = [NSDate date]; value = [NSDate date];
[self logWithFormat: @"lastMessageModificationTime: %@", value]; //[self logWithFormat: @"lastMessageModificationTime: %@", value];
return value; return value;
} }
@ -613,8 +613,8 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
[messageEntry setObject: modseq forKey: @"modseq"]; [messageEntry setObject: modseq forKey: @"modseq"];
[messageEntry setObject: changeNumber forKey: @"version"]; [messageEntry setObject: changeNumber forKey: @"version"];
[self logWithFormat: @"added message entry for uid %@, modseq %@," //[self logWithFormat: @"added message entry for uid %@, modseq %@,"
@" version %@", uid, modseq, changeNumber]; // @" version %@", uid, modseq, changeNumber];
changeKey = [self getReplicaKeyFromGlobCnt: newChangeNum >> 16]; changeKey = [self getReplicaKeyFromGlobCnt: newChangeNum >> 16];
[self _setChangeKey: changeKey forMessageEntry: messageEntry]; [self _setChangeKey: changeKey forMessageEntry: messageEntry];

View File

@ -1576,7 +1576,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
bodySetup = YES; bodySetup = YES;
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
NSNumber *value; NSNumber *value;

View File

@ -120,7 +120,7 @@ static Class MAPIStoreMailMessageK, NSDataK, NSStringK;
case PidLidAppointmentStartWhole: case PidLidAppointmentStartWhole:
case PidLidAppointmentEndWhole: case PidLidAppointmentEndWhole:
case PidLidRecurring: case PidLidRecurring:
[self logWithFormat: @"apt restriction on mail folder?"]; //[self logWithFormat: @"apt restriction on mail folder?"];
rc = MAPIRestrictionStateAlwaysFalse; rc = MAPIRestrictionStateAlwaysFalse;
break; break;
@ -158,8 +158,8 @@ static Class MAPIStoreMailMessageK, NSDataK, NSStringK;
value = [NSString stringWithFormat: @"0x%.16llx", [value unsignedLongLongValue]]; value = [NSString stringWithFormat: @"0x%.16llx", [value unsignedLongLongValue]];
modseq = [(MAPIStoreMailFolder *) modseq = [(MAPIStoreMailFolder *)
container modseqFromMessageChangeNumber: value]; container modseqFromMessageChangeNumber: value];
[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]]; //[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]];
[self logWithFormat: @" modseq: %.16lx", [modseq unsignedLongLongValue]]; //[self logWithFormat: @" modseq: %.16lx", [modseq unsignedLongLongValue]];
if (modseq) if (modseq)
modseq = [NSNumber numberWithUnsignedLongLong: modseq = [NSNumber numberWithUnsignedLongLong:
[modseq unsignedLongLongValue] + 1]; [modseq unsignedLongLongValue] + 1];
@ -317,7 +317,7 @@ static Class MAPIStoreMailMessageK, NSDataK, NSStringK;
ASSIGN (sortOrderings, newSortOrderings); ASSIGN (sortOrderings, newSortOrderings);
else else
ASSIGN (sortOrderings, [NSArray arrayWithObject: @"ARRIVAL"]); ASSIGN (sortOrderings, [NSArray arrayWithObject: @"ARRIVAL"]);
[self logWithFormat: @"new sort orderings: '%@'", sortOrderings]; //[self logWithFormat: @"new sort orderings: '%@'", sortOrderings];
} }
else else
ASSIGN (sortOrderings, [NSArray arrayWithObject: @"ARRIVAL"]); ASSIGN (sortOrderings, [NSArray arrayWithObject: @"ARRIVAL"]);

View File

@ -904,7 +904,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
NSString *folderName, *flag, *newIdString, *messageKey; NSString *folderName, *flag, *newIdString, *messageKey;
NSData *changeKey, *messageData; NSData *changeKey, *messageData;

View File

@ -64,7 +64,7 @@
- (int) getAttachmentTable: (MAPIStoreAttachmentTable **) tablePtr - (int) getAttachmentTable: (MAPIStoreAttachmentTable **) tablePtr
andRowCount: (uint32_t *) countPtr; andRowCount: (uint32_t *) countPtr;
- (int) setReadFlag: (uint8_t) flag; - (int) setReadFlag: (uint8_t) flag;
- (enum mapistore_error) saveMessage; - (enum mapistore_error) saveMessage: (TALLOC_CTX *) memCtx;
- (NSArray *) activeContainerMessageTables; - (NSArray *) activeContainerMessageTables;
@ -74,7 +74,7 @@
- (void) copyToMessage: (MAPIStoreMessage *) newMessage inMemCtx: (TALLOC_CTX *) memCtx; - (void) copyToMessage: (MAPIStoreMessage *) newMessage inMemCtx: (TALLOC_CTX *) memCtx;
/* subclasses */ /* subclasses */
- (void) save; - (void) save: (TALLOC_CTX *) memCtx;
/* attachments (subclasses) */ /* attachments (subclasses) */
- (MAPIStoreAttachment *) createAttachment; - (MAPIStoreAttachment *) createAttachment;

View File

@ -139,7 +139,7 @@ rtf2html (NSData *compressedRTF)
- (id) init - (id) init
{ {
[self logWithFormat: @"METHOD '%s' (%d) (%d)", __FUNCTION__, __LINE__, self]; //[self logWithFormat: @"METHOD '%s' (%d) (%d)", __FUNCTION__, __LINE__, self];
if ((self = [super init])) if ((self = [super init]))
{ {
@ -153,7 +153,7 @@ rtf2html (NSData *compressedRTF)
- (void) dealloc - (void) dealloc
{ {
[self logWithFormat: @"METHOD '%s' (%d) (%d)", __FUNCTION__, __LINE__, self]; //[self logWithFormat: @"METHOD '%s' (%d) (%d)", __FUNCTION__, __LINE__, self];
[activeUserRoles release]; [activeUserRoles release];
[attachmentKeys release]; [attachmentKeys release];
[attachmentParts release]; [attachmentParts release];
@ -260,7 +260,7 @@ rtf2html (NSData *compressedRTF)
struct mapistore_message_recipient *recipient; struct mapistore_message_recipient *recipient;
NSUInteger count; NSUInteger count;
[self logWithFormat: @"METHOD '%s'", __FUNCTION__]; //[self logWithFormat: @"METHOD '%s'", __FUNCTION__];
recipients = [NSMutableDictionary new]; recipients = [NSMutableDictionary new];
recipientProperties = [NSDictionary dictionaryWithObject: recipients recipientProperties = [NSDictionary dictionaryWithObject: recipients
@ -450,7 +450,7 @@ rtf2html (NSData *compressedRTF)
NSString *key; NSString *key;
MAPIStoreAttachment *attachment, *newAttachment; MAPIStoreAttachment *attachment, *newAttachment;
[self logWithFormat: @"METHOD '%s' (%d) (%d)", __FUNCTION__, __LINE__, self]; //[self logWithFormat: @"METHOD '%s' (%d) (%d)", __FUNCTION__, __LINE__, self];
//memCtx = talloc_zero (NULL, TALLOC_CTX); //memCtx = talloc_zero (NULL, TALLOC_CTX);
@ -477,7 +477,7 @@ rtf2html (NSData *compressedRTF)
//talloc_free (memCtx); //talloc_free (memCtx);
} }
- (enum mapistore_error) saveMessage - (enum mapistore_error) saveMessage: (TALLOC_CTX *) memCtx
{ {
enum mapistore_error rc; enum mapistore_error rc;
NSArray *containerTables; NSArray *containerTables;
@ -490,7 +490,7 @@ rtf2html (NSData *compressedRTF)
BOOL userIsOwner; BOOL userIsOwner;
MAPIStoreMessage *mainMessage; MAPIStoreMessage *mainMessage;
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__]; //[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
context = [self context]; context = [self context];
ownerUser = [[self userContext] sogoUser]; ownerUser = [[self userContext] sogoUser];
@ -518,7 +518,7 @@ rtf2html (NSData *compressedRTF)
/* folder modified */ /* folder modified */
notif_parameters notif_parameters
= talloc_zero(NULL, struct mapistore_object_notification_parameters); = talloc_zero(memCtx, struct mapistore_object_notification_parameters);
notif_parameters->object_id = folderId; notif_parameters->object_id = folderId;
if (isNew) if (isNew)
{ {
@ -542,7 +542,7 @@ rtf2html (NSData *compressedRTF)
if (isNew) if (isNew)
{ {
notif_parameters notif_parameters
= talloc_zero(NULL, = talloc_zero(memCtx,
struct mapistore_object_notification_parameters); struct mapistore_object_notification_parameters);
notif_parameters->object_id = [self objectId]; notif_parameters->object_id = [self objectId];
notif_parameters->folder_id = folderId; notif_parameters->folder_id = folderId;
@ -562,7 +562,7 @@ rtf2html (NSData *compressedRTF)
[[containerTables objectAtIndex: count] restrictedChildKeys]; [[containerTables objectAtIndex: count] restrictedChildKeys];
} }
[self save]; [self save: memCtx];
/* We make sure that any change-related properties are removes from the /* We make sure that any change-related properties are removes from the
properties dictionary, to make sure that related methods will be properties dictionary, to make sure that related methods will be
invoked the next time they are requested. */ invoked the next time they are requested. */
@ -937,7 +937,7 @@ rtf2html (NSData *compressedRTF)
return MAPISTORE_ERROR; return MAPISTORE_ERROR;
} }
- (void) save - (void) save: (TALLOC_CTX *) memCtx
{ {
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
} }

View File

@ -68,7 +68,7 @@ sogo_backend_atexit (void)
GSRegisterCurrentThread (); GSRegisterCurrentThread ();
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES)); //NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES));
[pool release]; [pool release];
GSUnregisterCurrentThread (); GSUnregisterCurrentThread ();
} }
@ -1024,7 +1024,7 @@ sogo_message_set_read_flag (void *message_object, uint8_t flag)
} }
static enum mapistore_error static enum mapistore_error
sogo_message_save (void *message_object) sogo_message_save (void *message_object, TALLOC_CTX *mem_ctx)
{ {
struct MAPIStoreTallocWrapper *wrapper; struct MAPIStoreTallocWrapper *wrapper;
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
@ -1039,7 +1039,7 @@ sogo_message_save (void *message_object)
message = wrapper->instance; message = wrapper->instance;
GSRegisterCurrentThread (); GSRegisterCurrentThread ();
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
rc = [message saveMessage]; rc = [message saveMessage: mem_ctx];
// [context tearDownRequest]; // [context tearDownRequest];
[pool release]; [pool release];
GSUnregisterCurrentThread (); GSUnregisterCurrentThread ();

View File

@ -375,12 +375,12 @@ static Class NSDataK, NSStringK;
- (void) setRestrictions: (const struct mapi_SRestriction *) res - (void) setRestrictions: (const struct mapi_SRestriction *) res
{ {
EOQualifier *oldRestriction; //EOQualifier *oldRestriction;
// [self logWithFormat: @"set restriction to (table type: %d): %@", // [self logWithFormat: @"set restriction to (table type: %d): %@",
// type, MAPIStringForRestriction (res)]; // type, MAPIStringForRestriction (res)];
oldRestriction = restriction; //oldRestriction = restriction;
[restriction autorelease]; [restriction autorelease];
if (res) if (res)
restrictionState = [self evaluateRestriction: res restrictionState = [self evaluateRestriction: res
@ -396,11 +396,11 @@ static Class NSDataK, NSStringK;
// FIXME: we should not flush the caches if the restrictions matches // FIXME: we should not flush the caches if the restrictions matches
[self cleanupCaches]; [self cleanupCaches];
if (restriction) //if (restriction)
[self logWithFormat: @"restriction set to EOQualifier: %@", // [self logWithFormat: @"restriction set to EOQualifier: %@",
restriction]; // restriction];
else if (oldRestriction) // else if (oldRestriction)
[self logWithFormat: @"restriction unset (was %@)", oldRestriction]; // [self logWithFormat: @"restriction unset (was %@)", oldRestriction];
} }
- (MAPIRestrictionState) evaluateNotRestriction: (struct mapi_SNotRestriction *) res - (MAPIRestrictionState) evaluateNotRestriction: (struct mapi_SNotRestriction *) res

View File

@ -342,7 +342,8 @@ MAPIStoreDumpMessageProperties (NSDictionary *properties)
{ {
NSNumber *key; NSNumber *key;
NSArray *allKeys; NSArray *allKeys;
NSUInteger keyAsInt, count, max; NSUInteger count, max;
NSUInteger keyAsInt;
id value; id value;
allKeys = [properties allKeys]; allKeys = [properties allKeys];
@ -351,7 +352,7 @@ MAPIStoreDumpMessageProperties (NSDictionary *properties)
NSLog (@"message properties (%d):", max); NSLog (@"message properties (%d):", max);
value = [properties objectForKey: @"recipients"]; value = [properties objectForKey: @"recipients"];
if (value) if (value)
NSLog (@" recipients: %@", value); NSLog (@" recipients: %@", value);
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
@ -363,7 +364,7 @@ MAPIStoreDumpMessageProperties (NSDictionary *properties)
value = [properties objectForKey: key]; value = [properties objectForKey: key];
NSLog (@" 0x%.4x: %@ (%@)", NSLog (@" 0x%.4x: %@ (%@)",
keyAsInt, value, keyAsInt, value,
NSStringFromClass ([value class])); NSStringFromClass ([value class]));
} }
} }
} }

View File

@ -50,8 +50,7 @@ MAPIStoreTallocWrapperDestroy (void *data)
GSRegisterCurrentThread (); GSRegisterCurrentThread ();
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
wrapper = data; wrapper = data;
//NSLog (@"destroying wrapped object (wrapper: %p; object: %p)...\n", wrapper, wrapper->MAPIStoreSOGoObject); //NSLog (@"destroying wrapped object (wrapper: %p; object: %p (%@))...\n", wrapper, wrapper->instance, NSStringFromClass([wrapper->instance class]));
NSLog (@"destroying wrapped object (wrapper: %p)", wrapper);
[wrapper->instance release]; [wrapper->instance release];
[pool release]; [pool release];
GSUnregisterCurrentThread (); GSUnregisterCurrentThread ();
@ -67,8 +66,7 @@ MAPIStoreTallocWrapperDestroy (void *data)
talloc_set_destructor ((void *) wrapper, MAPIStoreTallocWrapperDestroy); talloc_set_destructor ((void *) wrapper, MAPIStoreTallocWrapperDestroy);
wrapper->instance = self; wrapper->instance = self;
[self retain]; [self retain];
NSLog (@"returning wrapper: %p; object: %p", wrapper, self); //NSLog (@"returning wrapper: %p; object: %p (%@)", wrapper, self, NSStringFromClass([self class]));
return wrapper; return wrapper;
} }

View File

@ -251,13 +251,13 @@ static EOAttribute *textColumn = nil;
className = @"MAPIStoreNotesMessage"; className = @"MAPIStoreNotesMessage";
else else
className = @"MAPIStoreDBMessage"; className = @"MAPIStoreDBMessage";
[self logWithFormat: @"PidTagMessageClass = '%@', returning '%@'", //[self logWithFormat: @"PidTagMessageClass = '%@', returning '%@'",
mapiMsgClass, className]; // mapiMsgClass, className];
} }
else else
{ {
[self warnWithFormat: @"PidTagMessageClass is not set, falling back" //[self warnWithFormat: @"PidTagMessageClass is not set, falling back"
@" to 'MAPIStoreDBMessage'"]; // @" to 'MAPIStoreDBMessage'"];
className = @"MAPIStoreDBMessage"; className = @"MAPIStoreDBMessage";
} }
break; break;

View File

@ -23,6 +23,8 @@
#ifndef ICALEVENT_MAPISTORE_H #ifndef ICALEVENT_MAPISTORE_H
#define ICALEVENT_MAPISTORE_H #define ICALEVENT_MAPISTORE_H
#include <talloc.h>
#import <NGCards/iCalEvent.h> #import <NGCards/iCalEvent.h>
@class MAPIStoreUserContext; @class MAPIStoreUserContext;
@ -34,8 +36,8 @@
- (void) updateFromMAPIProperties: (NSDictionary *) properties - (void) updateFromMAPIProperties: (NSDictionary *) properties
inUserContext: (MAPIStoreUserContext *) userContext inUserContext: (MAPIStoreUserContext *) userContext
withActiveUser: (SOGoUser *) activeUser; withActiveUser: (SOGoUser *) activeUser
inMemCtx: (TALLOC_CTX *) memCtx;
@end @end
#endif /* ICALEVENT_MAPISTORE_H */ #endif /* ICALEVENT_MAPISTORE_H */

View File

@ -20,7 +20,6 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include <talloc.h>
#include <util/attr.h> #include <util/attr.h>
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
@ -75,16 +74,17 @@
@implementation iCalEvent (MAPIStoreProperties) @implementation iCalEvent (MAPIStoreProperties)
- (void) _setupEventRecurrence: (NSData *) mapiRecurrenceData - (void) _setupEventRecurrence: (NSData *) mapiRecurrenceData
inMemCtx: (TALLOC_CTX *) memCtx
{ {
struct Binary_r *blob; struct Binary_r *blob;
struct AppointmentRecurrencePattern *pattern; struct AppointmentRecurrencePattern *pattern;
blob = [mapiRecurrenceData asBinaryInMemCtx: NULL]; blob = [mapiRecurrenceData asBinaryInMemCtx: memCtx];
pattern = get_AppointmentRecurrencePattern (blob, blob); pattern = get_AppointmentRecurrencePattern (memCtx, blob);
[(iCalCalendar *) parent [(iCalCalendar *) parent
setupRecurrenceWithMasterEntity: self setupRecurrenceWithMasterEntity: self
fromRecurrencePattern: &pattern->RecurrencePattern]; fromRecurrencePattern: &pattern->RecurrencePattern];
talloc_free (blob); //talloc_free (blob);
} }
- (void) _setupEventAlarmFromProperties: (NSDictionary *) properties - (void) _setupEventAlarmFromProperties: (NSDictionary *) properties
@ -134,6 +134,7 @@
- (void) updateFromMAPIProperties: (NSDictionary *) properties - (void) updateFromMAPIProperties: (NSDictionary *) properties
inUserContext: (MAPIStoreUserContext *) userContext inUserContext: (MAPIStoreUserContext *) userContext
withActiveUser: (SOGoUser *) activeUser withActiveUser: (SOGoUser *) activeUser
inMemCtx: (TALLOC_CTX *) memCtx
{ {
BOOL isAllDay; BOOL isAllDay;
iCalDateTime *start, *end; iCalDateTime *start, *end;
@ -328,7 +329,7 @@
value = [properties value = [properties
objectForKey: MAPIPropertyKey (PidLidAppointmentRecur)]; objectForKey: MAPIPropertyKey (PidLidAppointmentRecur)];
if (value) if (value)
[self _setupEventRecurrence: value]; [self _setupEventRecurrence: value inMemCtx: memCtx];
/* alarm */ /* alarm */
[self _setupEventAlarmFromProperties: properties]; [self _setupEventAlarmFromProperties: properties];