2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +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.
# 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
email and/or telegram
- 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 $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")
{
@ -242,6 +246,14 @@ sub FB_CALLLIST_Set($@)
# Delete stored list
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
{
return $usage;
@ -1557,6 +1569,7 @@ sub FB_CALLLIST_strftime(@)
<b>Set</b><br>
<ul>
<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>
<br>
@ -1851,6 +1864,7 @@ sub FB_CALLLIST_strftime(@)
<b>Set-Kommandos</b><br>
<ul>
<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>
<br>