From e06056d62572436d3ad36d92ec90546050904455 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 27 Oct 2011 16:01:51 +0000 Subject: [PATCH] Monotone-Parent: 674dec9c0680a0ce5418d7dc05b15bc69a65f379 Monotone-Revision: 5cdce5bcdd485012bf16a49a2dd5dfddaae270c0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-10-27T16:01:51 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 ++ OpenChange/MAPIStoreAttachment.m | 16 +++++++ OpenChange/MAPIStoreMailAttachment.m | 10 ----- OpenChange/MAPIStoreVolatileMessage.h | 2 + OpenChange/MAPIStoreVolatileMessage.m | 62 +++++++++++++-------------- 5 files changed, 50 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index be95adc1a..0ee14466d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ * OpenChange/MAPIStoreVolatileMessage.m: MAPIStoreMemMessage renamed to MAPIStoreVolatileMessage. + (-getAvailableProperties:inMemCtx:) removed obsolete method. + (-init): creationTime and lastModificationTime are now ivars. + (-lookupAttachment:): implemented manadatory method. * OpenChange/SOGoMAPIVolatileMessage.m: SOGoMAPIMemMessage renamed to SOGoMAPIVolatileMessage. diff --git a/OpenChange/MAPIStoreAttachment.m b/OpenChange/MAPIStoreAttachment.m index e36ea9434..483944a1c 100644 --- a/OpenChange/MAPIStoreAttachment.m +++ b/OpenChange/MAPIStoreAttachment.m @@ -120,6 +120,22 @@ return (attMessage ? MAPISTORE_SUCCESS : MAPISTORE_ERROR); } +- (NSDate *) creationTime +{ + return [container creationTime]; +} + +- (NSDate *) lastModificationTime +{ + return [container lastModificationTime]; +} + +- (uint64_t) objectVersion +{ + /* attachments have no version number */ + return ULLONG_MAX; +} + /* subclasses */ - (MAPIStoreAttachmentMessage *) openEmbeddedMessage { diff --git a/OpenChange/MAPIStoreMailAttachment.m b/OpenChange/MAPIStoreMailAttachment.m index 1fbae730a..48eab0e50 100644 --- a/OpenChange/MAPIStoreMailAttachment.m +++ b/OpenChange/MAPIStoreMailAttachment.m @@ -192,14 +192,4 @@ return MAPISTORE_SUCCESS; } -- (NSDate *) creationTime -{ - return [[container sogoObject] date]; -} - -- (NSDate *) lastModificationTime -{ - return [[container sogoObject] date]; -} - @end diff --git a/OpenChange/MAPIStoreVolatileMessage.h b/OpenChange/MAPIStoreVolatileMessage.h index 693b8353b..71e02c5f8 100644 --- a/OpenChange/MAPIStoreVolatileMessage.h +++ b/OpenChange/MAPIStoreVolatileMessage.h @@ -28,6 +28,8 @@ @interface MAPIStoreVolatileMessage : MAPIStoreMessage { BOOL fetchedAttachments; + NSDate *creationTime; + NSDate *lastModificationTime; } @end diff --git a/OpenChange/MAPIStoreVolatileMessage.m b/OpenChange/MAPIStoreVolatileMessage.m index a50e79673..177ca4d0d 100644 --- a/OpenChange/MAPIStoreVolatileMessage.m +++ b/OpenChange/MAPIStoreVolatileMessage.m @@ -64,11 +64,22 @@ Class NSNumberK; - (id) init { if ((self = [super init])) - fetchedAttachments = NO; + { + fetchedAttachments = NO; + ASSIGN (creationTime, [NSDate date]); + lastModificationTime = [creationTime copy]; + } return self; } +- (void) dealloc +{ + [creationTime release]; + [lastModificationTime release]; + [super dealloc]; +} + - (int) addPropertiesFromRow: (struct SRow *) aRow { int rc; @@ -78,6 +89,7 @@ Class NSNumberK; { [sogoObject appendProperties: properties]; [properties removeAllObjects]; + ASSIGN (lastModificationTime, [NSDate date]); } return rc; @@ -88,6 +100,7 @@ Class NSNumberK; [super addProperties: newProperties]; [sogoObject appendProperties: newProperties]; [properties removeAllObjects]; + ASSIGN (lastModificationTime, [NSDate date]); } - (uint64_t) objectVersion @@ -149,38 +162,6 @@ Class NSNumberK; return rc; } -- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP - inMemCtx: (TALLOC_CTX *) memCtx -{ - NSArray *keys; - NSUInteger count, max; - NSString *key; - struct SPropTagArray *availableProps; - - keys = [[sogoObject properties] allKeys]; - max = [keys count]; - - availableProps = talloc_zero (NULL, struct SPropTagArray); - availableProps->cValues = max; - availableProps->aulPropTag = talloc_array (availableProps, enum MAPITAGS, max); - for (count = 0; count < max; count++) - { - key = [keys objectAtIndex: count]; - if ([key isKindOfClass: NSNumberK]) - { -#if (GS_SIZEOF_LONG == 4) - availableProps->aulPropTag[count] = [[keys objectAtIndex: count] unsignedLongValue]; -#elif (GS_SIZEOF_INT == 4) - availableProps->aulPropTag[count] = [[keys objectAtIndex: count] unsignedIntValue]; -#endif - } - } - - *propertiesP = availableProps; - - return MAPISTORE_SUCCESS; -} - - (NSArray *) attachmentsKeysMatchingQualifier: (EOQualifier *) qualifier andSortOrderings: (NSArray *) sortOrderings { @@ -213,6 +194,21 @@ Class NSNumberK; andSortOrderings: sortOrderings]; } +- (NSDate *) creationTime +{ + return creationTime; +} + +- (NSDate *) lastModificationTime +{ + return lastModificationTime; +} + +- (id) lookupAttachment: (NSString *) childKey +{ + return [attachmentParts objectForKey: childKey]; +} + - (void) save { [self subclassResponsibility: _cmd];