2005-02-08 Helge Hess <helge.hess@opengroupware.org>
+ * 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
#include <SOGo/SoObjects/Mailer/SOGoDraftObject.h>
#include <SOGo/SoObjects/Mailer/SOGoMailAccount.h>
#include <SOGo/SoObjects/Mailer/SOGoMailObject.h>
+#include <NGImap4/NGImap4EnvelopeAddress.h>
+#include <NGImap4/NGImap4Envelope.h>
#include "common.h"
@implementation UIxMailEditorAction
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 {
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;
}
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"; },
),
{ link = "#";
onclick = "clickedEditorSave(this);return false;";
cssClass = "tbicon_save"; label = "Save"; },
- { link = "#";
- onclick = "clickedEditorDelete(this);return false;";
+ { link = "delete";
cssClass = "tbicon_delete"; label = "Delete"; },
)
);