2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

FB_CALLLIST: new set command "removeItem" to delete a specific item from the calllist (Forum: #104063)

git-svn-id: https://svn.fhem.de/fhem/trunk@20348 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2019-10-11 18:32:58 +00:00
parent b20fd8a65a
commit e8c5a5d333
2 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- feature: 72_FB_CALLLIST: new set command to remove a specific item from list
- change: 49_SSCam: optimize memory usage when send images and recordings by - change: 49_SSCam: optimize memory usage when send images and recordings by
email and/or telegram email and/or telegram
- feature: 70_CanOverEthernet: send and receive analog and digital values - feature: 70_CanOverEthernet: send and receive analog and digital values

View File

@ -227,7 +227,11 @@ sub FB_CALLLIST_Set($@)
{ {
my ($hash, $name, $cmd, $value) = @_; my ($hash, $name, $cmd, $value) = @_;
my $usage = "Unknown argument $cmd, choose one of clear:noArg"; my @list = FB_CALLLIST_getAllItemLines($hash);
my $index_list = join(",", (1..@list));
my $usage = "Unknown argument $cmd, choose one of clear:noArg removeItem:$index_list";
if($cmd eq "clear") if($cmd eq "clear")
{ {
@ -242,6 +246,14 @@ sub FB_CALLLIST_Set($@)
# Delete stored list # Delete stored list
FB_CALLLIST_saveList($hash); FB_CALLLIST_saveList($hash);
} }
elsif($cmd eq "removeItem" and defined($value) and $value =~ /^\d+$/)
{
my $item = $list[$value - 1];
return $usage unless(defined($item));
FB_CALLLIST_deleteItem($hash, $item->{index});
}
else else
{ {
return $usage; return $usage;
@ -1557,6 +1569,7 @@ sub FB_CALLLIST_strftime(@)
<b>Set</b><br> <b>Set</b><br>
<ul> <ul>
<li><b>clear</b> - clears the list completely</li> <li><b>clear</b> - clears the list completely</li>
<li><b>removeItem &lt;index&gt;</b> - removes a specific item from the list (row number)</li>
</ul> </ul>
<br> <br>
@ -1851,6 +1864,7 @@ sub FB_CALLLIST_strftime(@)
<b>Set-Kommandos</b><br> <b>Set-Kommandos</b><br>
<ul> <ul>
<li><b>clear</b> - l&ouml;scht die gesamte Anrufliste</li> <li><b>clear</b> - l&ouml;scht die gesamte Anrufliste</li>
<li><b>removeItem &lt;index&gt;</b> - l&ouml;scht eine spezifische Zeile aus der Anrufliste (Zeilennummer)</li>
</ul> </ul>
<br> <br>