From de7b0cd8c871edf80dfb4018b5e94245db233805 Mon Sep 17 00:00:00 2001 From: viegener Date: Tue, 30 May 2017 18:11:30 +0000 Subject: [PATCH] 50_TelegramBot: fix: options remove in sendit corrected: #msg641797 git-svn-id: https://svn.fhem.de/fhem/trunk@14424 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/50_TelegramBot.pm | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/50_TelegramBot.pm b/fhem/FHEM/50_TelegramBot.pm index a633a62d0..cd91d74c5 100644 --- a/fhem/FHEM/50_TelegramBot.pm +++ b/fhem/FHEM/50_TelegramBot.pm @@ -111,6 +111,12 @@ # Debug/log cleanup # 2.4 2016-05-25 favorites rework - inline / allow : in inline +# fix: options remove in sendit corrected: #msg641797 + + +# +# +# # # ############################################################################## @@ -812,6 +818,18 @@ sub TelegramBot_Attr(@) { # wait some time before next polling is starting TelegramBot_ResetPolling( $hash ); + } elsif ($aName eq 'disable') { + if ( $aVal =~ /^(1|0)$/ ) { + # let all existing methods run into block + RemoveInternalTimer($hash); + $hash->{POLLING} = -1; + + # wait some time before next polling is starting + TelegramBot_ResetPolling( $hash ); + } else { + return "\"TelegramBot_Attr: \" $aName needs to be 1 or 0"; + } + } elsif ($aName eq 'pollingVerbose') { return "\"TelegramBot_Attr: \" Incorrect value given for pollingVerbose" if ( $aVal !~ /^((1_Digest)|(2_Log)|(0_None))$/ ); @@ -829,6 +847,15 @@ sub TelegramBot_Attr(@) { $_[3] = $aVal; + } elsif ($cmd eq "set") { + if ( ($aName eq 'pollingTimeout') || ($aName eq 'disable') ) { + # let all existing methods run into block + RemoveInternalTimer($hash); + $hash->{POLLING} = -1; + + # wait some time before next polling is starting + TelegramBot_ResetPolling( $hash ); + } } return undef; @@ -1562,7 +1589,8 @@ sub TelegramBot_SendIt($$$$$;$$$) if ( defined( $peers ) ) { # ignore return, since it is only queued # remove msgid from options and also replyid reset - my $sepoptions =~ s/-msgid-//; + my $sepoptions = $options; + $sepoptions =~ s/-msgid-//; TelegramBot_SendIt( $hash, $peers, $msg, $addPar, $isMedia, undef, $sepoptions ); }