3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-02-08 18:44:17 +01:00

Improve output of truncation text

Instead of "... [truncated; see http://xxx for full text.]" it more
concisely says "... <truncated; http://...>".

Increased irc.max_msg_len from a very conservative 425 to a more
generous 460. If you have very long channel names or nicknames, or if
you see things being truncated incorrectly, reduce this value.
This commit is contained in:
Pragmatic Software 2021-08-12 22:30:56 -07:00
parent 91073df113
commit d1df2d325c
4 changed files with 8 additions and 8 deletions

2
data/registry vendored
View File

@ -284,7 +284,7 @@
}, },
"max_msg_len" : { "max_msg_len" : {
"type" : "text", "type" : "text",
"value" : "425" "value" : "460"
}, },
"port" : { "port" : {
"type" : "text", "type" : "text",

View File

@ -770,17 +770,17 @@ sub truncate_result {
$paste_result = $self->{pbot}->{webpaste}->paste("$context->{from} <$context->{nick}> $context->{text}\n\n$paste_text"); $paste_result = $self->{pbot}->{webpaste}->paste("$context->{from} <$context->{nick}> $context->{text}\n\n$paste_text");
} }
my $trunc = '... [truncated'; my $trunc = '... <truncated';
if (not defined $paste_result) { if (not defined $paste_result) {
# no paste # no paste
$trunc .= "]"; $trunc .= '>';
} elsif ($paste_result =~ m/^http/) { } elsif ($paste_result =~ m/^http/) {
# a link # a link
$trunc .= "; see $paste_result for full text.]"; $trunc .= "; $paste_result>";
} else { } else {
# an error or something else # an error or something else
$trunc .= "; $paste_result]"; $trunc .= "; $paste_result>";
} }
$paste_result //= 'not pasted'; $paste_result //= 'not pasted';

View File

@ -48,7 +48,7 @@ sub initialize {
# irc # irc
$self->add_default('text', 'irc', 'debug', $conf{irc_debug} // 0); $self->add_default('text', 'irc', 'debug', $conf{irc_debug} // 0);
$self->add_default('text', 'irc', 'show_motd', $conf{show_motd} // 1); $self->add_default('text', 'irc', 'show_motd', $conf{show_motd} // 1);
$self->add_default('text', 'irc', 'max_msg_len', $conf{max_msg_len} // 425); $self->add_default('text', 'irc', 'max_msg_len', $conf{max_msg_len} // 460);
$self->add_default('text', 'irc', 'server', $conf{server} // "irc.libera.chat"); $self->add_default('text', 'irc', 'server', $conf{server} // "irc.libera.chat");
$self->add_default('text', 'irc', 'port', $conf{port} // 6667); $self->add_default('text', 'irc', 'port', $conf{port} // 6667);
$self->add_default('text', 'irc', 'sasl', $conf{SASL} // 0); $self->add_default('text', 'irc', 'sasl', $conf{SASL} // 0);

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 => 4349, BUILD_REVISION => 4352,
BUILD_DATE => "2021-08-06", BUILD_DATE => "2021-08-12",
}; };
sub initialize {} sub initialize {}