Monotone-Parent: 267e6d207c2b21dd1ac48357f84bd5251da930b1
Monotone-Revision: 24cf83dbb2cb1e47afd0354cd24653a8c26a7ce1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-31T15:55:47 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
8fd1c93ac3
commit
32e9662706
25
ChangeLog
25
ChangeLog
|
@ -1,5 +1,30 @@
|
||||||
2007-10-31 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2007-10-31 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailFolder.[hm]: added a new subclass of
|
||||||
|
SOGoMailFolder: SOGoMailSpecialFolder.
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount
|
||||||
|
-traversalFromMailAccount]): overridden method that returns the
|
||||||
|
initialized mutable string.
|
||||||
|
([SOGoMailAccount -allFolderPaths]): take the special folder paths
|
||||||
|
with -traversalFromMailAccount and reposition them at the
|
||||||
|
beginning of the list. By creating the special folders during that
|
||||||
|
request, we also make sure that the folder exists thanks to the
|
||||||
|
new initialisation method of the new "SOGoSpecialMailFolder"
|
||||||
|
class.
|
||||||
|
([SOGoMailAccount -lookupSentFolder:_keyinContext:_ctx]): new
|
||||||
|
method.
|
||||||
|
([SOGoMailAccount -lookupTrashFolder:_keyinContext:_ctx]): new
|
||||||
|
method.
|
||||||
|
([SOGoMailAccount -lookupName:_keyinContext:acquire:_flag]): no
|
||||||
|
longer use lookupImap4Folder.
|
||||||
|
([SOGoMailAccount -lookupImap4Folder:_keyinContext:_ctx]): removed
|
||||||
|
method.
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailBaseObject.m ([SOGoMailBaseObject
|
||||||
|
-traversalFromMailAccount]): new method that returns the full
|
||||||
|
IMAP4 path to the object.
|
||||||
|
|
||||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser +initialize]): retain
|
* SoObjects/SOGo/SOGoUser.m ([SOGoUser +initialize]): retain
|
||||||
"superUsernames" after fetching it from the ud.
|
"superUsernames" after fetching it from the ud.
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,10 @@ Mailer_OBJC_FILES += \
|
||||||
SOGoMailFolder.m \
|
SOGoMailFolder.m \
|
||||||
SOGoSharedInboxFolder.m \
|
SOGoSharedInboxFolder.m \
|
||||||
SOGoMailObject.m \
|
SOGoMailObject.m \
|
||||||
|
SOGoDraftObject.m \
|
||||||
SOGoMailObject+Draft.m \
|
SOGoMailObject+Draft.m \
|
||||||
|
SOGoSentFolder.m \
|
||||||
|
SOGoDraftsFolder.m \
|
||||||
SOGoTrashFolder.m \
|
SOGoTrashFolder.m \
|
||||||
\
|
\
|
||||||
SOGoMailBodyPart.m \
|
SOGoMailBodyPart.m \
|
||||||
|
@ -27,9 +30,6 @@ Mailer_OBJC_FILES += \
|
||||||
SOGoCalendarMailBodyPart.m \
|
SOGoCalendarMailBodyPart.m \
|
||||||
SOGoVCardMailBodyPart.m \
|
SOGoVCardMailBodyPart.m \
|
||||||
\
|
\
|
||||||
SOGoDraftsFolder.m \
|
|
||||||
SOGoDraftObject.m \
|
|
||||||
\
|
|
||||||
SOGoMailForward.m \
|
SOGoMailForward.m \
|
||||||
\
|
\
|
||||||
NSData+Mail.m \
|
NSData+Mail.m \
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
@class SOGoDraftObject;
|
@class SOGoDraftObject;
|
||||||
|
|
||||||
@interface SOGoDraftsFolder : SOGoMailFolder
|
@interface SOGoDraftsFolder : SOGoSpecialMailFolder
|
||||||
|
|
||||||
- (SOGoDraftObject *) newDraft;
|
- (SOGoDraftObject *) newDraft;
|
||||||
- (BOOL) isInDraftsFolder;
|
- (BOOL) isInDraftsFolder;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#import <NGExtensions/NSNull+misc.h>
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
#import <NGImap4/NGImap4Connection.h>
|
#import <NGImap4/NGImap4Connection.h>
|
||||||
|
|
||||||
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||||
#import <SoObjects/SOGo/SOGoUser.h>
|
#import <SoObjects/SOGo/SOGoUser.h>
|
||||||
|
|
||||||
#import "SOGoMailFolder.h"
|
#import "SOGoMailFolder.h"
|
||||||
|
@ -163,7 +164,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
[folders removeObjectsInArray: additionalFolders];
|
[folders removeObjectsInArray: additionalFolders];
|
||||||
[folders addObjectsFromArray: additionalFolders];
|
[folders addObjectsFromArray: additionalFolders];
|
||||||
}
|
}
|
||||||
|
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,13 +179,21 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
{
|
{
|
||||||
NSMutableArray *newFolders;
|
NSMutableArray *newFolders;
|
||||||
NSArray *rawFolders, *mainFolders;
|
NSArray *rawFolders, *mainFolders;
|
||||||
|
NSString *realDraftsFolderName, *realSentFolderName, *realTrashFolderName;
|
||||||
|
|
||||||
rawFolders = [[self imap4Connection]
|
rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL]];
|
||||||
allFoldersForURL: [self imap4URL]];
|
|
||||||
|
|
||||||
#warning FIXME: the folder names should be prefixed
|
realDraftsFolderName
|
||||||
mainFolders = [NSArray arrayWithObjects: inboxFolderName, draftsFolderName,
|
= [[self draftsFolderInContext: context] traversalFromMailAccount];
|
||||||
sentFolder, trashFolder, nil];
|
realSentFolderName
|
||||||
|
= [[self sentFolderInContext: context] traversalFromMailAccount];
|
||||||
|
realTrashFolderName
|
||||||
|
= [[self trashFolderInContext: context] traversalFromMailAccount];
|
||||||
|
|
||||||
|
mainFolders = [NSArray arrayWithObjects: inboxFolderName,
|
||||||
|
realDraftsFolderName,
|
||||||
|
realSentFolderName,
|
||||||
|
realTrashFolderName, nil];
|
||||||
newFolders = [NSMutableArray arrayWithArray: rawFolders];
|
newFolders = [NSMutableArray arrayWithArray: rawFolders];
|
||||||
[newFolders removeObjectsInArray: mainFolders];
|
[newFolders removeObjectsInArray: mainFolders];
|
||||||
[newFolders sortUsingSelector: @selector (caseInsensitiveCompare:)];
|
[newFolders sortUsingSelector: @selector (caseInsensitiveCompare:)];
|
||||||
|
@ -247,6 +256,11 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
return urlString;
|
return urlString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSMutableString *) traversalFromMailAccount
|
||||||
|
{
|
||||||
|
return [NSMutableString string];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) imap4Login
|
- (NSString *) imap4Login
|
||||||
{
|
{
|
||||||
return [[self imap4URL] user];
|
return [[self imap4URL] user];
|
||||||
|
@ -274,15 +288,11 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) lookupImap4Folder: (NSString *) _key
|
- (id) lookupSentFolder: (NSString *) _key
|
||||||
inContext: (id) _cx
|
inContext: (id) _ctx
|
||||||
{
|
{
|
||||||
NSString *s;
|
return [self lookupFolder: _key ofClassNamed: @"SOGoSentFolder"
|
||||||
|
inContext: _ctx];
|
||||||
s = [_key isEqualToString: [self trashFolderNameInContext:_cx]]
|
|
||||||
? @"SOGoTrashFolder" : @"SOGoMailFolder";
|
|
||||||
|
|
||||||
return [self lookupFolder:_key ofClassNamed:s inContext:_cx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) lookupDraftsFolder: (NSString *) _key
|
- (id) lookupDraftsFolder: (NSString *) _key
|
||||||
|
@ -292,6 +302,13 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
inContext: _ctx];
|
inContext: _ctx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) lookupTrashFolder: (NSString *) _key
|
||||||
|
inContext: (id) _ctx
|
||||||
|
{
|
||||||
|
return [self lookupFolder: _key ofClassNamed: @"SOGoTrashFolder"
|
||||||
|
inContext: _ctx];
|
||||||
|
}
|
||||||
|
|
||||||
- (id) lookupFiltersFolder: (NSString *) _key inContext: (id) _ctx
|
- (id) lookupFiltersFolder: (NSString *) _key inContext: (id) _ctx
|
||||||
{
|
{
|
||||||
return [self lookupFolder:_key ofClassNamed:@"SOGoSieveScriptsFolder"
|
return [self lookupFolder:_key ofClassNamed:@"SOGoSieveScriptsFolder"
|
||||||
|
@ -308,12 +325,17 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
{
|
{
|
||||||
// TODO: those should be product.plist bindings? (can't be class bindings
|
// TODO: those should be product.plist bindings? (can't be class bindings
|
||||||
// though because they are 'per-account')
|
// though because they are 'per-account')
|
||||||
if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]])
|
if ([_key isEqualToString: [self sentFolderNameInContext: _ctx]])
|
||||||
|
obj = [self lookupSentFolder: _key inContext: _ctx];
|
||||||
|
else if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]])
|
||||||
obj = [self lookupDraftsFolder: _key inContext: _ctx];
|
obj = [self lookupDraftsFolder: _key inContext: _ctx];
|
||||||
else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
else if ([_key isEqualToString: [self trashFolderNameInContext: _ctx]])
|
||||||
obj = [self lookupFiltersFolder: _key inContext: _ctx];
|
obj = [self lookupTrashFolder: _key inContext: _ctx];
|
||||||
|
// else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
||||||
|
// obj = [self lookupFiltersFolder: _key inContext: _ctx];
|
||||||
else
|
else
|
||||||
obj = [self lookupImap4Folder: _key inContext: _ctx];
|
obj = [self lookupFolder: _key ofClassNamed: @"SOGoMailFolder"
|
||||||
|
inContext: _ctx];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
obj = [super lookupName: _key inContext: _ctx acquire: NO];
|
obj = [super lookupName: _key inContext: _ctx acquire: NO];
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
|
|
||||||
- (NSString *) relativeImap4Name;
|
- (NSString *) relativeImap4Name;
|
||||||
- (NSMutableString *) imap4URLString;
|
- (NSMutableString *) imap4URLString;
|
||||||
|
- (NSMutableString *) traversalFromMailAccount;
|
||||||
|
|
||||||
- (NSURL *) imap4URL;
|
- (NSURL *) imap4URL;
|
||||||
- (NSString *) imap4Login;
|
- (NSString *) imap4Login;
|
||||||
|
|
|
@ -186,6 +186,16 @@ static BOOL debugOn = YES;
|
||||||
return [[self authenticatorInContext: context] passwordInContext: context];
|
return [[self authenticatorInContext: context] passwordInContext: context];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSMutableString *) traversalFromMailAccount
|
||||||
|
{
|
||||||
|
NSMutableString *currentTraversal;
|
||||||
|
|
||||||
|
currentTraversal = [container traversalFromMailAccount];
|
||||||
|
[currentTraversal appendFormat: @"/%@", [self relativeImap4Name]];
|
||||||
|
|
||||||
|
return currentTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)flushMailCaches {
|
- (void)flushMailCaches {
|
||||||
[[self mailManager] flushCachesForURL:[self imap4URL]];
|
[[self mailManager] flushCachesForURL:[self imap4URL]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,17 @@
|
||||||
|
|
||||||
- (NSArray *) subfolders;
|
- (NSArray *) subfolders;
|
||||||
|
|
||||||
|
- (BOOL) isSpecialFolder;
|
||||||
|
|
||||||
- (NSArray *) allFolderPaths;
|
- (NSArray *) allFolderPaths;
|
||||||
- (NSArray *) allFolderURLs;
|
- (NSArray *) allFolderURLs;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface SOGoSpecialMailFolder : SOGoMailFolder
|
||||||
|
|
||||||
|
- (BOOL) isSpecialFolder;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
#endif /* __Mailer_SOGoMailFolder_H__ */
|
#endif /* __Mailer_SOGoMailFolder_H__ */
|
||||||
|
|
|
@ -133,6 +133,11 @@ static NSString *defaultUserID = @"anyone";
|
||||||
return [[self imap4Connection] subfoldersForURL: [self imap4URL]];
|
return [[self imap4Connection] subfoldersForURL: [self imap4URL]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isSpecialFolder
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *) allFolderPaths
|
- (NSArray *) allFolderPaths
|
||||||
{
|
{
|
||||||
NSMutableArray *deepSubfolders;
|
NSMutableArray *deepSubfolders;
|
||||||
|
@ -688,3 +693,26 @@ static NSString *defaultUserID = @"anyone";
|
||||||
}
|
}
|
||||||
|
|
||||||
@end /* SOGoMailFolder */
|
@end /* SOGoMailFolder */
|
||||||
|
|
||||||
|
@implementation SOGoSpecialMailFolder
|
||||||
|
|
||||||
|
- (id) initWithName: (NSString *) newName
|
||||||
|
inContainer: (id) newContainer
|
||||||
|
{
|
||||||
|
if ((self = [super initWithName: newName
|
||||||
|
inContainer: newContainer]))
|
||||||
|
{
|
||||||
|
if (![[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]])
|
||||||
|
[imap4 createMailbox: [self relativeImap4Name]
|
||||||
|
atURL: [newContainer imap4URL]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) isSpecialFolder
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2005 SKYRIX Software AG
|
||||||
|
|
||||||
|
This file is part of OpenGroupware.org.
|
||||||
|
|
||||||
|
OGo is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
later version.
|
||||||
|
|
||||||
|
OGo 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 Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with OGo; see the file COPYING. If not, write to the
|
||||||
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __Mailer_SOGoSentFolder_H__
|
||||||
|
#define __Mailer_SOGoSentFolder_H__
|
||||||
|
|
||||||
|
#import "SOGoMailFolder.h"
|
||||||
|
|
||||||
|
@interface SOGoSentFolder : SOGoSpecialMailFolder
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* __Mailer_SOGoSentFolder_H__ */
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2005 SKYRIX Software AG
|
||||||
|
|
||||||
|
This file is part of OpenGroupware.org.
|
||||||
|
|
||||||
|
OGo is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
later version.
|
||||||
|
|
||||||
|
OGo 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 Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with OGo; see the file COPYING. If not, write to the
|
||||||
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
#import "SOGoSentFolder.h"
|
||||||
|
|
||||||
|
@implementation SOGoSentFolder
|
||||||
|
|
||||||
|
/* folder type */
|
||||||
|
|
||||||
|
- (NSString *)outlookFolderClass {
|
||||||
|
return @"IPF.Sent";
|
||||||
|
}
|
||||||
|
|
||||||
|
@end /* SOGoSentFolder */
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#import "SOGoMailFolder.h"
|
#import "SOGoMailFolder.h"
|
||||||
|
|
||||||
@interface SOGoTrashFolder : SOGoMailFolder
|
@interface SOGoTrashFolder : SOGoSpecialMailFolder
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* __Mailer_SOGoTrashFolder_H__ */
|
#endif /* __Mailer_SOGoTrashFolder_H__ */
|
||||||
|
|
Loading…
Reference in New Issue