mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-19 12:46:03 +00:00
FB_CALLLIST: code optimizations
git-svn-id: https://svn.fhem.de/fhem/trunk@10442 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6237e50f83
commit
c96f7e84d6
@ -32,7 +32,6 @@ use warnings;
|
||||
use MIME::Base64;
|
||||
use Data::Dumper;
|
||||
|
||||
|
||||
sub
|
||||
FB_CALLLIST_Initialize($)
|
||||
{
|
||||
@ -76,20 +75,10 @@ sub FB_CALLLIST_Define($$)
|
||||
my $retval = undef;
|
||||
my $name = $a[0];
|
||||
my $callmonitor = $a[2];
|
||||
if(!defined($callmonitor))
|
||||
{
|
||||
return "FB_CALLLIST_define: you must specify a device name for using FB_CALLLIST";
|
||||
}
|
||||
|
||||
if(@a != 3)
|
||||
{
|
||||
return "wrong define syntax: define <name> FB_CALLLIST <name>";
|
||||
}
|
||||
|
||||
unless(defined($defs{$callmonitor}))
|
||||
{
|
||||
return "FB_CALLLIST_define: the selected device $callmonitor does not exist.";
|
||||
}
|
||||
return "FB_CALLLIST_define: you must specify a device name for using FB_CALLLIST" if(!defined($callmonitor));
|
||||
return "wrong define syntax: define <name> FB_CALLLIST <name>" if(@a != 3);
|
||||
return "FB_CALLLIST_define: the selected device $callmonitor does not exist." unless(defined($defs{$callmonitor}));
|
||||
|
||||
unless($defs{$callmonitor}->{TYPE} eq "FB_CALLMONITOR")
|
||||
{
|
||||
@ -272,7 +261,6 @@ sub FB_CALLLIST_Notify($$)
|
||||
my ($hash,$d) = @_;
|
||||
|
||||
return undef if(!defined($hash) or !defined($d));
|
||||
return undef if(IsDisabled($hash->{NAME}));
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
@ -294,6 +282,7 @@ sub FB_CALLLIST_Notify($$)
|
||||
|
||||
my $fb = $d->{NAME};
|
||||
|
||||
return undef if(IsDisabled($name));
|
||||
return undef if($fb ne $hash->{FB});
|
||||
return undef if(!grep(m/^event:/, @{$d->{CHANGED}}));
|
||||
|
||||
@ -704,14 +693,8 @@ sub FB_CALLLIST_formatDuration($$)
|
||||
my $minute = ($data->{call_duration} / 60) % 60;
|
||||
my $seconds = int($data->{call_duration} % 60);
|
||||
|
||||
if($data->{missed_call})
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "-" if($data->{missed_call});
|
||||
return sprintf("%02d:%02d:%02d", $hour, $minute, $seconds);
|
||||
}
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user