+ if ( $new->srcsvc != $old->srcsvc
+ && ( $new->dstsvc != $old->dstsvc
+ || ! $new->dstsvc && $new->dst ne $old->dst
+ )
+ ) {
+ return "Can't change both source and destination of a mail forward!"
+ }
+
+ local $SIG{HUP} = 'IGNORE';
+ local $SIG{INT} = 'IGNORE';
+ local $SIG{QUIT} = 'IGNORE';
+ local $SIG{TERM} = 'IGNORE';
+ local $SIG{TSTP} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE';
+
+ my $error = $new->SUPER::replace($old);
+ return $error if $error;
+
+ if ( $new->srcsvc != $old->srcsvc ) {
+ my $old_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $old->srcsvc } );
+ my $old_username = $old_svc_acct->username;
+ my $old_domain = $old_svc_acct->domain;
+ foreach my $vpopmailmachine ( @vpopmailmachines ) {
+ my($machine, $vpopdir, $vpopuid, $vpopgid) =
+ split(/\s+/, $vpopmailmachine);
+ ssh("root\@$machine","rm $vpopdir/$old_domain/$old_username/.qmail")
+ unless $nossh_hack;
+ }
+ }