From 6c5c263ed2d7a94a35ea157b513e85290de26fc1 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 8 Sep 2015 04:43:24 -0700 Subject: [PATCH] Move URL titles conditional out of loop --- PBot/Plugins/UrlTitles.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PBot/Plugins/UrlTitles.pm b/PBot/Plugins/UrlTitles.pm index 1ed5961d..4ed3aaa8 100644 --- a/PBot/Plugins/UrlTitles.pm +++ b/PBot/Plugins/UrlTitles.pm @@ -48,12 +48,13 @@ sub show_url_titles { } } - while ($msg =~ s/(https?:\/\/[^\s]+)//i && ++$event->{interpreted} <= 3) { - my $url = $1; - if($self->{pbot}->{registry}->get_value('general', 'show_url_titles') and not $self->{pbot}->{registry}->get_value($channel, 'no_url_titles') - and not grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_ignore_channels') - and grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_channels')) { - $self->{pbot}->{factoids}->{factoidmodulelauncher}->execute_module($channel, undef, $nick, $user, $host, $msg, "title", "$nick $url"); + if($self->{pbot}->{registry}->get_value('general', 'show_url_titles') + and not $self->{pbot}->{registry}->get_value($channel, 'no_url_titles') + and not grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_ignore_channels') + and grep { $channel =~ /$_/i } $self->{pbot}->{registry}->get_value('general', 'show_url_titles_channels')) { + + while ($msg =~ s/(https?:\/\/[^\s]+)//i && ++$event->{interpreted} <= 3) { + $self->{pbot}->{factoids}->{factoidmodulelauncher}->execute_module($channel, undef, $nick, $user, $host, $msg, "title", "$nick $1"); } }