Monotone-Parent: 0bb415c672cf6fa29a94c71cfade196c42eeb58a
Monotone-Revision: dc1a04dbd8c664b75c03181a48283724ed5866b2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-07-15T20:22:27 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
72f379b931
commit
792fb895f7
|
@ -6,6 +6,12 @@
|
|||
|
||||
2011-07-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreDraftsAttachment.m: removed useless class.
|
||||
|
||||
* OpenChange/MAPIStoreMessage.m (-createAttachment): moved method
|
||||
from MAPIStoreDraftsMessage
|
||||
(-childKeysMatchingQualifier:andSortOrderings:): same as above.
|
||||
|
||||
* OpenChange/*.m: make use of mapistore error code rather than
|
||||
MAPI ones.
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
|||
MAPIStoreMailContext.m \
|
||||
MAPIStoreMailFolder.m \
|
||||
MAPIStoreMailFolderTable.m \
|
||||
MAPIStoreDraftsAttachment.m \
|
||||
MAPIStoreDraftsMessage.m \
|
||||
MAPIStoreMailMessage.m \
|
||||
MAPIStoreMailMessageTable.m \
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/* MAPIStoreDraftsAttachment.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef MAPISTOREDRAFTSATTACHMENT_H
|
||||
#define MAPISTOREDRAFTSATTACHMENT_H
|
||||
|
||||
#import "MAPIStoreAttachment.h"
|
||||
|
||||
@interface MAPIStoreDraftsAttachment : MAPIStoreAttachment
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREDRAFTSATTACHMENT_H */
|
|
@ -1,27 +0,0 @@
|
|||
/* MAPIStoreDraftsAttachment.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import "MAPIStoreDraftsAttachment.h"
|
||||
|
||||
@implementation MAPIStoreDraftsAttachment
|
||||
|
||||
@end
|
|
@ -30,7 +30,6 @@
|
|||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreDraftsAttachment.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
|
||||
#import "MAPIStoreDraftsMessage.h"
|
||||
|
@ -41,17 +40,6 @@
|
|||
|
||||
@implementation MAPIStoreDraftsMessage
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
attachmentKeys = [NSMutableArray new];
|
||||
attachmentParts = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int) getPrMessageFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
@ -179,38 +167,6 @@ e)
|
|||
[self _saveAttachment: [attachmentKeys objectAtIndex: count]];
|
||||
}
|
||||
|
||||
- (MAPIStoreAttachment *) createAttachment
|
||||
{
|
||||
MAPIStoreDraftsAttachment *newAttachment;
|
||||
uint32_t newAid;
|
||||
NSString *newKey;
|
||||
|
||||
newAid = [attachmentKeys count];
|
||||
|
||||
newAttachment = [MAPIStoreDraftsAttachment
|
||||
mapiStoreObjectWithSOGoObject: nil
|
||||
inContainer: self];
|
||||
[newAttachment setIsNew: YES];
|
||||
[newAttachment setAID: newAid];
|
||||
newKey = [NSString stringWithFormat: @"%ul", newAid];
|
||||
[attachmentParts setObject: newAttachment
|
||||
forKey: newKey];
|
||||
[attachmentKeys addObject: newKey];
|
||||
|
||||
return newAttachment;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for attachments"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for attachments"];
|
||||
|
||||
return attachmentKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [attachmentParts objectForKey: childKey];
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#import "MAPIStoreMessage.h"
|
||||
|
||||
@interface MAPIStoreFSMessage : MAPIStoreMessage
|
||||
{
|
||||
BOOL fetchedAttachments;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFSMESSAGE_H */
|
||||
|
|
|
@ -64,6 +64,14 @@
|
|||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
fetchedAttachments = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int) getProperty: (void **) data
|
||||
withTag: (enum MAPITAGS) propTag
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
|
@ -102,6 +110,7 @@
|
|||
{
|
||||
NSArray *keys;
|
||||
NSUInteger count, max;
|
||||
NSString *key;
|
||||
struct SPropTagArray *properties;
|
||||
|
||||
keys = [[sogoObject properties] allKeys];
|
||||
|
@ -117,12 +126,15 @@
|
|||
// #elif (GS_SIZEOF_INT == 4)
|
||||
// return [NSNumber numberWithUnsignedInt: propTag];
|
||||
// #else
|
||||
|
||||
key = [keys objectAtIndex: count];
|
||||
if (![key isEqualToString: @"attachments"])
|
||||
{
|
||||
#if (GS_SIZEOF_LONG == 4)
|
||||
properties->aulPropTag[count] = [[keys objectAtIndex: count] unsignedLongValue];
|
||||
properties->aulPropTag[count] = [[keys objectAtIndex: count] unsignedLongValue];
|
||||
#elif (GS_SIZEOF_INT == 4)
|
||||
properties->aulPropTag[count] = [[keys objectAtIndex: count] unsignedIntValue];
|
||||
properties->aulPropTag[count] = [[keys objectAtIndex: count] unsignedIntValue];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
*propertiesP = properties;
|
||||
|
@ -130,8 +142,42 @@
|
|||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSDictionary *attachments;
|
||||
NSArray *keys;
|
||||
NSString *key, *newKey;
|
||||
NSUInteger count, max, aid;
|
||||
MAPIStoreAttachment *attachment;
|
||||
|
||||
if (!fetchedAttachments)
|
||||
{
|
||||
attachments = [[sogoObject properties] objectForKey: @"attachments"];
|
||||
keys = [attachments allKeys];
|
||||
max = [keys count];
|
||||
if (max > 0)
|
||||
{
|
||||
aid = [keys count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
key = [keys objectAtIndex: count];
|
||||
attachment = [attachments objectForKey: key];
|
||||
newKey = [NSString stringWithFormat: @"%ul", (aid + count)];
|
||||
[attachmentParts setObject: attachment forKey: newKey];
|
||||
}
|
||||
}
|
||||
fetchedAttachments = YES;
|
||||
}
|
||||
|
||||
return [super childKeysMatchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
|
||||
- (void) save
|
||||
{
|
||||
if ([attachmentKeys count] > 0)
|
||||
[newProperties setObject: attachmentParts forKey: @"attachments"];
|
||||
[sogoObject appendProperties: newProperties];
|
||||
[sogoObject save];
|
||||
[self resetNewProperties];
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#import "MAPIStoreMessage.h"
|
||||
|
||||
@interface MAPIStoreMailMessage : MAPIStoreMessage
|
||||
{
|
||||
BOOL fetchedAttachments;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -85,6 +85,14 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
|
|||
MAPIStoreDraftsFolderK = [MAPIStoreDraftsFolder class];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
fetchedAttachments = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int) getPrIconIndex: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
@ -786,15 +794,15 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
|
|||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
if (!attachmentKeys)
|
||||
if (!fetchedAttachments)
|
||||
{
|
||||
attachmentKeys = [NSMutableArray new];
|
||||
attachmentParts = [NSMutableDictionary new];
|
||||
[self _fetchAttachmentPartsInBodyInfo: [sogoObject bodyStructure]
|
||||
withPrefix: @""];
|
||||
fetchedAttachments = YES;
|
||||
}
|
||||
|
||||
return attachmentKeys;
|
||||
return [super childKeysMatchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
attachmentKeys = nil;
|
||||
attachmentParts = nil;
|
||||
attachmentKeys = [NSMutableArray new];
|
||||
attachmentParts = [NSMutableDictionary new];
|
||||
activeTables = [NSMutableArray new];
|
||||
}
|
||||
|
||||
|
@ -231,6 +231,27 @@
|
|||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (MAPIStoreAttachment *) createAttachment
|
||||
{
|
||||
MAPIStoreAttachment *newAttachment;
|
||||
uint32_t newAid;
|
||||
NSString *newKey;
|
||||
|
||||
newAid = [attachmentKeys count];
|
||||
|
||||
newAttachment = [MAPIStoreAttachment
|
||||
mapiStoreObjectWithSOGoObject: nil
|
||||
inContainer: self];
|
||||
[newAttachment setIsNew: YES];
|
||||
[newAttachment setAID: newAid];
|
||||
newKey = [NSString stringWithFormat: @"%ul", newAid];
|
||||
[attachmentParts setObject: newAttachment
|
||||
forKey: newKey];
|
||||
[attachmentKeys addObject: newKey];
|
||||
|
||||
return newAttachment;
|
||||
}
|
||||
|
||||
- (int) createAttachment: (MAPIStoreAttachment **) attachmentPtr
|
||||
inAID: (uint32_t *) aidPtr
|
||||
{
|
||||
|
@ -649,11 +670,15 @@
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (MAPIStoreAttachment *) createAttachment
|
||||
- (NSArray *) childKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for attachments"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for attachments"];
|
||||
|
||||
return attachmentKeys;
|
||||
}
|
||||
|
||||
- (MAPIStoreAttachmentTable *) attachmentTable
|
||||
|
|
Loading…
Reference in New Issue