49_TBot_List: configure also add with attr confirmUnsolicited

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@14726 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
viegener 2017-07-16 13:34:42 +00:00
parent d7676ba64e
commit df88b36677
2 changed files with 14 additions and 6 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: 49_TBot_List: configure also add with attr confirmUnsolicited
- feature: 49_TBot_List: configure confirm delete as attribute confirmDelete - feature: 49_TBot_List: configure confirm delete as attribute confirmDelete
- changed: 98_fheminfo.pm: remove release, featurelevel, uptime infos - changed: 98_fheminfo.pm: remove release, featurelevel, uptime infos
- added: 98_uptime.pm: new command module to show FHEM uptime - added: 98_uptime.pm: new command module to show FHEM uptime

View File

@ -75,7 +75,8 @@
# 0.5 2017-05-13 Menu / Sort und fixes # 0.5 2017-05-13 Menu / Sort und fixes
# #
# confirm delete configurable as attribute confirmDelete # confirm delete configurable as attribute confirmDelete
# # confirm add unsolicited configurable as attribute confirmUnsolicited
# 0.6 2017-07-16 confirmDelete & confirmUnsolicited
# #
############################################################################## ##############################################################################
# TASKS # TASKS
@ -145,6 +146,7 @@ sub TBot_List_Initialize($) {
"optionDouble:0,1 ". "optionDouble:0,1 ".
"handleUnsolicited:0,1 ". "handleUnsolicited:0,1 ".
"confirmDelete:0,1 ". "confirmDelete:0,1 ".
"confirmUnsolicited:0,1 ".
"allowedPeers:textField ". "allowedPeers:textField ".
$readingFnAttributes; $readingFnAttributes;
} }
@ -407,7 +409,7 @@ sub TBot_List_Attr(@) {
if ( ($aName eq 'optionDouble') ) { if ( ($aName eq 'optionDouble') ) {
$aVal = ($aVal eq "1")? "1": "0"; $aVal = ($aVal eq "1")? "1": "0";
} elsif ( ($aName eq "confirmDelete" ) ) { } elsif ( ($aName eq "confirmDelete" ) || ($aName eq "confirmUnsolicited" ) ) {
$aVal = ($aVal eq "1")? "1": "0"; $aVal = ($aVal eq "1")? "1": "0";
} elsif ($aName eq 'allowedPeers') { } elsif ($aName eq 'allowedPeers') {
@ -1103,13 +1105,18 @@ sub TBot_List_handler($$$$;$)
$arg = TBot_List_changeMultiLine( $arg ); $arg = TBot_List_changeMultiLine( $arg );
my $textmsg = "Liste ".$lname."\nSoll der Eintrag ".$arg." hinzugefügt werden?"; my $textmsg = "Liste ".$lname."\nSoll der Eintrag ".$arg." hinzugefuegt werden?";
if ( defined($msgId ) ) { if ( defined($msgId ) ) {
# store text for adding # store text for adding
TBot_List_setMsgId( $hash, $tbot, $chatId, $arg, "expadd" ); TBot_List_setMsgId( $hash, $tbot, $chatId, $arg, "expadd" );
my $inline = "(".TBot_List_inlinekey( $hash, "Ja", "list_expaddyes" )."|".TBot_List_inlinekey( $hash, "Nein", "list_edit" ).")"; if ( AttrVal($name,'confirmUnsolicited',1) ) {
fhem( "set ".$tbot." queryEditInline $msgId ".'@'.$chatId." $inline $textmsg" ); my $inline = "(".TBot_List_inlinekey( $hash, "Ja", "list_expaddyes" )."|".TBot_List_inlinekey( $hash, "Nein", "list_edit" ).")";
fhem( "set ".$tbot." queryEditInline $msgId ".'@'.$chatId." $inline $textmsg" );
} else {
# directly add entry --> call recursively
TBot_List_handler( $hash, "list_expaddyes", $tbot, $peer );
}
} else { } else {
$ret = "TBot_List_handler: $name - $tbot ERROR no msgId known for peer :$peer: chat :$chatId: cmd :$cmd: ".(defined($arg)?"arg :$arg:":""); $ret = "TBot_List_handler: $name - $tbot ERROR no msgId known for peer :$peer: chat :$chatId: cmd :$cmd: ".(defined($arg)?"arg :$arg:":"");
} }