Index and control files fields

This commit is contained in:
Jamie Cameron
2008-05-06 22:13:15 +00:00
parent 0a070c0ca8
commit a486d3a922
4 changed files with 53 additions and 1 deletions

View 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.

View File

@@ -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'},

View 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

View File

@@ -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);
}