From fce8305229a59c1ac775a86d002a6276d3b4ca0d Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 26 Jan 2005 22:42:29 +0000 Subject: [PATCH] fixed SOGo bug #1054, deactivated some unused toolbar buttons git-svn-id: http://svn.opengroupware.org/SOGo/trunk@501 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/ChangeLog | 9 ++++ SOGo/SoObjects/Mailer/SOGoDraftObject.h | 2 +- SOGo/SoObjects/Mailer/SOGoDraftObject.m | 2 +- SOGo/SoObjects/Mailer/SOGoDraftsFolder.h | 3 +- SOGo/SoObjects/Mailer/SOGoMailAccount.h | 3 +- SOGo/SoObjects/Mailer/SOGoMailAccount.m | 12 +++-- SOGo/SoObjects/Mailer/SOGoMailBaseObject.h | 2 +- SOGo/SoObjects/Mailer/SOGoMailBaseObject.m | 3 +- SOGo/SoObjects/Mailer/SOGoMailFolder.h | 6 ++- SOGo/SoObjects/Mailer/SOGoMailFolder.m | 9 +++- SOGo/SoObjects/Mailer/SOGoMailManager.h | 5 +- SOGo/SoObjects/Mailer/SOGoMailManager.m | 29 ++++++++++- SOGo/SoObjects/Mailer/Version | 2 +- SOGo/UI/Mailer/ChangeLog | 7 +++ SOGo/UI/Mailer/UIxMailEditor.m | 59 ++++++++++++++++++---- SOGo/UI/Mailer/UIxMailListView.m | 2 +- SOGo/UI/Mailer/Version | 13 ++--- SOGo/UI/Mailer/product.plist | 16 +++--- 18 files changed, 140 insertions(+), 44 deletions(-) diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index a8b3bf59..fed1b2af 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,12 @@ +2005-01-26 Helge Hess + + * v0.9.56 + + * SOGoMailManager.m, SOGoMailFolder.m: added method to save new + content in an SOGoMailFolder (to support #1054) + + * SOGoMailAccount.m: minor code cleanup + 2004-12-08 Marcus Mueller * SOGoMailAccount.m, SOGoMailBaseObject.m, SOGoMailObject.m, diff --git a/SOGo/SoObjects/Mailer/SOGoDraftObject.h b/SOGo/SoObjects/Mailer/SOGoDraftObject.h index 7f0393ed..0043021c 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftObject.h +++ b/SOGo/SoObjects/Mailer/SOGoDraftObject.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. diff --git a/SOGo/SoObjects/Mailer/SOGoDraftObject.m b/SOGo/SoObjects/Mailer/SOGoDraftObject.m index 14a92522..be9909bd 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftObject.m +++ b/SOGo/SoObjects/Mailer/SOGoDraftObject.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. diff --git a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h index b938b1dd..45f7f7e0 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __Mailer_SOGoDraftsFolder_H__ #define __Mailer_SOGoDraftsFolder_H__ diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccount.h b/SOGo/SoObjects/Mailer/SOGoMailAccount.h index 809e20a5..2a19c958 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccount.h +++ b/SOGo/SoObjects/Mailer/SOGoMailAccount.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: SOGoMailAccount.h 274 2004-08-26 13:10:49Z znek $ #ifndef __Mailer_SOGoMailAccount_H__ #define __Mailer_SOGoMailAccount_H__ diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccount.m b/SOGo/SoObjects/Mailer/SOGoMailAccount.m index ed47e522..ae5e3353 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccount.m +++ b/SOGo/SoObjects/Mailer/SOGoMailAccount.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: SOGoMailAccount.m 274 2004-08-26 13:10:49Z znek $ #include "SOGoMailAccount.h" #include "SOGoMailFolder.h" @@ -28,6 +27,9 @@ @implementation SOGoMailAccount +static NSString *draftsFolderName = @"Drafts"; +static NSString *sieveFolderName = @"Filters"; + /* listing the available folders */ - (NSArray *)toManyRelationshipKeys { @@ -48,7 +50,7 @@ - (NSArray *)allFolderPathes { NSArray *pathes; - + pathes = [[self mailManager] allFoldersForURL:[self imap4URL] password:[self imap4Password]]; pathes = [pathes sortedArrayUsingSelector:@selector(compare:)]; @@ -120,11 +122,11 @@ // TODO: those should be product.plist bindings? (can't be class bindings // though because they are 'per-account') - if ([_key isEqualToString:@"Drafts"]) { + if ([_key isEqualToString:draftsFolderName]) { if ((obj = [self lookupDraftsFolder:_key inContext:_ctx]) != nil) return obj; } - if ([_key isEqualToString:@"Filters"]) { + if ([_key isEqualToString:sieveFolderName]) { if ((obj = [self lookupFiltersFolder:_key inContext:_ctx]) != nil) return obj; } diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h index b98e4445..8aca72f6 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m index e2642291..1e72e834 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "SOGoMailBaseObject.h" #include "SOGoMailManager.h" diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.h b/SOGo/SoObjects/Mailer/SOGoMailFolder.h index 321dbf9e..ad9d6acb 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -33,7 +33,7 @@ The SOGoMailFolder maps to an IMAP4 folder from NGImap4. */ -@class NSArray; +@class NSData, NSArray, NSException; @interface SOGoMailFolder : SOGoMailBaseObject { @@ -45,6 +45,8 @@ - (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so; - (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts; +- (NSException *)postData:(NSData *)_data flags:(id)_flags; + @end #endif /* __Mailer_SOGoMailFolder_H__ */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index 6aa2b564..5b5d87c3 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "SOGoMailFolder.h" #include "SOGoMailObject.h" @@ -91,6 +90,12 @@ password:[self imap4Password]]; } +- (NSException *)postData:(NSData *)_data flags:(id)_flags { + return [[self mailManager] postData:_data flags:_flags + toFolderURL:[self imap4URL] + password:[self imap4Password]]; +} + /* name lookup */ - (BOOL)isMessageKey:(NSString *)_key inContext:(id)_ctx { diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.h b/SOGo/SoObjects/Mailer/SOGoMailManager.h index 0c7d0a95..baa3bcbc 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.h +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -72,6 +72,9 @@ - (NSException *)addFlags:(id)_f toURL:(NSURL *)_u password:(NSString *)_p; - (NSException *)removeFlags:(id)_f toURL:(NSURL *)_u password:(NSString *)_p; +- (NSException *)postData:(NSData *)_data flags:(id)_flags + toFolderURL:(NSURL *)_url password:(NSString *)_p; + /* managing folders */ - (NSException *)createMailbox:(NSString *)_mailbox atURL:(NSURL *)_url diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.m b/SOGo/SoObjects/Mailer/SOGoMailManager.m index a7857447..633504b8 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.m +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -616,6 +616,33 @@ static NSString *imap4Separator = nil; return [self addOrRemove:NO flags:_f toURL:_u password:_p]; } +- (NSException *)postData:(NSData *)_data flags:(id)_f + toFolderURL:(NSURL *)_url password:(NSString *)_p +{ + NGImap4Client *client; + id result; + + if (![_url isNotNull]) return nil; + if (![_f isNotNull]) _f = [NSArray array]; + + if ((client = [self imap4ClientForURL:_url password:_p]) == nil) + return nil; + + if (![_f isKindOfClass:[NSArray class]]) + _f = [NSArray arrayWithObjects:&_f count:1]; + + result = [client append:_data + toFolder:[self imap4FolderNameForURL:_url] + withFlags:_f]; + if (![[result valueForKey:@"result"] boolValue]) { + [self logWithFormat:@"DEBUG: fail result %@", result]; + return [NSException exceptionWithHTTPStatus:500 /* server error */ + reason:@"failed to store message to IMAP4 message"]; + } + /* result contains 'fetch' key with the current flags */ + return nil; +} + /* managing folders */ - (BOOL)isPermissionDeniedResult:(id)_result { diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 0c661614..73743e43 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=55 +SUBMINOR_VERSION:=56 # v0.9.55 requires NGExtensions v4.5.136 # v0.9.44 requires libNGMime v4.3.194 diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 7f8b7da4..e06572d1 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,12 @@ 2005-01-26 Helge Hess + * v0.9.75 + + * UIxMailEditor.m: copy sent mails to INBOX/Sent folder, fixes issue + #1054 + + * product.plist: disabled unsupported delete button in mailviewer + * UIxMailListView.wox: removed unused mail checkboxes and folder-tree popup (#1211) (v0.9.74) diff --git a/SOGo/UI/Mailer/UIxMailEditor.m b/SOGo/UI/Mailer/UIxMailEditor.m index 0343236a..449d0aaa 100644 --- a/SOGo/UI/Mailer/UIxMailEditor.m +++ b/SOGo/UI/Mailer/UIxMailEditor.m @@ -28,6 +28,7 @@ */ @class NSArray, NSString; +@class SOGoMailFolder; @interface UIxMailEditor : UIxComponent { @@ -36,11 +37,14 @@ NSArray *bcc; NSString *subject; NSString *text; + SOGoMailFolder *sentFolder; } @end #include +#include +#include #include #include #include "common.h" @@ -52,7 +56,6 @@ @implementation UIxMailEditor static BOOL keepMailTmpFile = NO; -static BOOL keepDraftAfterSend = NO; static NSArray *infoKeys = nil; + (void)initialize { @@ -60,12 +63,13 @@ static NSArray *infoKeys = nil; @"subject", @"text", @"to", @"cc", @"bcc", @"from", @"replyTo", nil]; - + if (keepMailTmpFile) NSLog(@"WARNING: keeping mail files."); } - (void)dealloc { + [self->sentFolder release]; [self->text release]; [self->subject release]; [self->to release]; @@ -154,9 +158,48 @@ static NSArray *infoKeys = nil; return nil; } +- (id)lookupSentFolder { + /* lookup INBOX/Sent folder */ + SOGoMailAccount *account; + SOGoMailFolder *folder; + + if (self->sentFolder != nil) + return self; + + account = [[self clientObject] mailAccountFolder]; + if ([account isKindOfClass:[NSException class]]) return account; + + folder = [account lookupName:@"INBOX" inContext:[self context] acquire:NO]; + if ([folder isKindOfClass:[NSException class]]) return folder; + + folder = [folder lookupName:@"Sent" inContext:[self context] acquire:NO]; + if ([folder isKindOfClass:[NSException class]]) return folder; + + if (![folder isNotNull]) { + return [NSException exceptionWithHTTPStatus:500 /* server error */ + reason:@"did not find Sent folder!"]; + } + + self->sentFolder = [folder retain]; + return self->sentFolder; +} + - (NSException *)storeMailInSentFolder:(NSString *)_path { - [self logWithFormat:@"TODO: store mail in Sent folder: %@", _path]; - return nil; + SOGoMailFolder *folder; + NSData *data; + id result; + + folder = [self lookupSentFolder]; + if ([folder isKindOfClass:[NSException class]]) return (id)folder; + + if ((data = [[NSData alloc] initWithContentsOfMappedFile:_path]) == nil) { + return [NSException exceptionWithHTTPStatus:500 /* server error */ + reason:@"could not temporary draft file!"]; + } + + result = [folder postData:data flags:@"seen"]; + [data release]; data = nil; + return result; } /* actions */ @@ -239,13 +282,9 @@ static NSArray *infoKeys = nil; /* delete draft */ - if (keepDraftAfterSend) { - [self warnWithFormat:@"keeping draft object: '%@'", - [self clientObject]]; - } - else if ((error = [[self clientObject] delete]) != nil) + if ((error = [[self clientObject] delete]) != nil) return error; - + // if everything is ok, close the window (send a JS closing the Window) return [self pageWithName:@"UIxMailWindowCloser"]; } diff --git a/SOGo/UI/Mailer/UIxMailListView.m b/SOGo/UI/Mailer/UIxMailListView.m index 4b58be58..ca08bb2c 100644 --- a/SOGo/UI/Mailer/UIxMailListView.m +++ b/SOGo/UI/Mailer/UIxMailListView.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index e1738a6e..fa87263e 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,9 +1,10 @@ # version file -SUBMINOR_VERSION:=74 +SUBMINOR_VERSION:=75 -# v0.9.70 requires NGExtensions v4.5.136 -# v0.9.69 requires libNGMime v4.5.203 -# v0.9.50 requires libNGMime v4.3.190 -# v0.9.43 requires libNGObjWeb v4.3.73 -# v0.9.42 requires libNGObjWeb v4.3.72 +# v0.9.74 requires SoObjects/Mailer v0.9.56 +# v0.9.70 requires NGExtensions v4.5.136 +# v0.9.69 requires libNGMime v4.5.203 +# v0.9.50 requires libNGMime v4.3.190 +# v0.9.43 requires libNGObjWeb v4.3.73 +# v0.9.42 requires libNGObjWeb v4.3.72 diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index 75492f06..78084786 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -103,14 +103,16 @@ { link = "#"; cssClass = "tbicon_forward"; label = "Forward"; }, ), */ - ( /* third group */ +/* TODO: enable when implemented + ( // third group +// TODO: enable when delete works (#1212) { link = "#"; cssClass = "tbicon_delete"; label = "Delete"; }, -/* TODO: enable when we know how to mark junk (#971) +// TODO: enable when we know how to mark junk (#971) { link = "#"; cssClass = "tbicon_junk"; label = "Junk"; }, -*/ ), +*/ ( /* fourth group */ /* TODO: enable when we can print (#1207) { link = "#"; cssClass = "tbicon_print"; label = "Print"; }, @@ -175,14 +177,16 @@ cssClass = "tbicon_forward"; label = "Forward"; }, ), */ - ( /* third group */ +/* TODO: enable when implemented + ( // third group +// TODO: enable when delete works (#1212) { link = "#"; cssClass = "tbicon_delete"; label = "Delete"; }, -/* TODO: enable when we know how to mark junk (#971) +// TODO: enable when we know how to mark junk (#971) { link = "#"; cssClass = "tbicon_junk"; label = "Junk"; }, -*/ ), +*/ ( /* fourth group */ /* TODO: enable when we can print (#1207) { link = "#"; cssClass = "tbicon_print"; label = "Print"; }, -- 2.39.5