mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
00_CUL.pm: some cosmetic fixes (Forum #117934)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23727 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0910b6b813
commit
f36907db3d
@ -634,7 +634,8 @@ CUL_XmitDlyHM($$$)
|
|||||||
{
|
{
|
||||||
my ($hash,$fn,$now) = @_;
|
my ($hash,$fn,$now) = @_;
|
||||||
|
|
||||||
my (undef,$mTy,undef,$id) = unpack 'A8A2A6A6',$fn if(length($fn)>19);
|
my ($mTy,$id);
|
||||||
|
(undef,$mTy,undef,$id) = unpack 'A8A2A6A6',$fn if(length($fn)>19);
|
||||||
|
|
||||||
if($id &&
|
if($id &&
|
||||||
$modules{CUL_HM}{defptr}{$id} &&
|
$modules{CUL_HM}{defptr}{$id} &&
|
||||||
|
@ -484,7 +484,8 @@ ZWDongle_Get($@)
|
|||||||
my $msg="";
|
my $msg="";
|
||||||
$a[0] = $a0 if(defined($a0));
|
$a[0] = $a0 if(defined($a0));
|
||||||
$msg = $ret if($ret);
|
$msg = $ret if($ret);
|
||||||
my @r = map { ord($_) } split("", pack('H*', $ret)) if(defined($ret));
|
my @r;
|
||||||
|
@r = map { ord($_) } split("", pack('H*', $ret)) if(defined($ret));
|
||||||
|
|
||||||
if($cmd eq "nodeList") { ############################
|
if($cmd eq "nodeList") { ############################
|
||||||
$msg =~ s/^.{10}(.{58}).*/$1/;
|
$msg =~ s/^.{10}(.{58}).*/$1/;
|
||||||
|
@ -2212,7 +2212,8 @@ FW_returnFileAsStream($$$$$)
|
|||||||
"Transfer-Encoding: chunked\r\n" .
|
"Transfer-Encoding: chunked\r\n" .
|
||||||
"Content-Type: $type; charset=$FW_encoding\r\n\r\n");
|
"Content-Type: $type; charset=$FW_encoding\r\n\r\n");
|
||||||
|
|
||||||
my $d = Compress::Zlib::deflateInit(-WindowBits=>31) if($compr);
|
my $d;
|
||||||
|
$d = Compress::Zlib::deflateInit(-WindowBits=>31) if($compr);
|
||||||
FW_outputChunk($FW_chash, $FW_RET, $d);
|
FW_outputChunk($FW_chash, $FW_RET, $d);
|
||||||
FW_outputChunk($FW_chash, "<a name='top'></a>".
|
FW_outputChunk($FW_chash, "<a name='top'></a>".
|
||||||
"<a href='#end_of_file'>jump to the end</a><br><br>", $d)
|
"<a href='#end_of_file'>jump to the end</a><br><br>", $d)
|
||||||
@ -2505,7 +2506,8 @@ FW_style($$)
|
|||||||
FW_addContent(">$filePath: $!</div");
|
FW_addContent(">$filePath: $!</div");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $ret = FW_fC("rereadcfg") if($filePath eq $attr{global}{configfile});
|
my $ret;
|
||||||
|
$ret = FW_fC("rereadcfg") if($filePath eq $attr{global}{configfile});
|
||||||
$ret = FW_fC("reload $fileName") if($fileName =~ m,\.pm$,);
|
$ret = FW_fC("reload $fileName") if($fileName =~ m,\.pm$,);
|
||||||
$ret = FW_Set("","","rereadicons") if($isImg);
|
$ret = FW_Set("","","rereadicons") if($isImg);
|
||||||
DoTrigger("global", "FILEWRITE $filePath", 1) if(!$ret); # Forum #32592
|
DoTrigger("global", "FILEWRITE $filePath", 1) if(!$ret); # Forum #32592
|
||||||
@ -2672,7 +2674,8 @@ FW_makeImage(@)
|
|||||||
$data =~ s/ *$//g;
|
$data =~ s/ *$//g;
|
||||||
$data =~ s/<svg/<svg class="$class" data-txt="$txt"/; #52967
|
$data =~ s/<svg/<svg class="$class" data-txt="$txt"/; #52967
|
||||||
$name =~ m/(@.*)$/;
|
$name =~ m/(@.*)$/;
|
||||||
my $col = $1 if($1);
|
my $col;
|
||||||
|
$col = $1 if($1);
|
||||||
if($col) {
|
if($col) {
|
||||||
$col =~ s/@//;
|
$col =~ s/@//;
|
||||||
$col = "#$col" if($col =~ m/^([A-F0-9]{6})$/);
|
$col = "#$col" if($col =~ m/^([A-F0-9]{6})$/);
|
||||||
|
@ -923,8 +923,9 @@ ZWave_execInits($$;$)
|
|||||||
|
|
||||||
my $NAME = $hash->{NAME};
|
my $NAME = $hash->{NAME};
|
||||||
my $iodev = $hash->{IODev};
|
my $iodev = $hash->{IODev};
|
||||||
my $homeReading = ReadingsVal($iodev->{NAME}, "homeId", "") if($iodev);
|
my ($homeReading, $CTRLID);
|
||||||
my $CTRLID=hex($1) if($homeReading && $homeReading =~ m/CtrlNodeIdHex:(..)/);
|
$homeReading = ReadingsVal($iodev->{NAME}, "homeId", "") if($iodev);
|
||||||
|
$CTRLID = hex($1) if($homeReading && $homeReading =~ m/CtrlNodeIdHex:(..)/);
|
||||||
|
|
||||||
# ZWavePlus devices with MCA need mcaAdd instead of associationAdd
|
# ZWavePlus devices with MCA need mcaAdd instead of associationAdd
|
||||||
my $cls = AttrVal($NAME, "classes", "");
|
my $cls = AttrVal($NAME, "classes", "");
|
||||||
@ -980,7 +981,8 @@ ZWave_neighborList($)
|
|||||||
no strict "refs";
|
no strict "refs";
|
||||||
my $iohash = $hash->{IODev};
|
my $iohash = $hash->{IODev};
|
||||||
my $fn = $modules{$iohash->{TYPE}}{ReadAnswerFn};
|
my $fn = $modules{$iohash->{TYPE}}{ReadAnswerFn};
|
||||||
my ($err, $data) = &{$fn}($iohash, "neighborList", "^0180") if($fn);
|
my ($err, $data);
|
||||||
|
($err, $data) = &{$fn}($iohash, "neighborList", "^0180") if($fn);
|
||||||
use strict "refs";
|
use strict "refs";
|
||||||
|
|
||||||
return $err if($err);
|
return $err if($err);
|
||||||
@ -1131,7 +1133,8 @@ ZWave_Cmd($$@)
|
|||||||
$cmdFmt = sprintf($cmdFmt, @a);
|
$cmdFmt = sprintf($cmdFmt, @a);
|
||||||
}
|
}
|
||||||
$@ = undef;
|
$@ = undef;
|
||||||
my ($err, $ncmd) = eval($cmdFmt) if($cmdFmt !~ m/^\d/);
|
my ($err, $ncmd);
|
||||||
|
($err, $ncmd) = eval($cmdFmt) if($cmdFmt !~ m/^\d/);
|
||||||
return $err if($err);
|
return $err if($err);
|
||||||
return $@ if($@);
|
return $@ if($@);
|
||||||
$cmdFmt = $ncmd if(defined($ncmd));
|
$cmdFmt = $ncmd if(defined($ncmd));
|
||||||
@ -2908,8 +2911,9 @@ ZWave_configParseModel($;$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($line =~ m/^\s*<Item/) {
|
if($line =~ m/^\s*<Item/) {
|
||||||
my $label = $1 if($line =~ m/label="([^"]*)"/i);
|
my ($label, $value);
|
||||||
my $value = $1 if($line =~ m/value="([^"]*)"/i);
|
$label = $1 if($line =~ m/label="([^"]*)"/i);
|
||||||
|
$value = $1 if($line =~ m/value="([^"]*)"/i);
|
||||||
my ($item, $shortened) = ZWave_cleanString($label, $value, 1);
|
my ($item, $shortened) = ZWave_cleanString($label, $value, 1);
|
||||||
$hash{$cmdName}{Item}{$item} = $value;
|
$hash{$cmdName}{Item}{$item} = $value;
|
||||||
$hash{$cmdName}{type} = "list"; # Forum #42604
|
$hash{$cmdName}{type} = "list"; # Forum #42604
|
||||||
|
@ -87,7 +87,8 @@ HMS_Parse($$)
|
|||||||
my $cde = substr($msg, 11, 1);
|
my $cde = substr($msg, 11, 1);
|
||||||
# 012345678901234567890123456789
|
# 012345678901234567890123456789
|
||||||
# 810e047f0214a001a81f000001000000 HMS100TFK
|
# 810e047f0214a001a81f000001000000 HMS100TFK
|
||||||
my $val = substr($msg, 24, 8) if(length($msg) == 32);
|
my $val;
|
||||||
|
$val = substr($msg, 24, 8) if(length($msg) == 32);
|
||||||
if(!defined($val)) {
|
if(!defined($val)) {
|
||||||
Log3 $hash, 3, "Strange HMS message $msg";
|
Log3 $hash, 3, "Strange HMS message $msg";
|
||||||
return "";
|
return "";
|
||||||
|
@ -836,7 +836,8 @@ FileLog_Get($@)
|
|||||||
}
|
}
|
||||||
Log3 $name, 4, "$name get: Input file $inf, from:$from to:$to";
|
Log3 $name, 4, "$name get: Input file $inf, from:$from to:$to";
|
||||||
|
|
||||||
my $ifh = new IO::File $inf if($inf);
|
my $ifh;
|
||||||
|
$ifh = new IO::File $inf if($inf);
|
||||||
FileLog_seekTo($inf, $ifh, $hash, $from, $reformatFn) if($ifh);
|
FileLog_seekTo($inf, $ifh, $hash, $from, $reformatFn) if($ifh);
|
||||||
|
|
||||||
# Return the the plain file data, $outf is ignored
|
# Return the the plain file data, $outf is ignored
|
||||||
|
@ -180,7 +180,8 @@ allowed_Authenticate($$$$)
|
|||||||
if($pwok && (!defined($authcookie) || $secret ne $authcookie)) {
|
if($pwok && (!defined($authcookie) || $secret ne $authcookie)) {
|
||||||
my $time = AttrVal($aName, "basicAuthExpiry", 0);
|
my $time = AttrVal($aName, "basicAuthExpiry", 0);
|
||||||
if ( $time ) {
|
if ( $time ) {
|
||||||
my ($user, $password) = split(":", decode_base64($secret)) if($secret);
|
my ($user, $password);
|
||||||
|
($user, $password) = split(":", decode_base64($secret)) if($secret);
|
||||||
$time = int($time*86400+time());
|
$time = int($time*86400+time());
|
||||||
# generate timestamp according to RFC-1130 in Expires
|
# generate timestamp according to RFC-1130 in Expires
|
||||||
my $expires = FmtDateTimeRFC1123($time);
|
my $expires = FmtDateTimeRFC1123($time);
|
||||||
@ -248,7 +249,8 @@ allowed_CheckBasicAuth($$$$)
|
|||||||
my $aName = $me->{NAME};
|
my $aName = $me->{NAME};
|
||||||
|
|
||||||
my $pwok = ($secret && $secret eq $basicAuth) ? 1 : 2; # Base64
|
my $pwok = ($secret && $secret eq $basicAuth) ? 1 : 2; # Base64
|
||||||
my ($user, $password) = split(":", decode_base64($secret)) if($secret);
|
my ($user, $password);
|
||||||
|
($user, $password) = split(":", decode_base64($secret)) if($secret);
|
||||||
($user,$password) = ("","") if(!defined($user) || !defined($password));
|
($user,$password) = ("","") if(!defined($user) || !defined($password));
|
||||||
|
|
||||||
if($secret && $basicAuth =~ m/^{.*}$/) {
|
if($secret && $basicAuth =~ m/^{.*}$/) {
|
||||||
|
@ -37,7 +37,8 @@ JsonList2_dumpHash($$$$$$)
|
|||||||
{
|
{
|
||||||
my ($arrp, $name, $h, $isReading, $showInternal, $attr) = @_;
|
my ($arrp, $name, $h, $isReading, $showInternal, $attr) = @_;
|
||||||
my $ret = "";
|
my $ret = "";
|
||||||
my %filter = map { $_=>1 } @$attr if(@$attr);
|
my %filter;
|
||||||
|
%filter = map { $_=>1 } @$attr if(@$attr);
|
||||||
|
|
||||||
my @arr = grep { ($showInternal || $_ !~ m/^\./) &&
|
my @arr = grep { ($showInternal || $_ !~ m/^\./) &&
|
||||||
($isReading || $_ eq "IODev" || !ref($h->{$_}) ) &&
|
($isReading || $_ eq "IODev" || !ref($h->{$_}) ) &&
|
||||||
|
@ -570,7 +570,7 @@ CommandUsb($$)
|
|||||||
my ($cl, $n) = @_;
|
my ($cl, $n) = @_;
|
||||||
|
|
||||||
return "Usage: usb [scan|create]" if("$n" !~ m/^(scan|create)$/);
|
return "Usage: usb [scan|create]" if("$n" !~ m/^(scan|create)$/);
|
||||||
my $scan = 1 if($n eq "scan");
|
my $scan = ($n eq "scan");
|
||||||
my $ret = "";
|
my $ret = "";
|
||||||
my $msg;
|
my $msg;
|
||||||
my $dir = "/dev";
|
my $dir = "/dev";
|
||||||
|
@ -139,8 +139,8 @@ telnet_Define($$$)
|
|||||||
my $port = $pport;
|
my $port = $pport;
|
||||||
$port =~ s/^IPV6://;
|
$port =~ s/^IPV6://;
|
||||||
|
|
||||||
my $isServer = 1 if(defined($port) && $port =~ m/^\d+$/);
|
my $isServer = (defined($port) && $port =~ m/^\d+$/);
|
||||||
my $isClient = 1 if($port && $port =~ m/^(.+):\d+$/);
|
my $isClient = ($port && $port =~ m/^(.+):\d+$/);
|
||||||
|
|
||||||
return "Usage: define <name> telnet { [IPV6:]<tcp-portnr> [global] | ".
|
return "Usage: define <name> telnet { [IPV6:]<tcp-portnr> [global] | ".
|
||||||
" [IPV6:]serverName:port }"
|
" [IPV6:]serverName:port }"
|
||||||
|
@ -37,8 +37,9 @@ FB_doCheckPW($$$)
|
|||||||
"getpage=../html/login_sid.xml" );
|
"getpage=../html/login_sid.xml" );
|
||||||
$data = join("&", map {join("=", map {urlEncode($_)} split("=",$_,2))} @d);
|
$data = join("&", map {join("=", map {urlEncode($_)} split("=",$_,2))} @d);
|
||||||
$data = GetFileFromURL(FB_host2URL($host)."cgi-bin/webcm", undef, $data, 1);
|
$data = GetFileFromURL(FB_host2URL($host)."cgi-bin/webcm", undef, $data, 1);
|
||||||
my $sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
my $sid;
|
||||||
$sid = undef if($sid =~ m/^0*$/);
|
$sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
||||||
|
$sid = undef if(defined($sid) && $sid =~ m/^0*$/);
|
||||||
return $sid;
|
return $sid;
|
||||||
|
|
||||||
} else { # FritzOS >= 5.50
|
} else { # FritzOS >= 5.50
|
||||||
@ -49,8 +50,9 @@ FB_doCheckPW($$$)
|
|||||||
|
|
||||||
$data = GetFileFromURL($url, undef, $data, 1);
|
$data = GetFileFromURL($url, undef, $data, 1);
|
||||||
return if(!$data);
|
return if(!$data);
|
||||||
my $sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
my $sid;
|
||||||
return if($sid =~ m/^0*$/);
|
$sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
||||||
|
return if(defined($sid) && $sid =~ m/^0*$/);
|
||||||
return $sid;
|
return $sid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user