2 # Update mail file options
4 require './dovecot-lib.pl';
6 &error_setup($text{'mail_err'});
8 &lock_dovecot_files($conf);
11 if ($in{'envmode'} == 4) {
12 $in{'other'} =~ /^\S+$/ || &error($text{'mail_eenv'});
16 $env = $mail_envs[$in{'envmode'}];
19 # Add index file location
20 $env || !$in{'indexmode'} || &error($text{'mail_eindexmode'});
21 $env || !$in{'controlmode'} || &error($text{'mail_econtrolmode'});
22 if ($in{'indexmode'} == 1) {
23 $env .= ":INDEX=MEMORY";
25 elsif ($in{'indexmode'} == 2) {
26 $in{'index'} =~ /^\/\S+$/ || &error($text{'mail_eindex'});
27 $env .= ":INDEX=".$in{'index'};
29 if ($in{'controlmode'}) {
30 $in{'control'} =~ /^\/\S+$/ || &error($text{'mail_econtrol'});
31 $env .= ":CONTROL=".$in{'control'};
34 if (&find("mail_location", $conf, 2)) {
35 &save_directive($conf, "mail_location", $env eq "" ? undef : $env);
38 &save_directive($conf, "default_mail_env", $env eq "" ? undef : $env);
41 # Check and idle intervals
42 $in{'check'} != 2 || $in{'checki'} =~ /^\d+$/ || &error($text{'mail_echeck'});
43 &save_directive($conf, "mailbox_check_interval",
44 $in{'check'} == 1 ? 0 : $in{'check'} == 2 ? $in{'checki'} : undef);
45 $in{'idle'} != 2 || $in{'idlei'} =~ /^\d+$/ || &error($text{'mail_eidle'});
46 &save_directive($conf, "mailbox_idle_check_interval",
47 $in{'idle'} == 1 ? 0 : $in{'idle'} == 2 ? $in{'idlei'} : undef);
50 &save_directive($conf, "mail_full_filesystem_access",
51 $in{'full'} ? $in{'full'} : undef);
52 &save_directive($conf, "mail_save_crlf",
53 $in{'crlf'} ? $in{'crlf'} : undef);
54 if (&find("mbox_dirty_syncs", $conf, 2)) {
55 &save_directive($conf, "mbox_dirty_syncs",
56 $in{'change'} ? $in{'change'} : undef);
59 &save_directive($conf, "maildir_check_content_changes",
60 $in{'change'} ? $in{'change'} : undef);
64 $in{'umask_def'} || $in{'umask'} =~ /^[0-7]{4}$/ ||&error($text{'mail_eumask'});
65 &save_directive($conf, "umask",
66 $in{'umask_def'} ? undef : $in{'umask'});
69 if (&find("pop3_uidl_format", $conf, 2)) {
70 $uidl = $in{'pop3_uidl_format'} eq '*' ?
71 $in{'pop3_uidl_format_other'} : $in{'pop3_uidl_format'};
72 $uidl =~ /^\S+$/ || &error($text{'mail_euidl'});
73 &save_directive($conf, "pop3_uidl_format", $uidl);
77 &save_directive($conf, "pop3_enable_last",
78 $in{'last'} ? $in{'last'} : undef);
81 if (&find("lock_method", $conf, 2)) {
82 &save_directive($conf, "lock_method",
83 $in{'lock_method'} ? $in{'lock_method'} : undef);
87 foreach $l ("mbox_read_locks", "mbox_write_locks") {
88 next if (!&find($l, $conf, 2));
90 &save_directive($conf, $l, undef);
94 for(my $i=0; defined($m = $in{$l."_".$i}); $i++) {
95 push(@methods, $m) if ($m);
97 @methods || &error($text{'mail_e'.$l});
98 &save_directive($conf, $l, join(" ", @methods));
103 &unlock_dovecot_files($conf);