]> err.no Git - scalable-opengroupware.org/commitdiff
made the internet-access suffix a pattern
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 19 Jul 2005 10:29:16 +0000 (10:29 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 19 Jul 2005 10:29:16 +0000 (10:29 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@822 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/README
SOGo/SoObjects/Mailer/SOGoDraftObject.m
SOGo/SoObjects/Mailer/Version

index 29551aee028d3beca3c746ab5b899e72e7a9839b..b23b9809f1e77847da9d5eb7de3a92f6401d23f0 100644 (file)
@@ -1,5 +1,8 @@
 2005-07-19  Helge Hess  <helge.hess@opengroupware.org>
 
+       * SOGoDraftObject.m: made 'SOGoInternetMailSuffix' a pattern which can
+         access request values (v0.9.111)
+         
        * SOGoDraftObject.m: added support for adding a marker to the textpart
          of the message in case the client is accessing the server from the
          Internet. The text can be specified using the
index dca7ba4473fb1cafb230fabf035ac885913c938e..9f1b4389e944ef7f5a46c7927f8de72e5917038d 100644 (file)
@@ -44,6 +44,9 @@ SOGoSharedFolderName       IMAP4-Name
 SOGoOtherUsersFolderName   IMAP4-Name
   - corresponds to the Cyrus setting: userprefix
 
-SOGoInternetMailSuffix     String - suffix to add to mails sent via Internet
+SOGoInternetMailSuffix     String-Pattern
+  - suffix to add to mails sent via Internet
   - eg: -SOGoInternetMailSuffix \
         '"*** This email was composed using SOGo on the public Internet ***"'
+    you can access request values inside the pattern, eg:
+         "$headers.host$"
index d33367acd4e28517115a77b344e531b22544c3c3..e8411e99caccadfb49b1f4f0e6b39be55a25e425 100644 (file)
@@ -40,9 +40,8 @@ static NGMimeType  *MultiMixedType = nil;
 static NSString    *userAgent      = @"SOGoMail 1.0";
 static BOOL        draftDeleteDisabled = NO; // for debugging
 static BOOL        debugOn = NO;
-static BOOL        showTextAttachmentsInline = NO;
-static NSString    *fromInternetSuffix       = nil;
-static NSData      *fromInternetSuffixData   = nil;
+static BOOL        showTextAttachmentsInline  = NO;
+static NSString    *fromInternetSuffixPattern = nil;
 
 + (int)version {
   return [super version] + 0 /* v1 */;
@@ -61,13 +60,12 @@ static NSData      *fromInternetSuffixData   = nil;
   if ((draftDeleteDisabled = [ud boolForKey:@"SOGoNoDraftDeleteAfterSend"]))
     NSLog(@"WARNING: draft delete is disabled! (SOGoNoDraftDeleteAfterSend)");
   
-  fromInternetSuffix = [ud stringForKey:@"SOGoInternetMailSuffix"];
-  if ([fromInternetSuffix length] == 0)
+  fromInternetSuffixPattern = [ud stringForKey:@"SOGoInternetMailSuffix"];
+  if ([fromInternetSuffixPattern length] == 0)
     NSLog(@"Note: no 'SOGoInternetMailSuffix' is configured.");
   else {
-    fromInternetSuffix = [@"\n" stringByAppendingString:fromInternetSuffix];
-    fromInternetSuffixData = 
-      [fromInternetSuffix dataUsingEncoding:NSUTF8StringEncoding];
+    fromInternetSuffixPattern =
+      [@"\n" stringByAppendingString:fromInternetSuffixPattern];
   }
   
   TextPlainType  = [[NGMimeType mimeType:@"text"      subType:@"plain"]  copy];
@@ -311,16 +309,24 @@ static NSData      *fromInternetSuffixData   = nil;
 - (NGMimeMessage *)mimeMessageForContentWithHeaderMap:(NGMutableHashMap *)map {
   NSDictionary  *lInfo;
   NGMimeMessage *message;  
-  BOOL addSuffix;
-  id body;
+  WOContext     *ctx;
+  NSString *fromInternetSuffix;
+  BOOL     addSuffix;
+  id       body;
 
   if ((lInfo = [self fetchInfo]) == nil)
     return nil;
   
-  addSuffix = 
-    [[[WOApplication application] context] isAccessFromIntranet] ? NO : YES;
-  if (addSuffix)
+  ctx       = [[WOApplication application] context];
+  addSuffix = [ctx isAccessFromIntranet] ? NO : YES;
+  if (addSuffix) {
+    fromInternetSuffix = 
+      [fromInternetSuffixPattern stringByReplacingVariablesWithBindings:
+                                  [ctx request]
+                                stringForUnknownBindings:@""];
+    
     addSuffix = [fromInternetSuffix length] > 0 ? YES : NO;
+  }
   
   [map setObject:@"text/plain" forKey:@"content-type"];
   if ((body = [lInfo objectForKey:@"text"]) != nil) {
@@ -334,7 +340,9 @@ static NSData      *fromInternetSuffixData   = nil;
     }
     else if ([body isKindOfClass:[NSData class]] && addSuffix) {
       body = [[body mutableCopy] autorelease];
-      [(NSMutableData *)body appendData:fromInternetSuffixData];
+      [(NSMutableData *)body appendData:
+                         [fromInternetSuffix dataUsingEncoding:
+                                               NSUTF8StringEncoding]];
     }
     else if (addSuffix) {
       [self warnWithFormat:@"Note: cannot add Internet marker to body: %@",
@@ -342,7 +350,7 @@ static NSData      *fromInternetSuffixData   = nil;
     }
   }
   else if (addSuffix)
-    body = fromInternetSuffixData;
+    body = [fromInternetSuffix dataUsingEncoding:NSUTF8StringEncoding];
   
   message = [[[NGMimeMessage alloc] initWithHeader:map] autorelease];
   [message setBody:body];
index e8532a119ef2ef545ddc2c9f5b2aa64cd0bba1e2..6d6868c7f9002abcbf12fe819453e369df02b6c5 100644 (file)
@@ -1,12 +1,13 @@
 # Version file
 
-SUBMINOR_VERSION:=110
+SUBMINOR_VERSION:=111
 
-# v0.9.96 requires libNGMime       v4.5.223
-# v0.9.91 requires libNGMime       v4.5.222
-# v0.9.69 requires libNGMime       v4.5.210
-# v0.9.55 requires libNGExtensions v4.5.136
-# v0.9.44 requires libNGMime       v4.3.194
-# v0.9.41 requires libNGMime       v4.3.190
-# v0.9.35 requires libSOGoLogic    v0.9.24
-# v0.9.34 requires libSOGoLogic    v0.9.22
+# v0.9.111 requires libNGExtensions v4.5.163
+# v0.9.96  requires libNGMime       v4.5.223
+# v0.9.91  requires libNGMime       v4.5.222
+# v0.9.69  requires libNGMime       v4.5.210
+# v0.9.55  requires libNGExtensions v4.5.136
+# v0.9.44  requires libNGMime       v4.3.194
+# v0.9.41  requires libNGMime       v4.3.190
+# v0.9.35  requires libSOGoLogic    v0.9.24
+# v0.9.34  requires libSOGoLogic    v0.9.22