3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

Interpreter: move dehighlight/truncate to output_result()

This commit is contained in:
Pragmatic Software 2021-08-25 19:40:38 -07:00
parent d9a9ef0cc0
commit fd1c5b66c9
2 changed files with 11 additions and 9 deletions

View File

@ -691,6 +691,8 @@ sub handle_result {
my $original_result = $result; my $original_result = $result;
$context->{original_result} = $result;
$result =~ s/[\n\r]/ /g unless $preserve_newlines; $result =~ s/[\n\r]/ /g unless $preserve_newlines;
$result =~ s/[ \t]+/ /g unless $context->{preserve_whitespace}; $result =~ s/[ \t]+/ /g unless $context->{preserve_whitespace};
@ -730,13 +732,6 @@ sub handle_result {
last; last;
} }
# insert null-width spaces into nicknames to prevent IRC clients
# from unncessarily highlighting people
$line = $self->dehighlight_nicks($line, $context->{from});
# truncate if necessary, pasting original result to a web paste site
$line = $self->truncate_result($context, $line, $original_result);
if ($use_output_queue) { if ($use_output_queue) {
my $delay = rand(10) + 5; my $delay = rand(10) + 5;
my $message = { my $message = {
@ -880,6 +875,13 @@ sub output_result {
# nothing more to do here if the output is going to the bot # nothing more to do here if the output is going to the bot
return if $to eq $botnick; return if $to eq $botnick;
# insert null-width spaces into nicknames to prevent IRC clients
# from unncessarily highlighting people
$output = $self->dehighlight_nicks($output, $to) unless $output =~ m|^/msg |;
# truncate if necessary, pasting original result to a web paste site
$output = $self->truncate_result($context, $output, $context->{original_result});
# handle various /command prefixes # handle various /command prefixes
my $type = 'echo'; # will be set to 'echo' or 'action' depending on /command prefix my $type = 'echo'; # will be set to 'echo' or 'action' depending on /command prefix

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4366, BUILD_REVISION => 4367,
BUILD_DATE => "2021-08-24", BUILD_DATE => "2021-08-25",
}; };
sub initialize {} sub initialize {}