From 4a025801a2a9980fc4d426731a3194781d716d5c Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 27 Oct 2024 12:52:15 -0700 Subject: [PATCH] applets/pbot-vm: disregard IRC text modifiers when escaping unprintable characters --- applets/pbot-vm/host/lib/Languages/_default.pm | 12 +++++++++++- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/applets/pbot-vm/host/lib/Languages/_default.pm b/applets/pbot-vm/host/lib/Languages/_default.pm index 4cd38158..8010e1fa 100755 --- a/applets/pbot-vm/host/lib/Languages/_default.pm +++ b/applets/pbot-vm/host/lib/Languages/_default.pm @@ -373,12 +373,22 @@ sub postprocess_output($self) { # "\n" => '', # \t is left alone + ); $self->{output} =~ s/([\e\f])/$escapes{$1}/gs; # other unprintables - my %disregard = ( "\n" => 1, "\r" => 1, "\t" => 1, "\x03" => 1 ); + my %disregard = ( + "\n" => 1, "\r" => 1, "\t" => 1, + "\x11" => 1, # monospace + "\x1D" => 1, # italic + "\x1E" => 1, # strikethrough + "\x1F" => 1, # underline + "\x02" => 1, # bold + "\x03" => 1, # colors + "\x0F" => 1, # reset + ); $self->{output} =~ s/([\x00-\x1f])/$disregard{$1} ? $1 : sprintf('\x%02X', ord $1)/gse; } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 356275df..22c25c2e 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4813, - BUILD_DATE => "2024-10-25", + BUILD_REVISION => 4814, + BUILD_DATE => "2024-10-27", }; sub initialize {}