From 7378e3c43c4448328c2e7a1842244ef7a48f0fdd Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 18 Feb 2020 00:38:09 +0000 Subject: [PATCH] part of making rcmd work again for async cmds --- cmd/show/dx.pl | 2 +- cmd/show/groups.pl | 2 +- perl/DXCommandmode.pm | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index 192d252f..19396a70 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -407,7 +407,7 @@ push @out, $self->spawn_cmd("sh/dx $line", \&Spot::search, } } push @out, $self->msg('e3', "sh/dx", "'$line'") unless @out; - $dxchan->send(@out); + return @out; }); #my @res = Spot::search($expr, $fromday, $today, $from, $to, $hint, $dofilter ? $self : undef); diff --git a/cmd/show/groups.pl b/cmd/show/groups.pl index 26aad008..8cbf54e6 100644 --- a/cmd/show/groups.pl +++ b/cmd/show/groups.pl @@ -103,7 +103,7 @@ sub handle } push (@out, "-"); } - $self->send(@out) if @out; + return @out; }); # my @chatlog = DXLog::print(undef, $to, $main::systime, 'chat', undef); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index cbba3b79..4212d968 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -1328,9 +1328,10 @@ sub spawn_cmd return; } if ($cb) { - $cb->($dxchan, @res); - } else { - return unless @res; + # transform output if required + @res = $cb->($dxchan, @res); + } + if (@res) { if (defined $prefix) { $dxchan->send(map {"$prefix$_"} @res); } else { -- 2.43.0