From 9b4d2188f715e4840ef39ca8a25556753214bd45 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 8 Feb 2005 17:54:21 +0000 Subject: [PATCH] improved reload on draft delete, implemented first reply/reply-all git-svn-id: http://svn.opengroupware.org/SOGo/trunk@534 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/SOGoDraftsFolder.m | 3 +- SOGo/UI/Mailer/ChangeLog | 15 +++++++ SOGo/UI/Mailer/UIxMailEditor.m | 11 ++++- SOGo/UI/Mailer/UIxMailEditorAction.m | 54 ++++++++++++++++++------ SOGo/UI/Mailer/Version | 2 +- SOGo/UI/Mailer/mailer.js | 2 + SOGo/UI/Mailer/product.plist | 5 +-- 7 files changed, 72 insertions(+), 20 deletions(-) diff --git a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m index 3d1d9dc6..0f10cd21 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m @@ -114,8 +114,7 @@ static NSString *spoolFolder = nil; return [NSArray array]; } - [self logWithFormat:@"TODO: should sort uids (q=%@,so=%@): %@", _q, _so, - allUids]; + // TODO: should sort uids (q=%@,so=%@): %@", _q, _so, allUids]; return allUids; } - (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts { diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 8fd5d3d0..b5a89229 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,20 @@ 2005-02-08 Helge Hess + * v0.9.95 + + * product.plist: do not use clickedEditorDelete() JS function for + draft delete but just call the link + + * UIxMailEditor.m: a successful draft delete now returns the window + closer and refreshes the opener + + * mailer.js now reloads the opener for editor-save and editor-delete + functions (does not properly work since the form load is async) + + * UIxMailEditorAction.m, product.plist: implemented simple + reply/reply-all processing (subject and recipient handling is in + place, content quoting is pending) + * v0.9.94 * UIxMailListView.m: properly show "to" address in tableview for diff --git a/SOGo/UI/Mailer/UIxMailEditor.m b/SOGo/UI/Mailer/UIxMailEditor.m index 568a5d91..e7ac4f78 100644 --- a/SOGo/UI/Mailer/UIxMailEditor.m +++ b/SOGo/UI/Mailer/UIxMailEditor.m @@ -344,11 +344,20 @@ static NSArray *infoKeys = nil; - (id)deleteAction { NSException *error; + id page; if ((error = [[self clientObject] delete]) != nil) return error; - return nil; +#if 1 + page = [self pageWithName:@"UIxMailWindowCloser"]; + [page takeValue:@"YES" forKey:@"refreshOpener"]; + return page; +#else + // TODO: if we just return nil, we produce a 500 + return [NSException exceptionWithHTTPStatus:204 /* No Content */ + reason:@"object was deleted."]; +#endif } @end /* UIxMailEditor */ diff --git a/SOGo/UI/Mailer/UIxMailEditorAction.m b/SOGo/UI/Mailer/UIxMailEditorAction.m index 675a673c..99ce1312 100644 --- a/SOGo/UI/Mailer/UIxMailEditorAction.m +++ b/SOGo/UI/Mailer/UIxMailEditorAction.m @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include "common.h" @implementation UIxMailEditorAction @@ -205,19 +207,54 @@ return [@"Re: " stringByAppendingString:_subject]; } +- (void)addEMailsOfAddresses:(NSArray *)_addrs toArray:(NSMutableArray *)_ma { + unsigned i, count; + + for (i = 0, count = [_addrs count]; i < count; i++) + [_ma addObject:[(NGImap4EnvelopeAddress *)[_addrs objectAtIndex:i] email]]; +} + - (void)fillInReplyAddresses:(NSMutableDictionary *)_info replyToAll:(BOOL)_replyToAll envelope:(NGImap4Envelope *)_envelope { /* - The rules (as checked against Thunderbird): + The rules as implemented by Thunderbird: - if there is a 'reply-to' header, only include that (as TO) - if we reply to all, all non-from addresses are added as CC - the from is always the lone TO (except for reply-to) - + + Note: we cannot check reply-to, because Cyrus even sets a reply-to in the + envelope if none is contained in the message itself! (bug or + feature?) + TODO: what about sender (RFC 822 3.6.2) */ - [self logWithFormat:@"env: %@", _envelope]; + NSMutableArray *to; + NSArray *addrs; + + to = [NSMutableArray arrayWithCapacity:2]; + + /* first check for "reply-to" */ + + addrs = [_envelope replyTo]; + if ([addrs count] == 0) { + /* no "reply-to", try "from" */ + addrs = [_envelope from]; + } + [self addEMailsOfAddresses:addrs toArray:to]; + [_info setObject:to forKey:@"to"]; + + /* CC processing if we reply-to-all: add all 'to' and 'cc' */ + + if (_replyToAll) { + to = [NSMutableArray arrayWithCapacity:8]; + + [self addEMailsOfAddresses:[_envelope to] toArray:to]; + [self addEMailsOfAddresses:[_envelope cc] toArray:to]; + + [_info setObject:to forKey:@"cc"]; + } } - (id)replyToAll:(BOOL)_replyToAll { @@ -251,24 +288,17 @@ envelope:[[self clientObject] envelope]]; /* fill content */ + + // TODO: add quoted content /* save draft info */ - [self logWithFormat:@"INFO: %@", info]; - -#if 0 if ((error = [self->newDraft storeInfo:info]) != nil) return error; -#endif -#if 0 // TODO: we might want to pass the original URL to the editor for a final // redirect back to the message? result = [self redirectToEditNewDraft]; -#else - result = [NSException exceptionWithHTTPStatus:501 /* Not Implemented */ - reason:@"Sorry, reply is not yet implemented!"]; -#endif [self reset]; return result; } diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 0a00b142..f77e7465 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=94 +SUBMINOR_VERSION:=95 # v0.9.94 requires SoObjects/Mailer v0.9.69 # v0.9.94 requires libNGMime v4.5.210 diff --git a/SOGo/UI/Mailer/mailer.js b/SOGo/UI/Mailer/mailer.js index a902deba..046f2f22 100644 --- a/SOGo/UI/Mailer/mailer.js +++ b/SOGo/UI/Mailer/mailer.js @@ -93,12 +93,14 @@ function clickedEditorAttach(sender) { function clickedEditorSave(sender) { document.pageform.action="save"; document.pageform.submit(); + refreshOpener(); return true; } function clickedEditorDelete(sender) { document.pageform.action="delete"; document.pageform.submit(); + refreshOpener(); window.close(); return true; } diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index 1fcfefe6..bbc90876 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -175,12 +175,10 @@ cssClass = "tbicon_compose"; label = "Write"; }, ), ( // second group -///* TODO: enable when implemented { link = "reply"; cssClass = "tbicon_reply"; label = "Reply"; }, { link = "replyall"; cssClass = "tbicon_replyall"; label = "Reply All"; }, -//*/ { link = "forward"; cssClass = "tbicon_forward"; label = "Forward"; }, ), @@ -363,8 +361,7 @@ { link = "#"; onclick = "clickedEditorSave(this);return false;"; cssClass = "tbicon_save"; label = "Save"; }, - { link = "#"; - onclick = "clickedEditorDelete(this);return false;"; + { link = "delete"; cssClass = "tbicon_delete"; label = "Delete"; }, ) ); -- 2.39.5