[exim-dev] made maildir_use_size_file expandable. Anybody to…

Top Page
Delete this message
Reply to this message
Author: Heiko Schlittermann
Date:  
To: exim-dev
Subject: [exim-dev] made maildir_use_size_file expandable. Anybody to review it?
Hello,

I made the appendfile transport option "maildir_use_size_file"
expandable, since we need the option dependend on the recipient.

(Currently we're using two almost identical transports and let the
router(s) decide, but this looks ugly, and options for a specific
transport should be independend on the router.)

Attached you'll find the patch I did. Could please somebody revise it
and give me some feedback? If it's not only me, who thinks, that it is
useful, it would be nice to see it in one of the next releases.

--
Heiko :: dresden : linux : SCHLITTERMANN.de
GPG Key 48D0359B : 3061 CFBF 2D88 F034 E8D2 7E92 EE4E AC98 48D0 359B
diff -r 3feef89a1d78 doc/spec.txt
--- a/doc/spec.txt    Sat Feb 12 14:34:41 2011 +0100
+++ b/doc/spec.txt    Sat Feb 12 14:44:51 2011 +0100
@@ -18179,11 +18179,12 @@
 This option applies only to deliveries in maildir format, and is described in
 section 26.5 below.


-+------------------------------------------------------------------+
-|maildir_use_size_file|Use: appendfile|Type: boolean|Default: false|
-+------------------------------------------------------------------+
-
-Setting this option true enables support for maildirsize files. Exim creates a
++-------------------------------------------------------------------+
+|maildir_use_size_file|Use: appendfile|Type: boolean*|Default: false|
++-------------------------------------------------------------------+
+
+The result of string expansion for this option must be a valid boolean value.
+If it is true, it enables support for maildirsize files. Exim creates a
 maildirsize file in a maildir if one does not exist, taking the quota from the
 quota option of the transport. If quota is unset, the value is zero. See
 maildir_quota_directory_regex above and section 26.5 below for further details.
diff -r 3feef89a1d78 src/transports/appendfile.c
--- a/src/transports/appendfile.c    Sat Feb 12 14:34:41 2011 +0100
+++ b/src/transports/appendfile.c    Sat Feb 12 14:44:51 2011 +0100
@@ -38,6 +38,10 @@
 opt_public flag. */


 optionlist appendfile_transport_options[] = {
+#ifdef SUPPORT_MAILDIR
+  { "*expand_maildir_use_size_file", opt_stringptr,
+      (void *)offsetof(appendfile_transport_options_block, expand_maildir_use_size_file) },
+#endif
   { "*set_use_fcntl_lock",opt_bool | opt_hidden,
       (void *)offsetof(appendfile_transport_options_block, set_use_fcntl) },
   { "*set_use_flock_lock",opt_bool | opt_hidden,
@@ -105,7 +109,7 @@
       (void *)offsetof(appendfile_transport_options_block, maildir_retries) },
   { "maildir_tag",       opt_stringptr,
       (void *)offsetof(appendfile_transport_options_block, maildir_tag) },
-  { "maildir_use_size_file", opt_bool,
+  { "maildir_use_size_file", opt_expand_bool,
       (void *)offsetof(appendfile_transport_options_block, maildir_use_size_file ) } ,
   { "maildirfolder_create_regex", opt_stringptr,
       (void *)offsetof(appendfile_transport_options_block, maildirfolder_create_regex ) },
@@ -184,6 +188,7 @@
   NULL,           /* quota_warn_threshold */
   NULL,           /* mailbox_size_string */
   NULL,           /* mailbox_filecount_string */
+  NULL,           /* expand_maildir_use_size_file */ 
   US"^(?:cur|new|\\..*)$",  /* maildir_dir_regex */
   NULL,           /* maildir_tag */
   NULL,           /* maildirfolder_create_regex */
@@ -272,6 +277,10 @@
 uid = uid;
 gid = gid;


+if (ob->expand_maildir_use_size_file)
+    ob->maildir_use_size_file = expand_check_condition(ob->expand_maildir_use_size_file, 
+        US"`maildir_use_size_file` in transport", tblock->name);
+
 /* Loop for quota, quota_filecount, quota_warn_threshold, mailbox_size,
 mailbox_filecount */


diff -r 3feef89a1d78 src/transports/appendfile.h
--- a/src/transports/appendfile.h    Sat Feb 12 14:34:41 2011 +0100
+++ b/src/transports/appendfile.h    Sat Feb 12 14:44:51 2011 +0100
@@ -23,6 +23,7 @@
   uschar *quota_warn_threshold;
   uschar *mailbox_size_string;
   uschar *mailbox_filecount_string;
+  uschar *expand_maildir_use_size_file;
   uschar *maildir_dir_regex;
   uschar *maildir_tag;
   uschar *maildirfolder_create_regex;