Imported Upstream version 3.1.0
[debian/amanda] / application-src / script-email.pl
index b16f6a69b259c9d22ae51fb9f36ef06329e85e02..bf15980efd9a6367e1aa044d459c1bd9fbd2aac3 100644 (file)
@@ -1,5 +1,5 @@
 #!@PERL@
-# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2008,2009 Zmanda, Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -14,7 +14,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 use lib '@amperldir@';
@@ -33,7 +33,7 @@ use Amanda::Constants;
 sub new {
     my $class = shift;
     my ($execute_where, $config, $host, $disk, $device, $level, $index, $message, $collection, $record, $mailto) = @_;
-    my $self = $class->SUPER::new($execute_where);
+    my $self = $class->SUPER::new($execute_where, $config);
 
     $self->{execute_where} = $execute_where;
     $self->{config}        = $config;
@@ -65,86 +65,103 @@ sub command_support {
 #something
 sub command_pre_dle_amcheck {
    my $self = shift;
+
    $self->sendmail("pre-dle-amcheck");
 }
 
 sub command_pre_host_amcheck {
    my $self = shift;
+
    $self->sendmail("pre-host-amcheck");
 }
 
 sub command_post_dle_amcheck {
    my $self = shift;
+
    $self->sendmail("post-dle-amcheck");
 }
 
 sub command_post_host_amcheck {
    my $self = shift;
+
    $self->sendmail("post-host-amcheck");
 }
 
 sub command_pre_dle_estimate {
    my $self = shift;
+
    $self->sendmail("pre-dle-estimate");
 }
 
 sub command_pre_host_estimate {
    my $self = shift;
+
    $self->sendmail("pre-host-estimate");
 }
 
 sub command_post_dle_estimate {
    my $self = shift;
+
    $self->sendmail("post-dle-estimate");
 }
 
 sub command_post_host_estimate {
    my $self = shift;
+
    $self->sendmail("post-host-estimate");
 }
 
 sub command_pre_dle_backup {
    my $self = shift;
+
    $self->sendmail("pre-dle-backup");
 }
 
 sub command_pre_host_backup {
    my $self = shift;
+
    $self->sendmail("pre-host-backup");
 }
 
 sub command_post_dle_backup {
    my $self = shift;
+
    $self->sendmail("post-dle-backup");
 }
 
 sub command_post_host_backup {
    my $self = shift;
+
    $self->sendmail("post-host-backup");
 }
 
 sub command_pre_recover {
    my $self = shift;
+
    $self->sendmail("pre-recover");
 }
 
 sub command_post_recover {
    my $self = shift;
+
    $self->sendmail("post-recover");
 }
 
 sub command_pre_level_recover {
    my $self = shift;
+
    $self->sendmail("pre-level-recover");
 }
 
 sub command_post_level_recover {
    my $self = shift;
+
    $self->sendmail("post-level-recover");
 }
 
 sub command_inter_level_recover {
    my $self = shift;
+
    $self->sendmail("inter-level-recover");
 }
 
@@ -164,7 +181,7 @@ sub sendmail {
    debug("cmd: $Amanda::Constants::MAILER $args\n");
    my $mail;
    open $mail, '|-', $Amanda::Constants::MAILER, @args;
-   print $mail "$self->{config} $function $self->{host} $self->{disk} $self->{device} ", join (" ", @{$self->{level}}), "\n";
+   print $mail "$self->{action} $self->{config} $function $self->{host} $self->{disk} $self->{device} ", join (" ", @{$self->{level}}), "\n";
    close $mail;
 }