98_SVG.pm: more efficient solution (Forum #59786)

git-svn-id: https://svn.fhem.de/fhem/trunk@12482 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-11-01 09:25:59 +00:00
parent 8f7f4fbbf7
commit 7253eeb75b

View File

@ -74,7 +74,7 @@ SVG_Initialize($)
use warnings 'qw';
$hash->{AttrList} = join(" ", @attrList);
$hash->{SetFn} = "SVG_Set";
$hash->{NotifyFn} = "SVG_Notify";
$hash->{RenameFn} = "SVG_Rename";
$hash->{FW_summaryFn} = "SVG_FwFn";
$hash->{FW_detailFn} = "SVG_FwFn";
$hash->{FW_atPageEnd} = 1;
@ -148,16 +148,12 @@ SVG_Attr($$$$)
}
sub
SVG_Notify($$)
SVG_Rename($$)
{
my ($me, $dev) = @_;
my $events = deviceEvents($defs{global}, 0);
return if(!$events ||
$events->[0] !~m/^RENAMED (.+) (.+)$/ ||
$2 ne $me->{NAME} ||
$1 ne $me->{GPLOTFILE});
SVG_Set($me, $me->{NAME}, "copyGplotFile"); # Forum #59786
my ($new, $old) = @_;
my $hash = $defs{$new};
return if($hash->{GPLOTFILE} ne $old);
SVG_Set($hash, $new, "copyGplotFile"); # Forum #59786
}
##################