Monotone-Parent: 07f66207968bbc8815cccf3c0b6d5147e13d8ab6
Monotone-Revision: 7fda497b476e41fe9d5324a0c31127a0e9777847 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-10-25T20:23:43 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
5666149e37
commit
cc16643242
|
@ -1,5 +1,11 @@
|
|||
2011-10-25 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/EOQualifier+MAPIFS.[hm]: now evaluates
|
||||
SOGoMAPIMemMessage.
|
||||
|
||||
* OpenChange/SOGoMAPIFSMessage.[hm]: now a subclass of
|
||||
SOGoMAPIMemMessage.
|
||||
|
||||
* OpenChange/MAPIStoreDraftsMessage.m (_saveAttachment:): make use
|
||||
of MAPIStoreMIME.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* EOQualifier+MAPIFS.h - this file is part of SOGo
|
||||
/* EOQualifier+MAPIMem.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
|
@ -20,17 +20,17 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef EOQUALIFIER_MAPIFS_H
|
||||
#define EOQUALIFIER_MAPIFS_H
|
||||
#ifndef EOQUALIFIER_MAPIMEM_H
|
||||
#define EOQUALIFIER_MAPIMEM_H
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
@class SOGoMAPIFSMessage;
|
||||
@class SOGoMAPIMemMessage;
|
||||
|
||||
@interface EOQualifier (MAPIStoreRestrictions)
|
||||
|
||||
- (BOOL) evaluateMAPIFSMessage: (SOGoMAPIFSMessage *) message;
|
||||
- (BOOL) evaluateMAPIMemMessage: (SOGoMAPIMemMessage *) message;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* EOQUALIFIER_MAPIFS_H */
|
||||
#endif /* EOQUALIFIER_MAPIMEM_H */
|
|
@ -1,4 +1,4 @@
|
|||
/* EOQualifier+MAPIFS.m - this file is part of SOGo
|
||||
/* EOQualifier+MAPIMem.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
|
@ -28,20 +28,20 @@
|
|||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "SOGoMAPIFSMessage.h"
|
||||
#import "SOGoMAPIMemMessage.h"
|
||||
|
||||
#import "EOQualifier+MAPIFS.h"
|
||||
#import "EOQualifier+MAPIMem.h"
|
||||
#import "EOBitmaskQualifier.h"
|
||||
|
||||
@implementation EOQualifier (MAPIStoreRestrictions)
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
- (BOOL) _evaluateMAPIMemMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) evaluateMAPIFSMessage: (SOGoMAPIFSMessage *) message
|
||||
- (BOOL) evaluateMAPIMemMessage: (SOGoMAPIMemMessage *) message
|
||||
{
|
||||
NSDictionary *properties;
|
||||
BOOL rc;
|
||||
|
@ -49,7 +49,7 @@
|
|||
[self logWithFormat: @"evaluating message '%@'", message];
|
||||
|
||||
properties = [message properties];
|
||||
rc = [self _evaluateMAPIFSMessageProperties: properties];
|
||||
rc = [self _evaluateMAPIMemMessageProperties: properties];
|
||||
|
||||
[self logWithFormat: @" evaluation result: %d", rc];
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
@implementation EOAndQualifier (MAPIStoreRestrictionsPrivate)
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
- (BOOL) _evaluateMAPIMemMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
NSUInteger i;
|
||||
BOOL rc;
|
||||
|
@ -69,7 +69,7 @@
|
|||
|
||||
for (i = 0; rc && i < count; i++)
|
||||
rc = [[qualifiers objectAtIndex: i]
|
||||
_evaluateMAPIFSMessageProperties: properties];
|
||||
_evaluateMAPIMemMessageProperties: properties];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@
|
|||
|
||||
@implementation EOOrQualifier (MAPIStoreRestrictionsPrivate)
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
- (BOOL) _evaluateMAPIMemMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
NSUInteger i;
|
||||
BOOL rc;
|
||||
|
@ -87,7 +87,7 @@
|
|||
|
||||
for (i = 0; !rc && i < count; i++)
|
||||
rc = [[qualifiers objectAtIndex: i]
|
||||
_evaluateMAPIFSMessageProperties: properties];
|
||||
_evaluateMAPIMemMessageProperties: properties];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -96,9 +96,9 @@
|
|||
|
||||
@implementation EONotQualifier (MAPIStoreRestrictionsPrivate)
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
- (BOOL) _evaluateMAPIMemMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
return ![qualifier _evaluateMAPIFSMessageProperties: properties];
|
||||
return ![qualifier _evaluateMAPIMemMessageProperties: properties];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -107,7 +107,7 @@
|
|||
|
||||
typedef BOOL (*EOComparator) (id, SEL, id);
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
- (BOOL) _evaluateMAPIMemMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
id finalKey;
|
||||
id propValue;
|
||||
|
@ -136,7 +136,7 @@ typedef BOOL (*EOComparator) (id, SEL, id);
|
|||
|
||||
@implementation EOBitmaskQualifier (MAPIStoreRestrictionsPrivate)
|
||||
|
||||
- (BOOL) _evaluateMAPIFSMessageProperties: (NSDictionary *) properties
|
||||
- (BOOL) _evaluateMAPIMemMessageProperties: (NSDictionary *) properties
|
||||
{
|
||||
NSNumber *propTag;
|
||||
id propValue;
|
|
@ -34,6 +34,7 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
|||
MAPIStoreTypes.m \
|
||||
MAPIStorePropertySelectors.m \
|
||||
\
|
||||
SOGoMAPIMemMessage.m \
|
||||
SOGoMAPIFSFolder.m \
|
||||
SOGoMAPIFSMessage.m \
|
||||
\
|
||||
|
@ -113,9 +114,8 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
|||
NSValue+MAPIStore.m \
|
||||
\
|
||||
EOBitmaskQualifier.m \
|
||||
EOQualifier+MAPIFS.m \
|
||||
EOQualifier+MAPIMem.m \
|
||||
\
|
||||
SOGoMemMessage.m \
|
||||
MAPIStoreMemMailMessage.m \
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#import <Foundation/NSURL.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import "EOQualifier+MAPIFS.h"
|
||||
#import "EOQualifier+MAPIMem.h"
|
||||
#import "MAPIStoreFSFolderTable.h"
|
||||
#import "MAPIStoreFSMessage.h"
|
||||
#import "MAPIStoreFSMessageTable.h"
|
||||
|
@ -138,7 +138,7 @@ static Class EOKeyValueQualifierK;
|
|||
subfolderKey = [entries objectAtIndex: count];
|
||||
subfolder = [self lookupFolder: subfolderKey];
|
||||
propertiesMessage = [subfolder propertiesMessage];
|
||||
if ([qualifier evaluateMAPIFSMessage: propertiesMessage])
|
||||
if ([qualifier evaluateMAPIMemMessage: propertiesMessage])
|
||||
[filteredEntries addObject: subfolderKey];
|
||||
}
|
||||
entries = filteredEntries;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
/* Those are parts of a hack that enables creating mails to IMAP folders from
|
||||
Exchange properties */
|
||||
#import "SOGoMemMessage.h"
|
||||
#import "SOGoMAPIMemMessage.h"
|
||||
#import "MAPIStoreMemMailMessage.h"
|
||||
|
||||
#import "MAPIStoreMailFolder.h"
|
||||
|
@ -995,9 +995,9 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
|||
- (MAPIStoreMessage *) createMessage
|
||||
{
|
||||
MAPIStoreDraftsMessage *newMessage;
|
||||
SOGoMemMessage *newObject;
|
||||
SOGoMAPIMemMessage *newObject;
|
||||
|
||||
newObject = [SOGoMemMessage
|
||||
newObject = [SOGoMAPIMemMessage
|
||||
objectWithName: [SOGoObject globallyUniqueObjectId]
|
||||
inContainer: sogoObject];
|
||||
newMessage
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#import "MAPIStoreTypes.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import "SOGoMemMessage.h"
|
||||
#import "SOGoMAPIMemMessage.h"
|
||||
|
||||
#import "MAPIStoreMemMailMessage.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "EOQualifier+MAPIFS.h"
|
||||
#import "EOQualifier+MAPIMem.h"
|
||||
#import "SOGoMAPIFSMessage.h"
|
||||
|
||||
#import "SOGoMAPIFSFolder.h"
|
||||
|
@ -242,7 +242,7 @@ static NSString *privateDir = nil;
|
|||
message = [self lookupName: messageKey
|
||||
inContext: nil
|
||||
acquire: NO];
|
||||
if ([qualifier evaluateMAPIFSMessage: message])
|
||||
if ([qualifier evaluateMAPIMemMessage: message])
|
||||
[keys addObject: messageKey];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,19 +23,17 @@
|
|||
#ifndef SOGOMAPIFSMESSAGE_H
|
||||
#define SOGOMAPIFSMESSAGE_H
|
||||
|
||||
#import <SOGo/SOGoObject.h>
|
||||
#import "SOGoMAPIMemMessage.h"
|
||||
|
||||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
@class NSCalendarDate;
|
||||
@class NSString;
|
||||
|
||||
@interface SOGoMAPIFSMessage : SOGoObject
|
||||
@interface SOGoMAPIFSMessage : SOGoMAPIMemMessage
|
||||
{
|
||||
NSMutableDictionary *properties;
|
||||
BOOL propertiesLoaded;
|
||||
NSString *completeFilename;
|
||||
}
|
||||
|
||||
- (NSDictionary *) properties;
|
||||
- (void) appendProperties: (NSDictionary *) newProperties;
|
||||
- (void) save;
|
||||
|
||||
- (NSString *) completeFilename;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
properties = nil;
|
||||
propertiesLoaded = NO;
|
||||
completeFilename = nil;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[properties release];
|
||||
[completeFilename release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -85,13 +84,13 @@
|
|||
return completeFilename;
|
||||
}
|
||||
|
||||
- (NSDictionary *) properties
|
||||
- (NSMutableDictionary *) properties
|
||||
{
|
||||
NSData *content;
|
||||
NSString *error;
|
||||
NSPropertyListFormat format;
|
||||
|
||||
if (!properties)
|
||||
if (!propertiesLoaded)
|
||||
{
|
||||
content = [NSData dataWithContentsOfFile: [self completeFilename]];
|
||||
if (content)
|
||||
|
@ -105,22 +104,11 @@
|
|||
[self logWithFormat: @"an error occurred during deserialization"
|
||||
@" of message: '%@'", error];
|
||||
}
|
||||
else
|
||||
properties = nil;
|
||||
if (!properties)
|
||||
properties = [NSMutableDictionary new];
|
||||
|
||||
propertiesLoaded = YES;
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
- (void) appendProperties: (NSDictionary *) newProperties
|
||||
{
|
||||
// We ensure the current properties are loaded
|
||||
[self properties];
|
||||
|
||||
// We merge the changes
|
||||
[properties addEntriesFromDictionary: newProperties];
|
||||
return [super properties];
|
||||
}
|
||||
|
||||
- (void) save
|
||||
|
@ -129,15 +117,16 @@
|
|||
|
||||
[container ensureDirectory];
|
||||
|
||||
[self logWithFormat: @"%d props in whole dict", [properties count]];
|
||||
// [self logWithFormat: @"%d props in whole dict", [properties count]];
|
||||
|
||||
content = [NSPropertyListSerialization dataFromPropertyList: properties
|
||||
format: NSPropertyListBinaryFormat_v1_0
|
||||
errorDescription: NULL];
|
||||
content = [NSPropertyListSerialization
|
||||
dataFromPropertyList: [self properties]
|
||||
format: NSPropertyListBinaryFormat_v1_0
|
||||
errorDescription: NULL];
|
||||
if (![content writeToFile: [self completeFilename] atomically: NO])
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"could not save message"];
|
||||
[self logWithFormat: @"fs message written to '%@'", [self completeFilename]];
|
||||
// [self logWithFormat: @"fs message written to '%@'", [self completeFilename]];
|
||||
}
|
||||
|
||||
- (NSString *) davEntityTag
|
||||
|
@ -167,8 +156,8 @@
|
|||
NSDictionary *attributes;
|
||||
|
||||
attributes = [[NSFileManager defaultManager]
|
||||
fileAttributesAtPath: [self completeFilename]
|
||||
traverseLink: NO];
|
||||
fileAttributesAtPath: [self completeFilename]
|
||||
traverseLink: NO];
|
||||
|
||||
return [attributes objectForKey: key];
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* SOGoMemMessage.h - this file is part of SOGo
|
||||
/* SOGoMAPIMemMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
|
@ -20,19 +20,22 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef SOGOMEMMESSAGE_H
|
||||
#define SOGOMEMMESSAGE_H
|
||||
#ifndef SOGOMAPIMEMMESSAGE_H
|
||||
#define SOGOMAPIMEMMESSAGE_H
|
||||
|
||||
#import <SOGo/SOGoObject.h>
|
||||
|
||||
@interface SOGoMemMessage : SOGoObject
|
||||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
|
||||
@interface SOGoMAPIMemMessage : SOGoObject
|
||||
{
|
||||
NSMutableDictionary *properties;
|
||||
}
|
||||
|
||||
- (NSDictionary *) properties;
|
||||
- (NSMutableDictionary *) properties;
|
||||
- (void) appendProperties: (NSDictionary *) newProperties;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* SOGOMEMMESSAGE_H */
|
||||
#endif /* SOGOMAPIMEMMESSAGE_H */
|
|
@ -1,4 +1,4 @@
|
|||
/* SOGoMemMessage.m - this file is part of SOGo
|
||||
/* SOGoMAPIMemMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
|
@ -22,15 +22,15 @@
|
|||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import "SOGoMemMessage.h"
|
||||
#import "SOGoMAPIMemMessage.h"
|
||||
|
||||
@implementation SOGoMemMessage
|
||||
@implementation SOGoMAPIMemMessage
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
properties = [NSMutableDictionary new];
|
||||
properties = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -42,15 +42,17 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSDictionary *) properties
|
||||
- (NSMutableDictionary *) properties
|
||||
{
|
||||
if (!properties)
|
||||
properties = [NSMutableDictionary new];
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
- (void) appendProperties: (NSDictionary *) newProperties
|
||||
{
|
||||
[properties addEntriesFromDictionary: newProperties];
|
||||
[[self properties] addEntriesFromDictionary: newProperties];
|
||||
}
|
||||
|
||||
|
||||
@end
|
Loading…
Reference in New Issue