From 43bfd42b6dccdfcc042a08737123883686be7123 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 28 Nov 2020 09:23:55 +0000 Subject: [PATCH] 50_SSChatBot: contrib 1.12.1 git-svn-id: https://svn.fhem.de/fhem/trunk@23245 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/50_SSChatBot.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fhem/contrib/DS_Starter/50_SSChatBot.pm b/fhem/contrib/DS_Starter/50_SSChatBot.pm index ee08d81e1..d50b151d8 100644 --- a/fhem/contrib/DS_Starter/50_SSChatBot.pm +++ b/fhem/contrib/DS_Starter/50_SSChatBot.pm @@ -1,5 +1,5 @@ ######################################################################################################################## -# $Id: 50_SSChatBot.pm 22946 2020-10-09 09:28:23Z DS_Starter $ +# $Id: 50_SSChatBot.pm 23220 2020-11-23 18:07:13Z DS_Starter $ ######################################################################################################################### # 50_SSChatBot.pm # @@ -135,7 +135,9 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.12.0" => "23.11.2020 generate event UserInitialized when users are once loaded, Forum: https://forum.fhem.de/index.php/topic,105714.msg1103700.html#msg1103700 ", + "1.12.1" => "28.11.2020 fix cannot send after received anything ", + "1.12.0" => "23.11.2020 generate event CHAT_INITIALIZED when users are once loaded, Forum: https://forum.fhem.de/index.php/topic,105714.msg1103700.html#msg1103700 ". + "postpone new operation is one ist still running ", "1.11.7" => "01.11.2020 quotation marks can be used in text tag of received messages (__botCGIcheckData) ", "1.11.6" => "08.10.2020 add urlEncode of character codes like \x{c3}\x{85} to formString ", "1.11.5" => "06.10.2020 use addSendqueue from SMUtils, delete local addSendqueue ", @@ -861,6 +863,11 @@ sub getApiSites { return $ret; } + if($hash->{OPMODE}) { # Überholer vermeiden wenn eine Operation läuft (V. 1.12.0" => "23.11.2020) + Log3($name, 4, qq{$name - Operation "$hash->{OPMODE} (idx: $hash->{OPIDX})" is still running. Next operation start postponed}); + return; + } + # den nächsten Eintrag aus "SendQueue" selektieren und ausführen wenn nicht forbidSend gesetzt ist for my $idx (sort{$a<=>$b} keys %{$data{SSChatBot}{$name}{sendqueue}{entries}}) { if (!$data{SSChatBot}{$name}{sendqueue}{entries}{$idx}{forbidSend} || $hash->{HELPER}{RESENDFORCE}) { @@ -985,7 +992,7 @@ sub getApiSites_parse { Log3 ($name, 4, "$name - API completed:\n".Dumper $hash->{HELPER}{API}); if ($opmode eq "apiInfo") { # API Infos in Popup anzeigen - showAPIinfo ($hash, $hash->{HELPER}{API}); # übergibt Referenz zum instanziierten API-Hash) + showAPIinfo ($hash, $hash->{HELPER}{API}); # übergibt Referenz zum instanziierten API-Hash) checkSendRetry ($name, 0, $queueStartFn); return; } @@ -1305,6 +1312,9 @@ sub _parseSendItem { my $postid = ""; my $idx = $hash->{OPIDX}; + + return if(!$idx); + my $uid = $data{SSChatBot}{$name}{sendqueue}{entries}{$idx}{userid}; if($data->{data}{succ}{user_id_post_map}{$uid}) { @@ -1539,6 +1549,8 @@ sub _botCGIdata { readingsBulkUpdate ($hash, "state", $state ); readingsEndUpdate ($hash,1); + delete $hash->{OPMODE}; + return ("text/plain; charset=utf-8", $ret); }