From ac88dd7cf30184634278b216d90891109c1eef14 Mon Sep 17 00:00:00 2001 From: viegener Date: Sat, 11 Nov 2017 16:02:47 +0000 Subject: [PATCH] 50_TelegramBot: fix minusdesc warning / cleanup git-svn-id: https://svn.fhem.de/fhem/trunk@15421 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/50_TelegramBot.pm | 49 ++++++------------------------------- 2 files changed, 9 insertions(+), 41 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index a37b6132e..56773d2a7 100644 --- a/fhem/CHANGED +++ b/fhem/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. + - bugfix: 50_TelegramBot: fix minusdesc warning / cleanup - fix: 71_YAMAHA_AVR: fix navigateListMenu on RX-Vx65/RX-Vx67 series - feature: 89_FULLY: Turn motion detection on or off - new: 89_FULLY: Control Fully Browser diff --git a/fhem/FHEM/50_TelegramBot.pm b/fhem/FHEM/50_TelegramBot.pm index eceecfd60..bdeb95290 100644 --- a/fhem/FHEM/50_TelegramBot.pm +++ b/fhem/FHEM/50_TelegramBot.pm @@ -136,12 +136,17 @@ # json_decode mit nonref #msg687580 # 2.6 2017-09-24 hide command in favorites/change direct favorites confirm -# -# +# Fix minusdesc undefined issue +# Cleanup old code + # ############################################################################## # TASKS # +# \n in inline keyboards +# +# queryDialogStart / queryDialogEnd - keep msg id +# # # # remove keyboard after favorite confirm @@ -992,6 +997,7 @@ sub TelegramBot_SplitFavoriteDef($$) { $confirm = ""; $result = ""; $hidden = 0; + $minusdesc = ""; if ( $cmd =~ /^\s*((\/([^\[=]*)?)(\[(-)?([^\]]+)\])?\s*=)?(\??)(\!?)(.*?)$/ ) { $alias = $2; @@ -1277,17 +1283,10 @@ sub TelegramBot_SentLastCommand($$$$) { $resppeer .= "(".$mchatnorm.")" if ( $mchatnorm ); $ret =~ s/\$peer/$resppeer/g; - # $ret = "TelegramBot FHEM : $mpeernorm \n Last Commands \n"; # overwrite ret with result from SendIt --> send response $ret = TelegramBot_SendIt( $hash, (($mchatnorm)?$mchatnorm:$mpeernorm), $ret, $jsonkb, 0 ); -############ OLD SentLastCommands sent as message -# $ret = "TelegramBot fhem : $mpeernorm \nLast Commands \n\n".$slc; - -# # overwrite ret with result from Analyzecommand --> send response -# $ret = AnalyzeCommand( undef, "set $name message \@$mpeernorm $ret", "" ); - return $ret; } @@ -1393,20 +1392,6 @@ sub TelegramBot_ExecuteCommand($$$$;$$) { $ret =~ s/^(\s|(\\[rfnt]))+|(\s|(\\[rfnt]))+$//g if ( defined($ret) ); # Debug "Length after :".length($ret); - - -# my $retstart = "TelegramBot FHEM"; -# $retstart .= " from $pname ($mpeernorm)" if ( defined( $defpeer ) ); - -# my $retempty = AttrVal($name,'cmdReturnEmptyResult',1); - - # undef is considered ok -# if ( ( ! defined( $ret ) ) || ( length( $ret) == 0 ) ) { -# # : External message -# $ret = "$retstart cmd :$cmd: result OK" if ( $retempty ); -# } elsif ( ! $isMediaStream ) { -# $ret = "$retstart cmd :$cmd: result :$ret:"; -# } Log3 $name, 5, "TelegramBot_ExecuteCommand $name: ".TelegramBot_MsgForLog($ret, $isMediaStream ).": "; if ( ( defined( $ret ) ) && ( length( $ret) != 0 ) ) { @@ -1534,16 +1519,6 @@ sub Telegram_HandleCommandInMessages($$$$$$) } elsif ( $doRet ) { return; } - -# # Build the final command from the the alias and the remainder of the message -# Log3 $name, 5, "TelegramBot_ParseMsg $name: Alias Match :$aliasKey:"; -# $cmd = $hash->{AliasCmds}{$aliasKey}." ".$cmd; -# $cmdRet = TelegramBot_ExecuteCommand( $hash, $mpeernorm, $mchatnorm, $cmd ); -# Log3 $name, 4, "TelegramBot_ParseMsg $name: ExecuteFavoriteCmd returned :$cmdRet:" if ( defined($cmdRet) ); -# return; -# } elsif ( $doRet ) { -# return; -# } } } @@ -1975,9 +1950,6 @@ sub TelegramBot_MakeKeyboard($$$@) my $refkb = \%par; -# $refkb = TelegramBot_Deepencode( $name, $refkb ); - -# $ret = encode_json( $refkb ); my $json = JSON->new->utf8; $ret = $json->utf8(0)->encode( $refkb ); Log3 $name, 4, "TelegramBot_MakeKeyboard $name: json :$ret: is utf8? ".(utf8::is_utf8($ret)?"yes":"no"); @@ -2376,11 +2348,6 @@ sub TelegramBot_ParseMsg($$$) $chatId = $chat->{id}; } -# my $user = $message->{contact}; -# if ( defined( $user ) ) { -# push( @contacts, $user ); -# } - my $user = $message->{new_chat_participant}; if ( defined( $user ) ) { push( @contacts, $user );