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> 2007-07-27 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailForwardAction.m ([UIxMailForwardAction * UI/MailerUI/UIxMailForwardAction.m ([UIxMailForwardAction

1
NEWS
View File

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

View File

@ -235,29 +235,34 @@ static BOOL useAltNamespace = NO;
inContext:_ctx]; 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; id obj;
/* first check attributes directly bound to the application */ if ([_key hasPrefix: @"folder"])
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]) != nil) {
return obj; folderName = [_key substringFromIndex: 6];
// 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: draftsFolderName]) { if ([folderName isEqualToString: draftsFolderName])
if ((obj = [self lookupDraftsFolder:_key inContext:_ctx]) != nil) obj = [self lookupDraftsFolder: folderName inContext: _ctx];
return obj; else if ([folderName isEqualToString: sieveFolderName])
} obj = [self lookupFiltersFolder: folderName inContext: _ctx];
if ([_key isEqualToString: sieveFolderName]) { else
if ((obj = [self lookupFiltersFolder:_key inContext:_ctx]) != nil) obj = [self lookupImap4Folder: folderName inContext: _ctx];
return obj; }
} else
obj = [super lookupName: _key inContext: _ctx acquire: NO];
if ((obj = [self lookupImap4Folder:_key inContext:_ctx]) != nil)
return obj;
/* return 404 to stop acquisition */ /* return 404 to stop acquisition */
return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; if (!obj)
obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */];
return obj;
} }
/* special folders */ /* special folders */

View File

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

View File

@ -151,34 +151,26 @@ static BOOL useAltNamespace = NO;
- (NSArray *) toOneRelationshipKeys - (NSArray *) toOneRelationshipKeys
{ {
NSArray *uids; NSArray *uids;
unsigned count; unsigned int count, max;
NSString *filename;
if (filenames != nil)
return [filenames isNotNull] ? filenames : nil;
uids = [self fetchUIDsMatchingQualifier:nil sortOrdering:@"DATE"]; if (!filenames)
if ([uids isKindOfClass:[NSException class]]) {
return nil; filenames = [NSMutableArray new];
uids = [self fetchUIDsMatchingQualifier: nil sortOrdering: @"DATE"];
if ((count = [uids count]) == 0) { if (![uids isKindOfClass: [NSException class]])
filenames = [[NSArray alloc] init]; {
} max = [uids count];
else { for (count = 0; count < max; count++)
NSMutableArray *keys; {
unsigned i; filename = [NSString stringWithFormat: @"%@.mail",
[uids objectAtIndex: count]];
keys = [[NSMutableArray alloc] initWithCapacity:count]; [filenames addObject: filename];
for (i = 0; i < count; i++) { }
NSString *k; }
k = [[uids objectAtIndex:i] stringValue];
k = [k stringByAppendingString:@".mail"];
[keys addObject:k];
} }
filenames = [keys copy];
[keys release];
}
return filenames; return filenames;
} }
@ -230,27 +222,6 @@ static BOOL useAltNamespace = NO;
/* name lookup */ /* 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 - (id) lookupImap4Folder: (NSString *) _key
inContext: (id) _ctx inContext: (id) _ctx
{ {
@ -291,28 +262,22 @@ static BOOL useAltNamespace = NO;
acquire: (BOOL) _acquire acquire: (BOOL) _acquire
{ {
id obj; 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 ([_key hasPrefix: @"folder"])
if (obj != nil) obj = [self lookupImap4Folder: [_key substringFromIndex: 6]
return obj; inContext: _ctx];
else
/* check attributes directly bound to the app */ {
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO])) if (isdigit ([_key characterAtIndex: 0]))
return obj; obj = [self lookupImap4Message: _key inContext: _ctx];
else
/* return 404 to stop acquisition */ obj = [super lookupName: _key inContext: _ctx acquire: NO];
return _acquire }
? [NSException exceptionWithHTTPStatus:404 /* Not Found */]
: nil; /* hack to work with WebDAV move */ if (!obj && _acquire)
obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */];
return obj;
} }
/* WebDAV */ /* WebDAV */

View File

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

File diff suppressed because it is too large Load Diff