See ChangeLog
Monotone-Parent: a0f83515485c5754a47ce96dd157fbafe1cdd459 Monotone-Revision: b4cdf2c0fe2ace70d873c007f3fd15f64aa0f91a Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-03-13T19:48:15 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
624ff85d71
commit
c3bc74e116
|
@ -1,3 +1,8 @@
|
|||
2009-03-13 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* Optimized the IMAP client code to avoid
|
||||
unnecessary STATUS calls.
|
||||
|
||||
2009-03-12 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* Updated the SOPE patchset in order to
|
||||
|
|
|
@ -388,6 +388,13 @@ static BOOL showTextAttachmentsInline = NO;
|
|||
message = [self mimeMessageAsData];
|
||||
|
||||
client = [[self imap4Connection] client];
|
||||
|
||||
if (![imap4 doesMailboxExistAtURL: [container imap4URL]])
|
||||
{
|
||||
[client create: [container relativeImap4Name]];
|
||||
[imap4 flushFolderHierarchyCache];
|
||||
}
|
||||
|
||||
folder = [imap4 imap4FolderNameForURL: [container imap4URL]];
|
||||
result
|
||||
= [client append: message toFolder: folder
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
/*
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
Copyright (C) 2007-2009 Inverse inc.
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
This file is part of SOGo.
|
||||
|
||||
OGo is free software; you can redistribute it and/or modify it under
|
||||
SOGo 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
|
||||
SOGo 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.
|
||||
|
@ -338,8 +339,6 @@ static NSString *fallbackIMAP4Server = nil;
|
|||
else if ([folderName
|
||||
isEqualToString: [self trashFolderNameInContext: _ctx]])
|
||||
klazz = [SOGoTrashFolder class];
|
||||
/* else if ([folderName isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
||||
obj = [self lookupFiltersFolder: _key inContext: _ctx]; */
|
||||
else
|
||||
klazz = [SOGoMailFolder class];
|
||||
|
||||
|
|
|
@ -289,7 +289,18 @@ static NSString *spoolFolder = nil;
|
|||
client = [[self imap4Connection] client];
|
||||
[imap4 selectFolder: [self imap4URL]];
|
||||
folderName = [imap4 imap4FolderNameForURL: [trashFolder imap4URL]];
|
||||
result = [client copyUids: uids toFolder: folderName];
|
||||
|
||||
// If our Trash folder doesn't exist when we try to copy messages
|
||||
// to it, we create it.
|
||||
result = [[client status: folderName flags: [NSArray arrayWithObject: @"UIDVALIDITY"]]
|
||||
objectForKey: @"result"];
|
||||
|
||||
if (![result boolValue])
|
||||
result = [[self imap4Connection] createMailbox: folderName atURL: [[self mailAccountFolder] imap4URL]];
|
||||
|
||||
if (!result || [result boolValue])
|
||||
result = [client copyUids: uids toFolder: folderName];
|
||||
|
||||
if ([[result valueForKey: @"result"] boolValue])
|
||||
{
|
||||
result = [client storeFlags: [NSArray arrayWithObject: @"Deleted"]
|
||||
|
@ -423,7 +434,15 @@ static NSString *spoolFolder = nil;
|
|||
client = [[self imap4Connection] client];
|
||||
[imap4 selectFolder: [self imap4URL]];
|
||||
|
||||
result = [client copyUids: uids toFolder: imapDestinationFolder];
|
||||
// We make sure the destination IMAP folder exist, if not, we create it.
|
||||
result = [[client status: imapDestinationFolder flags: [NSArray arrayWithObject: @"UIDVALIDITY"]]
|
||||
objectForKey: @"result"];
|
||||
|
||||
if (![result boolValue])
|
||||
result = [[self imap4Connection] createMailbox: imapDestinationFolder atURL: [[self mailAccountFolder] imap4URL]];
|
||||
|
||||
if (!result || [result boolValue])
|
||||
result = [client copyUids: uids toFolder: imapDestinationFolder];
|
||||
|
||||
if ([[result valueForKey: @"result"] boolValue])
|
||||
result = nil;
|
||||
|
@ -475,8 +494,15 @@ static NSString *spoolFolder = nil;
|
|||
- (NSException *) postData: (NSData *) _data
|
||||
flags: (id) _flags
|
||||
{
|
||||
return [[self imap4Connection] postData: _data flags: _flags
|
||||
toFolderURL: [self imap4URL]];
|
||||
// We check for the existence of the IMAP folder (likely to be the
|
||||
// Sent mailbox) prior to appending messages to it.
|
||||
if ([[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]] ||
|
||||
![[self imap4Connection] createMailbox: [self relativeImap4Name] atURL: [[self mailAccountFolder] imap4URL]])
|
||||
return [[self imap4Connection] postData: _data flags: _flags
|
||||
toFolderURL: [self imap4URL]];
|
||||
|
||||
return [NSException exceptionWithHTTPStatus: 502 /* Bad Gateway */
|
||||
reason: [NSString stringWithFormat: @"%@ is not an IMAP4 folder", [self relativeImap4Name]]];
|
||||
}
|
||||
|
||||
- (NSException *) expunge
|
||||
|
@ -577,7 +603,12 @@ static NSString *spoolFolder = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
if ([[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]])
|
||||
// We automatically create mailboxes that don't exist but that we're
|
||||
// trying to open. This shouldn't happen unless a mailbox has been
|
||||
// deleted "behind our back" or if we're trying to open a special
|
||||
// mailbox that doesn't yet exist.
|
||||
if ([[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]] ||
|
||||
![[self imap4Connection] createMailbox: [self relativeImap4Name] atURL: [[self mailAccountFolder] imap4URL]])
|
||||
{
|
||||
if (isdigit ([_key characterAtIndex: 0]))
|
||||
obj = [SOGoMailObject objectWithName: _key inContainer: self];
|
||||
|
@ -1069,20 +1100,6 @@ static NSString *spoolFolder = nil;
|
|||
|
||||
@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;
|
||||
|
|
Loading…
Reference in New Issue