]> err.no Git - scalable-opengroupware.org/commitdiff
improved reload on draft delete, implemented first reply/reply-all
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 8 Feb 2005 17:54:21 +0000 (17:54 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 8 Feb 2005 17:54:21 +0000 (17:54 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@534 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/SOGoDraftsFolder.m
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxMailEditor.m
SOGo/UI/Mailer/UIxMailEditorAction.m
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/mailer.js
SOGo/UI/Mailer/product.plist

index 3d1d9dc618b3ba228e060e3c15826e2541072409..0f10cd2126708b7448b487bb044e57a7bb467f26 100644 (file)
@@ -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 {
index 8fd5d3d0764d41d126259e6e7d08c52bf41166b6..b5a89229d59fb5e2a5eb8c39cf046d77a8f13ba5 100644 (file)
@@ -1,5 +1,20 @@
 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
index 568a5d912ec9fdb180f43c95f58cb68e459a07d1..e7ac4f78d24568914389bc1f9cd16b80cb6aaf94 100644 (file)
@@ -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 */
index 675a673cb3b5e9a2276be4e7980342900d3a2227..99ce1312e2c935a2ceb7630877131c712923d13d 100644 (file)
@@ -42,6 +42,8 @@
 #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;
 }
index 0a00b14216ab6a593c86c07196ae96d4a88ef3d7..f77e746514fab664e5e2a7fc7e5adb35388562d5 100644 (file)
@@ -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
index a902debaf7c688c4c5570707f6fca17b6cd0c326..046f2f22bba52def982309e45a8f31e67b9e1ed2 100644 (file)
@@ -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;
 }
index 1fcfefe679d910e5e42b8662e5e519541d338133..bbc9087624126acaebb13baed8f90dc4983d74ea 100644 (file)
                 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"; },
             )
           );