Handle hostnames with upper-case letters
[webmin.git] / fetchmail / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'fetchmail-lib.pl';
5
6 # parse_webmin_log(user, script, action, type, object, &params)
7 # Converts logged information from this module into human-readable form
8 sub parse_webmin_log
9 {
10 local ($user, $script, $action, $type, $object, $p, $long) = @_;
11 if ($type eq 'poll') {
12         if ($p->{'user'}) {
13                 return &text("log_${action}_poll_user",
14                              "<tt>".&html_escape($object)."</tt>",
15                              "<tt>".&html_escape($p->{'user'})."</tt>");
16                 }
17         else {
18                 return &text("log_${action}_poll_file",
19                              "<tt>".&html_escape($object)."</tt>",
20                              "<tt>".&html_escape($p->{'file'})."</tt>");
21                 }
22         }
23 elsif ($type eq 'cron') {
24         return $text{"log_${action}_cron"};
25         }
26 elsif ($action eq 'check') {
27         if ($object =~ /^\//) {
28                 return &text("log_check_file_${type}",
29                              "<tt>".&html_escape($object)."</tt>",
30                              "<tt>".&html_escape($p->{'poll'})."</tt>");
31                 }
32         else {
33                 return &text("log_check_user_${type}",
34                              "<tt>".&html_escape($object)."</tt>",
35                              "<tt>".&html_escape($p->{'poll'})."</tt>");
36                 }
37         }
38 elsif ($action eq 'global') {
39         return &text($object =~ /^\// ? "log_global_file" : "log_global_user",
40                      "<tt>".&html_escape($object)."</tt>");
41         }
42 elsif ($action eq 'start') {
43         return &text('log_start', $p->{'interval'});
44         }
45 elsif ($action eq 'stop') {
46         return $text{'log_stop'};
47         }
48 else {
49         return undef;
50         }
51 }
52