Index and control files fields
authorJamie Cameron <jcameron@webmin.com>
Tue, 6 May 2008 22:13:15 +0000 (22:13 +0000)
committerJamie Cameron <jcameron@webmin.com>
Tue, 6 May 2008 22:13:15 +0000 (22:13 +0000)
dovecot/CHANGELOG
dovecot/edit_mail.cgi
dovecot/lang/en
dovecot/save_mail.cgi

index 1c6e41d..a73124b 100644 (file)
@@ -14,3 +14,4 @@ Added fields for editing the UIDL format and number of login processes.
 Supported newer versions of Dovecot which use mail_location instead of default_mail_env.
 ---- Changes since 1.410 ----
 The locking methods for mailboxes and index files can be configured on the Mail Files page.
+Added fields for setting the index and control files locations.
index 6200348..8e4a18c 100755 (executable)
@@ -16,6 +16,12 @@ if (&find("mail_location", $conf, 2)) {
 else {
        $env = &find_value("default_mail_env", $conf);
        }
+if ($env =~ s/:INDEX=([^:]+)//) {
+       $index = $1;
+       }
+if ($env =~ s/:CONTROL=([^:]+)//) {
+       $control = $1;
+       }
 for($i=0; $i<@mail_envs; $i++) {
        $envmode = $i if ($mail_envs[$i] eq $env);
        }
@@ -23,9 +29,29 @@ print &ui_table_row($text{'mail_env'},
        &ui_radio("envmode", $envmode,
                [ ( map { [ $_, $text{'mail_env'.$_}."<br>" ] } (0.. 3) ),
                  [ 4, &text('mail_env4',
-                       &ui_textbox("other", $envmode == 4 ? $env : undef, 30)) ] ],
+                       &ui_textbox("other", $envmode == 4 ? $env : undef, 40)) ] ],
                ), 3);
 
+# Index files location
+$indexmode = $index eq 'MEMORY' ? 1 :
+            $index ? 2 : 0;
+print &ui_table_row($text{'mail_index'},
+       &ui_radio("indexmode", $indexmode,
+         [ [ 0, $text{'mail_index0'}."<br>" ],
+           [ 1, $text{'mail_index1'}."<br>" ],
+           [ 2, &text('mail_index2',
+                 &ui_textbox("index", $indexmode == 2 ? $index : "", 40)) ]
+         ]), 3);
+
+# Control files location
+print &ui_table_row($text{'mail_control'},
+       &ui_radio("controlmode", $control ? 1 : 0,
+         [ [ 0, $text{'mail_index0'}."<br>" ],
+           [ 1, &text('mail_index2',
+                 &ui_textbox("control", $control, 40)) ] ]), 3);
+
+print &ui_table_hr();
+
 # Check interval
 $check = &find_value("mailbox_check_interval", $conf);
 print &ui_table_row($text{'mail_check'},
index f6d132c..6013b82 100644 (file)
@@ -127,6 +127,11 @@ mail_env1=Inbox and folders in <tt>~/Maildir</tt>
 mail_env2=Inbox under <tt>/var/mail</tt>, folders in <tt>~/mail</tt>
 mail_env3=Inbox in <tt>~/Maildir</tt>, folders in <tt>~/mail</tt>
 mail_env4=Other Dovecot location $1
+mail_index=Index files location
+mail_index0=Default (in Maildir directory)
+mail_index1=In memory only
+mail_index2=Other directory $1
+mail_control=Control files location
 mail_check=Interval between mail checks
 mail_never=Never check
 mail_secs=seconds
@@ -162,6 +167,10 @@ mail_none=None
 mail_sel=Selected below, in order ..
 mail_embox_read_locks=No read locking methods selected
 mail_embox_write_locks=No write locking methods selected
+mail_eindexmode=The index files location cannot be set when the mail file location is detected automatically
+mail_econtrolmode=The control files location cannot be set when the mail file location is detected automatically
+mail_eindex=Missing or invalid absolute path for index files
+mail_econtrol=Missing or invalid absolute path for control files
 
 log_net=Changed Networking and Protocols
 log_login=Changed User and Login Options
index dc7a0a6..e124796 100755 (executable)
@@ -15,6 +15,22 @@ if ($in{'envmode'} == 4) {
 else {
        $env = $mail_envs[$in{'envmode'}];
        }
+
+# Add index file location
+$env || !$in{'indexmode'} || &error($text{'mail_eindexmode'});
+$env || !$in{'controlmode'} || &error($text{'mail_econtrolmode'});
+if ($in{'indexmode'} == 1) {
+       $env .= ":INDEX=MEMORY";
+       }
+elsif ($in{'indexmode'} == 2) {
+       $in{'index'} =~ /^\/\S+$/ || &error($text{'mail_eindex'});
+       $env .= ":INDEX=".$in{'index'};
+       }
+if ($in{'controlmode'}) {
+       $in{'control'} =~ /^\/\S+$/ || &error($text{'mail_econtrol'});
+       $env .= ":CONTROL=".$in{'control'};
+       }
+
 if (&find("mail_location", $conf, 2)) {
        &save_directive($conf, "mail_location", $env eq "" ? undef : $env);
        }