37_harmony.pm: escape some special characters in activity and device names.

see:http://forum.fhem.de/index.php/topic,14163.msg225543.html#msg225543


git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7121 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme1968
2014-12-02 21:48:49 +00:00
parent 7aa9178d91
commit c47456594e

View File

@@ -155,8 +155,13 @@ harmony_idOfActivity($$;$)
{
my ($hash, $label, $default) = @_;
my $quoted_label = $label;
#$quoted_label =~ s/\./ /g;
$quoted_label = quotemeta($quoted_label);
foreach my $activity (@{$hash->{config}->{activity}}) {
return $activity->{id} if( $activity->{label} =~ m/^$label$/ );
return $activity->{id} if( $activity->{label} =~ m/^$quoted_label$/ );
}
return $default;
@@ -189,8 +194,13 @@ harmony_idOfDevice($$;$)
{
my ($hash, $label, $default) = @_;
my $quoted_label = $label;
#$quoted_label =~ s/\./ /g;
$quoted_label = quotemeta($quoted_label);
foreach my $device (@{$hash->{config}->{device}}) {
return $device->{id} if( $device->{label} =~ m/^$label$/ );
return $device->{id} if( $device->{label} =~ m/^$quoted_label$/ );
}
return $default;