1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 16:05:40 -04:00

fixing bug

This commit is contained in:
ryan 2010-01-12 16:04:18 -05:00
parent 7f0e743c93
commit 44af8db499

View file

@ -288,20 +288,11 @@ sub _said {
$said->{$_} = shift @user_info; $said->{$_} = shift @user_info;
} }
#--------------------------
# Check for forwarded message
#--------------------------
$said->{body} = $said->{body_raw};
if ($said->{body} =~ s/\s*>\s*\b([^>]+)\s*$//)
{
#we have a forwarded message
$said->{forwarding} = $1;
}
#-------------------------- #--------------------------
# Check for our own name # Check for our own name
#-------------------------- #--------------------------
$said->{body} = $said->{body_raw};
if( $said->{my_name} ) { #TODO verify that we need this if check. if( $said->{my_name} ) { #TODO verify that we need this if check.
my $body = $said->{body_raw}; my $body = $said->{body_raw};
@ -320,6 +311,17 @@ sub _said {
$said->{addressed_as} = $1; $said->{addressed_as} = $1;
} }
} }
#--------------------------
# Check for forwarded message
#--------------------------
if ($said->{addressed} && $said->{body} =~ s/\s*>\s*\b([^\s>]+)\s*$//)
{
#we have a forwarded message
$said->{forwarding} = $1;
}
#-------------------------- #--------------------------
#-------------------------- #--------------------------
@ -515,6 +517,11 @@ sub channel_list {
sub plugin_output { sub plugin_output {
my( $self, $said, $text ) = @_[OBJECT,ARG0,ARG1]; my( $self, $said, $text ) = @_[OBJECT,ARG0,ARG1];
utf8::decode( $text );
return unless $text =~ /\S/;
$text =~ s/\0/\\0/g; # Replace nulls to prevent them truncating strings we attempt to output.
#this forwards messages to priv_msg for users #this forwards messages to priv_msg for users
if (exists($said->{forwarding}) && defined($said->{forwarding}) && ($said->{forwarding} =~ /\S/)) if (exists($said->{forwarding}) && defined($said->{forwarding}) && ($said->{forwarding} =~ /\S/))
{ {
@ -530,11 +537,6 @@ sub plugin_output {
return; return;
} }
utf8::decode( $text );
return unless $text =~ /\S/;
$text =~ s/\0/\\0/g; # Replace nulls to prevent them truncating strings we attempt to output.
my $pci = $self->get_component( $said->{pci_id} ); my $pci = $self->get_component( $said->{pci_id} );
# sub send_text( $said, $text ) ! # sub send_text( $said, $text ) !