From 952e509e92d707feffaa993a80c042efe7f82974 Mon Sep 17 00:00:00 2001 From: Sergei Fedosov Date: Fri, 6 Aug 2021 14:16:49 +0300 Subject: [PATCH] Fix url handling in answer --- lib/Bot/IRC.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Bot/IRC.pm b/lib/Bot/IRC.pm index ef344a7..52829d3 100644 --- a/lib/Bot/IRC.pm +++ b/lib/Bot/IRC.pm @@ -598,7 +598,7 @@ sub say { for my $s (@_) { if ($s =~ /^PRIVMSG /) { - foreach my $buf (split_irc_msg ($s)) { + foreach my $buf (split_irc_msg ($self, $s)) { my $string = $buf; _utf8_off ($buf); $self->{socket}->syswrite( $buf . "\r\n"); @@ -681,6 +681,7 @@ sub health { } sub split_irc_msg { + my $self = shift; my $str = shift; chomp $str; @@ -701,8 +702,13 @@ sub split_irc_msg { $prefix = CORE::join ':', @message; $prefix .= ':'; } else { - $prefix = CORE::join ':', @message; - $prefix .= ', '; + if ($message [1] eq $self->{nick} || $message [1] eq $self->{in}->{nick}) { + $prefix = CORE::join ':', @message; + $prefix .= ', '; + } else { + $prefix = CORE::join ':', @message; + $prefix .= ':'; + } } $MAXLEN = $MAXLEN - bytes::length ($prefix) - 100;