diff --git a/ChangeLog b/ChangeLog index 7650d9006..89689825a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,23 @@ +2009-03-13 Ludovic Marcotte + + * Optimized the IMAP client code to avoid + unnecessary STATUS calls. + 2009-03-12 Ludovic Marcotte * Updated the SOPE patchset in order to fix a bug in NGMimeBodyParser. + * Updated again the SOPE patchset to enable + MySQL support. + +2009-03-11 Francis Lachapelle + + * UI/MainUI/SOGoUserHomePage.m ([SOGoUserHomePage + -readFreeBusyAction]): we now set the content-type to "text/plain" + to fix issues with nginx. + + * UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView + -contactSearchAction]): idem. 2009-03-11 Ludovic Marcotte diff --git a/SOPE/sope-patchset-r1630.diff b/SOPE/sope-patchset-r1630.diff index 2a193301f..cb8d195b6 100644 --- a/SOPE/sope-patchset-r1630.diff +++ b/SOPE/sope-patchset-r1630.diff @@ -42,6 +42,62 @@ Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m @end /* PostgreSQL72Channel */ @implementation PostgreSQL72Channel(PrimaryKeyGeneration) +Index: sope-gdl1/MySQL/MySQL4Channel.m +=================================================================== +--- sope-gdl1/MySQL/MySQL4Channel.m (revision 1632) ++++ sope-gdl1/MySQL/MySQL4Channel.m (working copy) +@@ -755,6 +755,39 @@ + return pkey; + } + ++/* GCSEOAdaptorChannel protocol */ ++static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n" ++ @" c_content VARCHAR (100000) NOT NULL,\n" ++ @" c_creationdate INT NOT NULL,\n" ++ @" c_lastmodified INT NOT NULL,\n" ++ @" c_version INT NOT NULL,\n" ++ @" c_deleted INT NULL\n" ++ @")"); ++static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_uid VARCHAR (256) NOT NULL,\n" ++ @" c_object VARCHAR (256) NOT NULL,\n" ++ @" c_role VARCHAR (80) NOT NULL\n" ++ @")"); ++ ++- (NSException *) createGCSFolderTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ ++- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ + @end /* MySQL4Channel */ + + void __link_MySQL4Channel() { +Index: sope-gdl1/GDLAccess/EOAdaptor.m +=================================================================== +--- sope-gdl1/GDLAccess/EOAdaptor.m (revision 1632) ++++ sope-gdl1/GDLAccess/EOAdaptor.m (working copy) +@@ -202,6 +202,7 @@ + if ([_scheme isEqualToString:@"sybase"]) return @"Sybase10"; + if ([_scheme isEqualToString:@"sqlite"]) return @"SQLite3"; + if ([_scheme isEqualToString:@"oracle"]) return @"Oracle8"; ++ if ([_scheme isEqualToString:@"mysql"]) return @"MySQL"; + + if ([_scheme isEqualToString:@"http"]) { + NSLog(@"WARNING(%s): asked for 'http' URL, " Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m =================================================================== --- sope-gdl1/Oracle8/OracleAdaptorChannel.m (revision 1632) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index e36d98348..67f52bf9c 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -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 diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 6d6274c05..11e5857a6 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -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]; diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index 814c8c353..1b0b3d1f4 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -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; diff --git a/UI/WebServerResources/SOGoDragHandles.js b/UI/WebServerResources/SOGoDragHandles.js index 2633a57b1..081f70038 100644 --- a/UI/WebServerResources/SOGoDragHandles.js +++ b/UI/WebServerResources/SOGoDragHandles.js @@ -71,7 +71,7 @@ var SOGoDragHandlesInterface = { this.origY = this.offsetTop; this.origUpper = this.upperBlock.offsetHeight; var pointY = Event.pointerY(event); - if (pointY <= this.topMargin) this.delta = this.topMargin; + if (pointY < this.topMargin) this.delta = this.topMargin; else this.delta = pointY - this.offsetTop - 5; this.origLower = this.lowerBlock.offsetTop - 5; document.body.setStyle({ cursor: "n-resize" });