2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

01_FHEMWEB.pm: changes CL to the inform connection (Forum #82062)

git-svn-id: https://svn.fhem.de/fhem/trunk@15796 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-01-05 21:26:18 +00:00
parent 39b337a703
commit 21d3846a7e

View File

@ -97,6 +97,7 @@ my $FW_lastWebName = ""; # Name of last FHEMWEB instance, for caching
my $FW_lastHashUpdate = 0; my $FW_lastHashUpdate = 0;
my $FW_httpRetCode = ""; my $FW_httpRetCode = "";
my %FW_csrfTokenCache; my %FW_csrfTokenCache;
my %FW_id2inform;
######################### #########################
# As we are _not_ multithreaded, it is safe to use global variables. # As we are _not_ multithreaded, it is safe to use global variables.
@ -270,6 +271,7 @@ FW_Undef($$)
my ($hash, $arg) = @_; my ($hash, $arg) = @_;
my $ret = TcpServer_Close($hash); my $ret = TcpServer_Close($hash);
if($hash->{inform}) { if($hash->{inform}) {
delete $FW_id2inform{$hash->{FW_ID}} if($hash->{FW_ID});
%FW_visibleDeviceHash = FW_visibleDevices(); %FW_visibleDeviceHash = FW_visibleDevices();
delete($logInform{$hash->{NAME}}); delete($logInform{$hash->{NAME}});
} }
@ -571,6 +573,8 @@ FW_initInform($$)
$me->{inform}{type} = ($FW_room ? "status" : "raw"); $me->{inform}{type} = ($FW_room ? "status" : "raw");
$me->{inform}{filter} = ($FW_room ? $FW_room : ".*"); $me->{inform}{filter} = ($FW_room ? $FW_room : ".*");
} }
$FW_id2inform{$FW_id} = $me if($FW_id);
my $filter = $me->{inform}{filter}; my $filter = $me->{inform}{filter};
$filter =~ s/([[\]().+?])/\\$1/g if($filter =~ m/room=/); # Forum #80390 $filter =~ s/([[\]().+?])/\\$1/g if($filter =~ m/room=/); # Forum #80390
$filter = "NAME=.*" if($filter eq "room=all"); $filter = "NAME=.*" if($filter eq "room=all");
@ -2473,10 +2477,11 @@ FW_fC($@)
{ {
my ($cmd, $unique) = @_; my ($cmd, $unique) = @_;
my $ret; my $ret;
my $cl = $FW_id && $FW_id2inform{$FW_id} ? $FW_id2inform{$FW_id} : $FW_chash;
if($unique) { if($unique) {
$ret = AnalyzeCommand($FW_chash, $cmd); $ret = AnalyzeCommand($cl, $cmd);
} else { } else {
$ret = AnalyzeCommandChain($FW_chash, $cmd); $ret = AnalyzeCommandChain($cl, $cmd);
} }
return $ret; return $ret;
} }