Monotone-Parent: 6e98c1d612fcf5ba72a09cf9a2722a77ce287f05

Monotone-Revision: be2302dd882ba3fed4477d650f3f6d39f0eccad7

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-07-30T15:55:28
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-07-30 15:55:28 +00:00
parent d5d47357fb
commit a66d823e76
7 changed files with 993 additions and 1010 deletions

View File

@ -1,3 +1,14 @@
2007-07-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailFolder.m
([-isMessageKey:_keyinContext:_ctx]): removed useless method.
([SOGoMailFolder -lookupName:_keyinContext:acquire:_acquire]):
folder names now always start with "folder".
* SoObjects/Mailer/SOGoMailAccount.m
([-lookupName:inContext:acquire:]): folder names now always start
with "folder".
2007-07-27 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailForwardAction.m ([UIxMailForwardAction

1
NEWS
View File

@ -8,6 +8,7 @@
entries whenever a specific one is being requested;
- added support for limiting LDAP queries with the SOGoLDAPQueryLimit and
the SOGoLDAPSizeLimit settings;
- fixed a bug where folders starting with digits would not be displayed;
0.9.0-20070713
--------------

View File

@ -235,29 +235,34 @@ static BOOL useAltNamespace = NO;
inContext:_ctx];
}
- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
- (id) lookupName: (NSString *) _key
inContext: (id)_ctx
acquire: (BOOL) _flag
{
NSString *folderName;
id obj;
/* first check attributes directly bound to the application */
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]) != nil)
return obj;
if ([_key hasPrefix: @"folder"])
{
folderName = [_key substringFromIndex: 6];
// TODO: those should be product.plist bindings? (can't be class bindings
// though because they are 'per-account')
if ([_key isEqualToString: draftsFolderName]) {
if ((obj = [self lookupDraftsFolder:_key inContext:_ctx]) != nil)
return obj;
}
if ([_key isEqualToString: sieveFolderName]) {
if ((obj = [self lookupFiltersFolder:_key inContext:_ctx]) != nil)
return obj;
}
if ((obj = [self lookupImap4Folder:_key inContext:_ctx]) != nil)
return obj;
if ([folderName isEqualToString: draftsFolderName])
obj = [self lookupDraftsFolder: folderName inContext: _ctx];
else if ([folderName isEqualToString: sieveFolderName])
obj = [self lookupFiltersFolder: folderName inContext: _ctx];
else
obj = [self lookupImap4Folder: folderName inContext: _ctx];
}
else
obj = [super lookupName: _key inContext: _ctx acquire: NO];
/* return 404 to stop acquisition */
return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
if (!obj)
obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */];
return obj;
}
/* special folders */

View File

@ -33,13 +33,13 @@
The SOGoMailFolder maps to an IMAP4 folder from NGImap4.
*/
@class NSData, NSArray, NSException;
@class NSData, NSArray, NSException, NSMutableArray;
@class NGImap4MailboxInfo;
@interface SOGoMailFolder : SOGoMailBaseObject
{
NSArray *filenames;
NSString *folderType;
NSMutableArray *filenames;
NSString *folderType;
}
/* messages */

View File

@ -151,34 +151,26 @@ static BOOL useAltNamespace = NO;
- (NSArray *) toOneRelationshipKeys
{
NSArray *uids;
unsigned count;
if (filenames != nil)
return [filenames isNotNull] ? filenames : nil;
NSArray *uids;
unsigned int count, max;
NSString *filename;
uids = [self fetchUIDsMatchingQualifier:nil sortOrdering:@"DATE"];
if ([uids isKindOfClass:[NSException class]])
return nil;
if ((count = [uids count]) == 0) {
filenames = [[NSArray alloc] init];
}
else {
NSMutableArray *keys;
unsigned i;
keys = [[NSMutableArray alloc] initWithCapacity:count];
for (i = 0; i < count; i++) {
NSString *k;
k = [[uids objectAtIndex:i] stringValue];
k = [k stringByAppendingString:@".mail"];
[keys addObject:k];
if (!filenames)
{
filenames = [NSMutableArray new];
uids = [self fetchUIDsMatchingQualifier: nil sortOrdering: @"DATE"];
if (![uids isKindOfClass: [NSException class]])
{
max = [uids count];
for (count = 0; count < max; count++)
{
filename = [NSString stringWithFormat: @"%@.mail",
[uids objectAtIndex: count]];
[filenames addObject: filename];
}
}
}
filenames = [keys copy];
[keys release];
}
return filenames;
}
@ -230,27 +222,6 @@ static BOOL useAltNamespace = NO;
/* name lookup */
- (BOOL) isMessageKey: (NSString *) _key
inContext: (id) _ctx
{
/*
Every key starting with a digit is consider an IMAP4 message key. This is
not entirely correct since folders could also start with a number.
If we want to support folders beginning with numbers, we would need to
scan the folder list for the _key, which would make everything quite a bit
slower.
TODO: support this mode using a default.
*/
if ([_key length] == 0)
return NO;
if (isdigit([_key characterAtIndex:0]))
return YES;
return NO;
}
- (id) lookupImap4Folder: (NSString *) _key
inContext: (id) _ctx
{
@ -291,28 +262,22 @@ static BOOL useAltNamespace = NO;
acquire: (BOOL) _acquire
{
id obj;
if ([self isMessageKey:_key inContext:_ctx]) {
/*
We assume here that _key is a number and methods are not and this is
moved above the super lookup since the super checks the
-toOneRelationshipKeys which in turn loads the message ids.
*/
return [self lookupImap4Message:_key inContext:_ctx];
}
obj = [self lookupImap4Folder:_key inContext:_ctx];
if (obj != nil)
return obj;
/* check attributes directly bound to the app */
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
return obj;
/* return 404 to stop acquisition */
return _acquire
? [NSException exceptionWithHTTPStatus:404 /* Not Found */]
: nil; /* hack to work with WebDAV move */
if ([_key hasPrefix: @"folder"])
obj = [self lookupImap4Folder: [_key substringFromIndex: 6]
inContext: _ctx];
else
{
if (isdigit ([_key characterAtIndex: 0]))
obj = [self lookupImap4Message: _key inContext: _ctx];
else
obj = [super lookupName: _key inContext: _ctx acquire: NO];
}
if (!obj && _acquire)
obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */];
return obj;
}
/* WebDAV */

View File

@ -26,10 +26,11 @@ var MailerUIdTreeExtension = {
var thisCounter = this.elementCounter;
var fullName = "";
var currentFolder = folder;
while (currentFolder) {
fullName = "/" + currentFolder.name + fullName;
while (currentFolder.parentFolder) {
fullName = "/folder" + currentFolder.name + fullName;
currentFolder = currentFolder.parentFolder;
}
fullName = "/" + currentFolder.name + fullName;
this._addFolderNode(parent, folder.name, fullName, folder.type);
for (var i = 0; i < folder.children.length; i++)
this._addFolder(thisCounter, folder.children[i]);

File diff suppressed because it is too large Load Diff