]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1146 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 9 Aug 2007 21:01:44 +0000 (21:01 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 9 Aug 2007 21:01:44 +0000 (21:01 +0000)
16 files changed:
ChangeLog
NEWS
SoObjects/Appointments/SOGoCalendarComponent.m
SoObjects/Appointments/SOGoTaskObject.m
SoObjects/Mailer/SOGoDraftObject.h
SoObjects/Mailer/SOGoDraftObject.m
SoObjects/Mailer/SOGoMailBaseObject.h
SoObjects/SOGo/GNUmakefile
SoObjects/SOGo/NSString+Utilities.h
SoObjects/SOGo/NSString+Utilities.m
SoObjects/SOGo/SOGoMailer.h [new file with mode: 0644]
SoObjects/SOGo/SOGoMailer.m [new file with mode: 0644]
UI/MailerUI/UIxMailAccountActions.m
UI/MailerUI/UIxMailFolderActions.m
UI/SOGoUI/SOGoACLAdvisory.m
UI/WebServerResources/MailerUI.js

index 3cb834313d36b24e3f0efe0ff72a9d69ddaf9e09..c9653a6b3144b8d0466973e722a83122cd212682 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
+2007-08-09  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/SOGo/NSString+Utilities.m ([NSString
+       -pureEMailAddress]): new utility method inspired by the
+       "_rawSender" private method in SOGoDraftObject, which it now
+       replaces.
+
+       * SoObjects/SOGo/SOGoMailer.m: new abstraction class module that
+       provides a common API for sending emails, no matter what the
+       transport is.
+
 2007-08-08  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
+       * UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions
+       -quotasAction]): invoke "relativeImap4Name" instead of
+       "nameInContainer" since the latter also returns the "folder"
+       prefix.
+
+       * UI/MailerUI/UIxMailAccountActions.m ([UIxMailAccountActions
+       -listMailboxesAction]): declare the output as text/plain in UTF-8.
+
        * UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions
        -deleteFolderAction]): fixed the url of the destination folder.
 
diff --git a/NEWS b/NEWS
index b4726756e7a20930e16d7a59df84857baf2963e4..3c5dfca9f9727a2566aa1c15dafc1226ceb9874a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@
 - fixed a bug where folders starting with digits would not be displayed;
 - improved IE7 and Safari support: priority menus, attendees selector;
 - added the ability to print messages from the mailer toolbar;
+- added the ability to use and configure SMTP as the email transport instead
+  of sendmail;
 
 0.9.0-20070713
 --------------
index 50e2c4758cd69e208861fdfa6e6e9923b3f8e9e1..808275d36565508e0246d6298e9a2af208f93464 100644 (file)
  */
 
 #import <Foundation/NSString.h>
+#import <Foundation/NSUserDefaults.h>
 
 #import <NGObjWeb/NSException+HTTP.h>
 #import <NGObjWeb/SoSecurityManager.h>
 #import <NGObjWeb/WOApplication.h>
 #import <NGObjWeb/WOContext+SoObjects.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NGHashMap.h>
 #import <NGCards/iCalCalendar.h>
 #import <NGCards/iCalPerson.h>
 #import <NGCards/iCalRepeatableEntityObject.h>
-#import <NGMime/NGMime.h>
-#import <NGMail/NGMail.h>
-#import <NGMail/NGSendMail.h>
+#import <NGMime/NGMimeBodyPart.h>
+#import <NGMime/NGMimeMultipartBody.h>
+#import <NGMail/NGMimeMessage.h>
 
 #import <SoObjects/SOGo/LDAPUserManager.h>
 #import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
+#import <SoObjects/SOGo/SOGoMailer.h>
 #import <SoObjects/SOGo/SOGoPermissions.h>
 #import <SoObjects/SOGo/SOGoUser.h>
 #import <SoObjects/Appointments/SOGoAppointmentFolder.h>
@@ -332,7 +336,6 @@ static BOOL sendEMailNotifications = NO;
   NSString *pageName;
   iCalPerson *organizer;
   NSString *cn, *email, *sender, *iCalString;
-  NGSendMail *sendmail;
   WOApplication *app;
   unsigned i, count;
   iCalPerson *attendee;
@@ -360,9 +363,6 @@ static BOOL sendEMailNotifications = NO;
       /* generate iCalString once */
       iCalString = [[_newObject parent] versitString];
   
-      /* get sendmail object */
-      sendmail = [NGSendMail sharedSendMail];
-
       /* get WOApplication instance */
       app = [WOApplication application];
 
@@ -444,9 +444,10 @@ static BOOL sendEMailNotifications = NO;
           [body release];
 
           /* send the damn thing */
-          [sendmail sendMimePart: msg
-                    toRecipients: [NSArray arrayWithObject: email]
-                    sender: [organizer rfc822Email]];
+          [[SOGoMailer sharedMailer]
+           sendMimePart: msg
+           toRecipients: [NSArray arrayWithObject: email]
+           sender: [organizer rfc822Email]];
         }
     }
 }
index 5fc7b15aa947b6e2fb28a81e9e1682616b5acbd6..ac3b241cf2c0ad08843c77c34284bd5b47eaab7f 100644 (file)
   02111-1307, USA.
 */
 
-#import "SOGoTaskObject.h"
+#import <Foundation/NSException.h>
+#import <Foundation/NSUserDefaults.h>
 
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NSNull+misc.h>
 #import <NGCards/iCalCalendar.h>
 #import <NGCards/iCalToDo.h>
 #import <NGCards/iCalEventChanges.h>
 #import <NGCards/iCalPerson.h>
 #import <SOGo/LDAPUserManager.h>
-#import <NGMime/NGMime.h>
-#import <NGMail/NGMail.h>
-#import <NGMail/NGSendMail.h>
-#import "SOGoAptMailNotification.h"
+
+#import <SoObjects/SOGo/SOGoMailer.h>
 
 #import "NSArray+Appointments.h"
+#import "SOGoAptMailNotification.h"
+
+#import "SOGoTaskObject.h"
 
 @interface SOGoTaskObject (PrivateAPI)
 
index 1292c508597ac8d62d4462849da2ac58e7ec3c5a..2995f7227d9d88ff916a58babec76c4d34a5cd1f 100644 (file)
 
 /* contents */
 
-- (NSDictionary *)fetchInfo;
-- (NSException *)storeInfo:(NSDictionary *)_info;
+- (NSDictionary *) fetchInfo;
+- (NSException *) storeInfo: (NSDictionary *) _info;
 
 /* attachments */
 
-- (NSArray *)fetchAttachmentNames;
-- (BOOL)isValidAttachmentName:(NSString *)_name;
-- (NSException *) saveAttachment: (NSData *)_attach
+- (NSArray *) fetchAttachmentNames;
+- (BOOL) isValidAttachmentName: (NSString *) _name;
+- (NSException *) saveAttachment: (NSData *) _attach
                    withMetadata: (NSDictionary *) metadata;
-- (NSException *)deleteAttachmentWithName:(NSString *)_name;
+- (NSException *) deleteAttachmentWithName: (NSString *) _name;
 
 /* NGMime representations */
 
-- (NGMimeMessage *)mimeMessage;
+- (NGMimeMessage *) mimeMessage;
 
-- (NSString *)saveMimeMessageToTemporaryFile;
-- (NSString *)saveMimeMessageToTemporaryFileWithHeaders:(NSDictionary *)_addh;
-- (NSException *)sendMimeMessageAtPath:(NSString *)_path;
+- (NSString *) saveMimeMessageToTemporaryFile;
+- (NSString *) saveMimeMessageToTemporaryFileWithHeaders:(NSDictionary *)_addh;
 
-- (NSException *)sendMail;
+- (NSException *) sendMail;
 
 /* operations */
 
-- (NSException *)delete;
+- (NSException *) delete;
 
 /* fake being a SOGoMailObject */
 
-- (id)fetchParts:(NSArray *)_parts;
+- (id) fetchParts: (NSArray *) _parts;
 
 @end
 
index 999e1f32b07ce497a00a7f9a24e5127e4d37519d..1d627aba14d2dbd2a8e47438ce6be3f85f3bff51 100644 (file)
@@ -41,7 +41,6 @@
 #import <NGImap4/NGImap4EnvelopeAddress.h>
 #import <NGMail/NGMimeMessage.h>
 #import <NGMail/NGMimeMessageGenerator.h>
-#import <NGMail/NGSendMail.h>
 #import <NGMime/NGMimeBodyPart.h>
 #import <NGMime/NGMimeFileData.h>
 #import <NGMime/NGMimeMultipartBody.h>
@@ -49,6 +48,7 @@
 #import <NGMime/NGMimeHeaderFieldGenerator.h>
 
 #import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
+#import <SoObjects/SOGo/SOGoMailer.h>
 
 #import "SOGoDraftObject.h"
 
@@ -785,60 +785,8 @@ static BOOL        showTextAttachmentsInline  = NO;
   return ma;
 }
 
-- (NSString *) _rawSender
+- (NSException *) sendMail
 {
-  NSString *startEmail, *rawSender;
-  NSRange delimiter;
-
-  startEmail = [self sender];
-  delimiter = [startEmail rangeOfString: @"<"];
-  if (delimiter.location == NSNotFound)
-    rawSender = startEmail;
-  else
-    {
-      rawSender = [startEmail substringFromIndex: NSMaxRange (delimiter)];
-      delimiter = [rawSender rangeOfString: @">"];
-      if (delimiter.location != NSNotFound)
-       rawSender = [rawSender substringToIndex: delimiter.location];
-    }
-
-  return rawSender;
-}
-
-- (NSException *)sendMimeMessageAtPath:(NSString *)_path {
-  static NGSendMail *mailer = nil;
-  NSArray  *recipients;
-  NSString *from;
-  
-  /* validate */
-  
-  recipients = [self allRecipients];
-  from       = [self _rawSender];
-  if ([recipients count] == 0) {
-    return [NSException exceptionWithHTTPStatus:500 /* server error */
-                       reason:@"draft has no recipients set!"];
-  }
-  if ([from length] == 0) {
-    return [NSException exceptionWithHTTPStatus:500 /* server error */
-                       reason:@"draft has no sender (from) set!"];
-  }
-  
-  /* setup mailer object */
-  
-  if (mailer == nil)
-    mailer = [[NGSendMail sharedSendMail] retain];
-  if (![mailer isSendMailAvailable]) {
-    [self errorWithFormat:@"missing sendmail binary!"];
-    return [NSException exceptionWithHTTPStatus:500 /* server error */
-                       reason:@"did not find sendmail binary!"];
-  }
-  
-  /* send mail */
-  
-  return [mailer sendMailAtPath:_path toRecipients:recipients sender:from];
-}
-
-- (NSException *)sendMail {
   NSException *error;
   NSString    *tmpPath;
   
@@ -851,8 +799,10 @@ static BOOL        showTextAttachmentsInline  = NO;
   }
   
   /* send mail */
-  error = [self sendMimeMessageAtPath:tmpPath];
-  
+  error = [[SOGoMailer sharedMailer] sendMailAtPath: tmpPath
+                                    toRecipients: [self allRecipients]
+                                    sender: [self sender]];
+
   /* delete temporary file */
   [self deleteTemporaryMessageFile:tmpPath];
 
index ad12a4172fcda1a76330988b3c1e624c87018158..d2231786884b9199c0bb385b941d7e1048c5c111 100644 (file)
 
 - (NGImap4Connection *)imap4Connection;
 - (NGImap4ConnectionManager *)mailManager;
+
+- (NSString *) relativeImap4Name;
+- (NSMutableString *) imap4URLString;
+
 - (NSURL *)imap4URL;
 - (NSString *)imap4Login;
 - (NSString *)imap4Password;
index 39f6dca18d97ba876cb602b511c3055960b84de4..0b3e7ef24f39a07081bd07c391fc976befed8573 100644 (file)
@@ -44,6 +44,7 @@ libSOGo_HEADER_FILES = \
        NSCalendarDate+SOGo.h           \
        \
        SOGoAuthenticator.h             \
+       SOGoMailer.h                    \
        SOGoUser.h                      \
 
 libSOGo_OBJC_FILES = \
@@ -71,6 +72,7 @@ libSOGo_OBJC_FILES = \
        NSCalendarDate+SOGo.m           \
        \
        SOGoAuthenticator.m             \
+       SOGoMailer.m                    \
        SOGoUser.m                      \
 
 # tools
index 31c913ef608ff556bb80fb50843172b4c2f95edb..7cd8042b48ebef16675bcae41517d8174ad8c813 100644 (file)
@@ -43,6 +43,9 @@
 
 - (NSString *) jsonRepresentation;
 
+/* bare email addresses */
+- (NSString *) pureEMailAddress;
+
 #ifndef GNUSTEP_BASE_LIBRARY
 - (BOOL) boolValue;
 #endif
index 2f1d617c0b1b43c915d81c84e8b8470fca075413..38c09bad5f40e83f130a5b4f0f3ec61c9d51d1af 100644 (file)
@@ -249,6 +249,25 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil;
   return [NSString stringWithFormat: @"\"%@\"", representation];
 }
 
+- (NSString *) pureEMailAddress
+{
+  NSString *pureAddress;
+  NSRange delimiter;
+
+  delimiter = [self rangeOfString: @"<"];
+  if (delimiter.location == NSNotFound)
+    pureAddress = self;
+  else
+    {
+      pureAddress = [self substringFromIndex: NSMaxRange (delimiter)];
+      delimiter = [pureAddress rangeOfString: @">"];
+      if (delimiter.location != NSNotFound)
+       pureAddress = [pureAddress substringToIndex: delimiter.location];
+    }
+
+  return pureAddress;
+}
+
 #if LIB_FOUNDATION_LIBRARY
 - (BOOL) boolValue
 {
diff --git a/SoObjects/SOGo/SOGoMailer.h b/SoObjects/SOGo/SOGoMailer.h
new file mode 100644 (file)
index 0000000..29a4c6f
--- /dev/null
@@ -0,0 +1,50 @@
+/* SOGoMailer.h - this file is part of SOGo
+ *
+ * Copyright (C) 2007 Inverse groupe conseil
+ *
+ * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This file 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SOGOMAILER_H
+#define SOGOMAILER_H
+
+@class NSArray;
+@class NSException;
+@class NSString;
+
+@protocol NGMimePart;
+
+@interface SOGoMailer : NSObject
+{
+  NSString *mailingMechanism;
+  NSString *smtpServer;
+}
+
++ (id) sharedMailer;
+
+- (NSException *) sendMailAtPath: (NSString *) filename
+                   toRecipients: (NSArray *) recipients
+                         sender: (NSString *) sender;
+
+- (NSException *) sendMimePart: (id <NGMimePart>) part
+                 toRecipients: (NSArray *) recipients
+                       sender: (NSString *) sender;
+
+@end
+
+#endif /* SOGOMAILER_H */
diff --git a/SoObjects/SOGo/SOGoMailer.m b/SoObjects/SOGo/SOGoMailer.m
new file mode 100644 (file)
index 0000000..7ea6490
--- /dev/null
@@ -0,0 +1,256 @@
+/* SOGoMailer.m - this file is part of SOGo
+ *
+ * Copyright (C) 2007 Inverse groupe conseil
+ *
+ * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This file 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#import <Foundation/NSArray.h>
+#import <Foundation/NSEnumerator.h>
+#import <Foundation/NSException.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGMail/NGSendMail.h>
+#import <NGMail/NGSmtpClient.h>
+#import <NGMime/NGMimePartGenerator.h>
+
+#import "NSString+Utilities.h"
+#import "SOGoMailer.h"
+
+#define defaultMailingMechanism @"sendmail"
+#define defaultSMTPServer @"localhost"
+
+@implementation SOGoMailer
+
++ (id) sharedMailer
+{
+  static id sharedMailer = nil;
+
+  if (!sharedMailer)
+    sharedMailer = [self new];
+
+  return sharedMailer;
+}
+
+- (id) init
+{
+  NSUserDefaults *ud;
+
+  if ((self = [super init]))
+    {
+      ud = [NSUserDefaults standardUserDefaults];
+      mailingMechanism = [ud stringForKey: @"SOGoMailingMechanism"];
+      if (mailingMechanism)
+       {
+         if (!([mailingMechanism isEqualToString: @"sendmail"]
+               || [mailingMechanism isEqualToString: @"smtp"]))
+           {
+             [self logWithFormat: @"mechanism '%@' is invalid and"
+                   @" should be set to 'sendmail' or 'smtp' instead",
+                   mailingMechanism];
+             [self logWithFormat: @"falling back to default '%@' mechanism",
+                   defaultMailingMechanism];
+             mailingMechanism = defaultMailingMechanism;
+           }
+       }
+      else
+       {
+         [self logWithFormat: @"default mailing mechanism set to '%@'",
+               defaultMailingMechanism];
+         mailingMechanism = defaultMailingMechanism;
+       }
+      [mailingMechanism retain];
+
+      if ([mailingMechanism isEqualToString: @"smtp"])
+       {
+         smtpServer = [ud stringForKey: @"SOGoSMTPServer"];
+         if (!smtpServer)
+           {
+             [self logWithFormat: @"default smtp server set to '%@'",
+                   defaultSMTPServer];
+             smtpServer = defaultSMTPServer;
+           }
+         [smtpServer retain];
+       }
+      else
+       smtpServer = nil;
+    }
+
+  return self;
+}
+
+- (void) dealloc
+{
+  [mailingMechanism release];
+  [smtpServer release];
+  [super dealloc];
+}
+
+- (NSException *) _sendmailSendData: (NSData *) mailData
+                      toRecipients: (NSArray *) recipients
+                            sender: (NSString *) sender
+{
+  NSException *result;
+  NGSendMail *mailer;
+
+  mailer = [NGSendMail sharedSendMail];
+  if ([mailer isSendMailAvailable])
+    result = [mailer sendMailData: mailData
+                    toRecipients: recipients
+                    sender: sender];
+  else
+    result = [NSException exceptionWithHTTPStatus: 500
+                         reason: @"cannot send message:"
+                         @" no sendmail binary!"];
+
+  return result;
+}
+
+- (NSException *) _sendMailData: (NSData *) mailData
+                    withClient: (NGSmtpClient *) client
+                 andRejections: (unsigned int) toErrors
+{
+  NSException *result;
+
+  if (toErrors > 0)
+    [self logWithFormat: @"sending email despite address rejections"];
+  if ([client sendData: mailData])
+    result = nil;
+  else
+    result = [NSException exceptionWithHTTPStatus: 500
+                         reason: @"cannot send message:"
+                         @" (smtp) failure when sending data"];
+
+  return result;
+}
+
+- (NSException *) _smtpSendData: (NSData *) mailData
+                  toRecipients: (NSArray *) recipients
+                        sender: (NSString *) sender
+{
+  NGSmtpClient *client;
+  NSEnumerator *addresses;
+  NSString *currentTo;
+  unsigned int toErrors;
+  NSException *result;
+
+  client = [NGSmtpClient smtpClient];
+  if ([client connectToHost: smtpServer])
+    {
+      if ([client hello]
+         && [client mailFrom: sender])
+       {
+         toErrors = 0;
+         addresses = [recipients objectEnumerator];
+         currentTo = [addresses nextObject];
+         while (currentTo)
+           {
+             if (![client recipientTo: [currentTo pureEMailAddress]])
+               {
+                 [self logWithFormat: @"error with recipient '%@'", currentTo];
+                 toErrors++;
+               }
+             currentTo = [addresses nextObject];
+           }
+         if (toErrors == [recipients count])
+           result = [NSException exceptionWithHTTPStatus: 500
+                                 reason: @"cannot send message:"
+                                 @" (smtp) all recipients discarded"];
+         else
+           result = [self _sendMailData: mailData withClient: client
+                          andRejections: toErrors];
+       }
+      else
+       result = [NSException exceptionWithHTTPStatus: 500
+                             reason: @"cannot send message:"
+                             @" (smtp) error when connecting"];
+      [client quit];
+      [client disconnect];
+    }
+
+  return result;
+}
+
+- (NSException *) sendMailData: (NSData *) data
+                 toRecipients: (NSArray *) recipients
+                       sender: (NSString *) sender
+{
+  NSException *result;
+
+  if (![recipients count])
+    result = [NSException exceptionWithHTTPStatus: 500
+                         reason: @"cannot send message: no recipients set"];
+  else
+    {
+      if (![sender length])
+       result = [NSException exceptionWithHTTPStatus: 500
+                             reason: @"cannot send message: no sender set"];
+      else
+       {
+         if ([mailingMechanism isEqualToString: @"sendmail"])
+           result = [self _sendmailSendData: data
+                          toRecipients: recipients
+                          sender: [sender pureEMailAddress]];
+         else
+           result = [self _smtpSendData: data
+                          toRecipients: recipients
+                          sender: [sender pureEMailAddress]];
+       }
+    }
+
+  return result;
+}
+
+- (NSException *) sendMimePart: (id <NGMimePart>) part
+                 toRecipients: (NSArray *) recipients
+                       sender: (NSString *) sender
+{
+  NSData *mailData;
+
+  mailData = [[NGMimePartGenerator mimePartGenerator]
+              generateMimeFromPart: part];
+
+  return [self sendMailData: mailData
+              toRecipients: recipients
+              sender: sender];
+}
+
+- (NSException *) sendMailAtPath: (NSString *) filename
+                   toRecipients: (NSArray *) recipients
+                         sender: (NSString *) sender
+{
+  NSException *result;
+  NSData *mailData;
+
+  mailData = [NSData dataWithContentsOfFile: filename];
+  if ([mailData length] > 0)
+    result = [self sendMailData: mailData
+                  toRecipients: recipients
+                  sender: sender];
+  else
+    result = [NSException exceptionWithHTTPStatus: 500
+                         reason: @"cannot send message: no data"
+                         @" (missing or empty file?)"];
+
+  return nil;
+}
+
+@end
index 56b9a0d8771f805dd3d787f974b6adf2225784d3..6342e92f32dd758e1213967997ede9a9392cff2b 100644 (file)
   folders = [self _jsonFolders: [rawFolders objectEnumerator]];
 
   response = [context response];
+  [response setStatus: 200];
+  [response setHeader: @"text/plain; charset=utf-8"
+           forKey: @"content-type"];
   [response appendContentString: [folders jsonRepresentation]];
 
   return response;
index b0338a369149a11d42db6e87d8c956d6ccf3ede4..3111e172b44d3bbd67e249e3b5669c4de55cdbf9 100644 (file)
   folderURL = [folder imap4URL];
   
   client = [[folder imap4Connection] client];
-  infos = [client getQuotaRoot: [folder nameInContainer]];
+  infos = [client getQuotaRoot: [folder relativeImap4Name]];
   responseString = [[infos objectForKey: @"quotas"] jsonRepresentation];
   [response appendContentString: responseString];
 
index 40cc8d0bb4eef5cfd1afd18d2b25c0b9f5574253..aefddbdd26bdd99ee508eeddeb39d91af206d466 100644 (file)
 #import <NGObjWeb/WOResponse.h>
 #import <NGExtensions/NGHashMap.h>
 #import <NGMail/NGMimeMessage.h>
-#import <NGMail/NGSendMail.h>
 #import <NGMime/NGMimeBodyPart.h>
 #import <NGMime/NGMimeMultipartBody.h>
 
+#import <SoObjects/SOGo/SOGoMailer.h>
 #import <SoObjects/SOGo/SOGoUser.h>
 #import <SoObjects/SOGo/SOGoObject.h>
 #import <SoObjects/SOGo/LDAPUserManager.h>
   [message setBody: body];
   [body release];
 
-  [[NGSendMail sharedSendMail] sendMimePart: message
-                              toRecipients: [NSArray arrayWithObject: recipient]
-                              sender: [activeUser primaryEmail]];
+  [[SOGoMailer sharedMailer] sendMimePart: message
+                            toRecipients: [NSArray arrayWithObject: recipient]
+                            sender: [activeUser primaryEmail]];
 }
 
 @end
index c390268af2e5f3beafa500947383d5ece7c83362..df32f1d746819e4a7373c0e46daa4961e91a8b81 100644 (file)
@@ -1330,7 +1330,7 @@ function getMenus() {
                                          "-", "label-menu", "mark-menu",
                                          "-",
                                          null, onMenuViewMessageSource,
-                                         null, null,
+                                         null, onPrintCurrentMessage,
                                          onMenuDeleteMessage);
   menus["label-menu"] = new Array(null, "-", null , null, null, null , null,
                                  null);