1 package FS::part_export::status_shellcommands;
2 use base qw( FS::part_export::shellcommands );
6 use String::ShellQuote;
8 tie my %options, 'Tie::IxHash',
9 'user' => { label=>'Remote username', default=>'root' },
11 'spam_enable' => { label=>'Spam filtering enable command', },
12 'spam_disable' => { label=>'Spam filtering disable command', },
13 'spam_tag2_level' => { label=>'Spam set tag2 level command', },
14 'spam_kill_level' => { label=>'Spam set kill level command', },
17 label => 'Treat any output from the command as an error',
20 'ignore_all_errors' => {
21 label => 'Ignore all errors from the command',
28 'desc' => 'Set mailbox status via shell commands',
29 'options' => \%options,
32 Set mailbox status information (vacation and spam settings) with shell commands.
36 #don't want to inherit these from shellcommands
38 sub _export_replace {}
40 sub _export_suspend {}
41 sub _export_unsuspend {}
43 sub export_setstatus {
44 my($self, $svc_acct, $hashref) = @_;
46 for (qw( spam_tag2_level spam_kill_level )) {
47 $hashref->{$_} =~ /^\d+(\.\d+)?$/ or return "illegal $_";
52 user => $self->option('user') || 'root',
53 host => $self->machine,
54 #stdin_string => $stdin_string,
55 fail_on_output => $self->option('fail_on_output'),
56 ignore_all_errors => $self->option('ignore_all_errors'),
57 #ignored_errors => $self->option('ignored_errors') || '',
60 $self->shellcommands_queue( @shellargs, 'command' =>
61 $self->option('spam_enable'). ' '.
62 shell_quote($svc_acct->email)
64 || $self->shellcommands_queue( @shellargs, 'command' =>
65 $self->option('spam_tag2_level'). ' '.
66 shell_quote($svc_acct->email). ' '.
67 $hashref->{'spam_tag2_level'}
69 || $self->shellcommands_queue( @shellargs, 'command' =>
70 $self->option('spam_kill_level'). ' '.
71 shell_quote($svc_acct->email). ' '.
72 $hashref->{'spam_kill_level'}