Handle hostnames with upper-case letters
[webmin.git] / jabber / save_filter.cgi
1 #!/usr/local/bin/perl
2 # save_filter.cgi
3 # Save user filter options
4
5 require './jabber-lib.pl';
6 &ReadParse();
7 &error_setup($text{'filter_err'});
8
9 $conf = &get_jabber_config();
10 $session = &find_by_tag("service", "id", "sessions", $conf);
11 $jsm = &find("jsm", $session);
12 $filter = &find("filter", $jsm);
13 $allow = &find("allow", $filter);
14
15 # Validate and store inputs
16 $in{'max'} =~ /^\d+$/ || &error($text{'filter_emax'});
17 &save_directive($filter, "max_size",
18                 [ [ "max_size", [ { }, 0, $in{'max'} ] ] ] );
19 $conds = &find("conditions", $allow);
20 foreach $c (@filter_conds) {
21         if ($in{"cond_$c"}) {
22                 &save_directive($conds, $c, [ [ $c, [ { } ] ] ] );
23                 }
24         else {
25                 &save_directive($conds, $c);
26                 }
27         }
28 $acts = &find("actions", $allow);
29 foreach $c (@filter_acts) {
30         if ($in{"act_$c"}) {
31                 &save_directive($acts, $c, [ [ $c, [ { } ] ] ] );
32                 }
33         else {
34                 &save_directive($acts, $c);
35                 }
36         }
37
38 &save_jabber_config($conf);
39 &redirect("");
40