From a7996034ed95b5ba68c00fe53553d9a3943765fd Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 12 Mar 2009 21:49:15 +0000 Subject: [PATCH 1/4] Fix for bug #3292 Monotone-Parent: 59c4b0746cb2313cef5fff230f8824a9d48a2ee1 Monotone-Revision: 070042ab40f01de7dd4a39f28e1a9a445232baf0 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-03-12T21:49:15 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/SOGoDragHandles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" }); From 2d2722b5d09b63645a08d6cd1f7954c2f47ad468 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 12 Mar 2009 21:52:56 +0000 Subject: [PATCH 2/4] See ChangeLog Monotone-Parent: 7b1b22a765a78529ec87496fb491debd695fa9a4 Monotone-Revision: befc6f9bdb38e246b932d036f02e816264d80864 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-03-12T21:52:56 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7650d9006..4d86c19f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,15 @@ * Updated the SOPE patchset in order to fix a bug in NGMimeBodyParser. +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 * SoObjects/Appointments/SOGoAppointmentFolder.m From 624ff85d71597946c94feea70154431497827dda Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 12 Mar 2009 23:35:09 +0000 Subject: [PATCH 3/4] See ChangeLog Monotone-Parent: befc6f9bdb38e246b932d036f02e816264d80864 Monotone-Revision: a0f83515485c5754a47ce96dd157fbafe1cdd459 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-03-12T23:35:09 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 2 ++ SOPE/sope-patchset-r1630.diff | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4d86c19f4..8c06660f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * 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 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) From c3bc74e1165aee3bfa2e201b14ed04c8701feedf Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 13 Mar 2009 19:48:15 +0000 Subject: [PATCH 4/4] See ChangeLog Monotone-Parent: a0f83515485c5754a47ce96dd157fbafe1cdd459 Monotone-Revision: b4cdf2c0fe2ace70d873c007f3fd15f64aa0f91a Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-03-13T19:48:15 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++ SoObjects/Mailer/SOGoDraftObject.m | 7 ++++ SoObjects/Mailer/SOGoMailAccount.m | 9 +++-- SoObjects/Mailer/SOGoMailFolder.m | 55 +++++++++++++++++++----------- 4 files changed, 52 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c06660f0..89689825a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +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 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;