2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 11:01:59 +00:00

FB_CALLLIST: minor code optimization

git-svn-id: https://svn.fhem.de/fhem/trunk@15886 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2018-01-14 14:25:28 +00:00
parent 14bb3a3541
commit 436ef86d60

View File

@ -346,11 +346,14 @@ sub FB_CALLLIST_Notify($$)
}
}
if(grep(m/^(?:INITIALIZED|REREADCFG)$/, @{$events}))
{
Log3 $name, 2, "FB_CALLLIST ($name) - WARNING - the selected device $callmonitor does not exist" unless(IsDevice($callmonitor));
Log3 $name, 2, "FB_CALLLIST ($name) - WARNING - selected device $callmonitor ist not of type FB_CALLMONITOR" if(IsDevice($callmonitor) and !IsDevice($callmonitor,"FB_CALLMONITOR"));
}
if(grep(m/^(?:ATTR $name .*|DELETEATTR $name.*|INITIALIZED|REREADCFG)$/, @{$events}))
{
Log3 $name, 3, "FB_CALLLIST ($name) - WARNING - the selected device $callmonitor does not exist" unless(IsDevice($callmonitor));
Log3 $name, 3, "FB_CALLLIST ($name) - WARNING - selected device $callmonitor ist not of type FB_CALLMONITOR" if(IsDevice($callmonitor) and !IsDevice($callmonitor,"FB_CALLMONITOR"));
# delete all outdated calls according to attribute list-type, internal-number-filter and number-of-calls
FB_CALLLIST_cleanupList($hash);
@ -738,8 +741,7 @@ sub FB_CALLLIST_returnCallState($$;$)
if($data->{direction} eq "incoming" and ((not exists($data->{internal_connection}) ) or (exists($data->{internal_connection}) and not $data->{internal_connection} =~ /Answering_Machine/)))
{
$state = "=>".($data->{missed_call} ? " X" : "");
$state = FB_CALLLIST_returnIcon($hash, "incoming.done", $state) if($icons and not $data->{missed_call});
$state = FB_CALLLIST_returnIcon($hash, "incoming.missed", $state) if($icons and $data->{missed_call});
$state = FB_CALLLIST_returnIcon($hash, "incoming.".($data->{missed_call} ? "missed" : "done"), $state) if($icons);
}
elsif($data->{direction} eq "incoming" and exists($data->{internal_connection}) and $data->{internal_connection} =~ /^Answering_Machine/)
{
@ -749,8 +751,7 @@ sub FB_CALLLIST_returnCallState($$;$)
elsif($data->{direction} eq "outgoing")
{
$state = "<=".($data->{missed_call} ? " X" : "");
$state = FB_CALLLIST_returnIcon($hash, "outgoing.done", $state) if($icons and not $data->{missed_call});
$state = FB_CALLLIST_returnIcon($hash, "outgoing.missed", $state) if($icons and $data->{missed_call});
$state = FB_CALLLIST_returnIcon($hash, "outgoing.".($data->{missed_call} ? "missed" : "done"), $state) if($icons);
}
}
@ -956,7 +957,7 @@ sub FB_CALLLIST_list2html($)
#####################################
# creating the call list as json array
# generate all readings for the call list
sub FB_CALLLIST_createReadings($)
{
my ($hash) = @_;