diff --git a/CHANGED b/CHANGED index 0f58a01cb..f5df89249 100644 --- a/CHANGED +++ b/CHANGED @@ -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: 49_TBot_List: configure also add with attr confirmUnsolicited - feature: 49_TBot_List: configure confirm delete as attribute confirmDelete - changed: 98_fheminfo.pm: remove release, featurelevel, uptime infos - added: 98_uptime.pm: new command module to show FHEM uptime diff --git a/FHEM/49_TBot_List.pm b/FHEM/49_TBot_List.pm index b383feef0..433c3cd59 100644 --- a/FHEM/49_TBot_List.pm +++ b/FHEM/49_TBot_List.pm @@ -75,7 +75,8 @@ # 0.5 2017-05-13 Menu / Sort und fixes # # confirm delete configurable as attribute confirmDelete -# +# confirm add unsolicited configurable as attribute confirmUnsolicited +# 0.6 2017-07-16 confirmDelete & confirmUnsolicited # ############################################################################## # TASKS @@ -145,6 +146,7 @@ sub TBot_List_Initialize($) { "optionDouble:0,1 ". "handleUnsolicited:0,1 ". "confirmDelete:0,1 ". + "confirmUnsolicited:0,1 ". "allowedPeers:textField ". $readingFnAttributes; } @@ -407,7 +409,7 @@ sub TBot_List_Attr(@) { if ( ($aName eq 'optionDouble') ) { $aVal = ($aVal eq "1")? "1": "0"; - } elsif ( ($aName eq "confirmDelete" ) ) { + } elsif ( ($aName eq "confirmDelete" ) || ($aName eq "confirmUnsolicited" ) ) { $aVal = ($aVal eq "1")? "1": "0"; } elsif ($aName eq 'allowedPeers') { @@ -1103,13 +1105,18 @@ sub TBot_List_handler($$$$;$) $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 ) ) { # store text for adding TBot_List_setMsgId( $hash, $tbot, $chatId, $arg, "expadd" ); - - my $inline = "(".TBot_List_inlinekey( $hash, "Ja", "list_expaddyes" )."|".TBot_List_inlinekey( $hash, "Nein", "list_edit" ).")"; - fhem( "set ".$tbot." queryEditInline $msgId ".'@'.$chatId." $inline $textmsg" ); + + if ( AttrVal($name,'confirmUnsolicited',1) ) { + 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 { $ret = "TBot_List_handler: $name - $tbot ERROR no msgId known for peer :$peer: chat :$chatId: cmd :$cmd: ".(defined($arg)?"arg :$arg:":""); }