3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Prettify recall messages for JOIN/QUIT/KICK/NICKCHANGE/etc (#12)

This commit is contained in:
Joey Pabalinas 2017-11-11 16:37:54 -10:00 committed by Pragmatic Software
parent 94169b89a2
commit 353fd96022

View File

@ -395,7 +395,13 @@ sub recall_message {
my $text = $msg->{msg};
my $ago = concise ago(gettimeofday - $msg->{timestamp});
if($text =~ s/^\/me\s+// or $text =~ m/^KICKED /) {
if ($text =~ s/^(NICKCHANGE)\b/changed nick to/ or
$text =~ s/^(KICKED|QUIT)\b/lc "$1"/e or
$text =~ s/^(JOIN|PART)\b/lc "$1ed"/e) {
# fix ugly "[nick] quit Quit: Leaving." messages
$text =~ s/^(quit) (.*)/$1 ($2)/;
$recall_text .= "[$ago] $msg->{nick} $text\n";
} elsif ($text =~ s/^\/me\s+//) {
$recall_text .= "[$ago] * $msg->{nick} $text\n";
} else {
$recall_text .= "[$ago] <$msg->{nick}> $text\n";