diff --git a/lib/Core/IRC.pm b/lib/Core/IRC.pm index b2c02e1..040ddf0 100644 --- a/lib/Core/IRC.pm +++ b/lib/Core/IRC.pm @@ -12,15 +12,14 @@ our (%usercmd); # CTCP VERSION reply. hook_add("on_uprivmsg", "ctcp_version_reply", sub { - my (($svr, @ex)) = @_; - my %src = usrc(substr($ex[0], 1)); + my (($src, @msg)) = @_; - if ($ex[3] eq ":\001VERSION\001") { + if ($msg[0] eq "\001VERSION\001") { if (Auto::RSTAGE ne 'd') { - notice($svr, $src{nick}, "\001VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE." ".$OSNAME."\001"); + notice($src->{svr}, $src->{nick}, "\001VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE." ".$OSNAME."\001"); } else { - notice($svr, $src{nick}, "\001VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE."-".Auto::GR." ".$OSNAME."\001"); + notice($src->{svr}, $src->{nick}, "\001VERSION ".Auto::NAME." ".Auto::VER.".".Auto::SVER.".".Auto::REV.Auto::RSTAGE."-".Auto::GR." ".$OSNAME."\001"); } } diff --git a/modules/Badwords.pm b/modules/Badwords.pm index 1d5b749..93f82e7 100644 --- a/modules/Badwords.pm +++ b/modules/Badwords.pm @@ -36,14 +36,12 @@ sub _void # Callback for act_on_badword hook. sub actonbadword { - my (($svr, @ex)) = @_; - my %src = API::IRC::usrc(substr $ex[0], 1); + my (($src, $chan, @msg)) = @_; - my $msg = substr $ex[3], 1; - for (my $i = 4; $i < scalar @ex; $i++) { $msg .= q{ }.$ex[$i]; } + my $msg = join ' ', @msg; - if (conf_get("badwords:$ex[2]:word")) { - my @words = @{ (conf_get("badwords:$ex[2]:word"))[0] }; + if (conf_get("badwords:$chan:word")) { + my @words = @{ (conf_get("badwords:$chan:word"))[0] }; foreach (@words) { my ($w, $a) = split m/[:]/, $_; @@ -51,17 +49,17 @@ sub actonbadword if ($msg =~ m/($w)/ixsm) { given ($a) { when ('kick') { - kick($svr, $ex[2], $src{nick}, 'Foul language is prohibited here.'); + kick($src->{svr}, $chan, $src->{nick}, 'Foul language is prohibited here.'); } when ('kickban') { - cmode($svr, $ex[2], '+b *!*@'.$src{host}); - kick($svr, $ex[2], $src{nick}, 'Foul language is prohibited here.'); + cmode($src->{svr}, $chan, '+b *!*@'.$src->{host}); + kick($src->{svr}, $chan, $src->{nick}, 'Foul language is prohibited here.'); } when ('quiet') { - cmode($svr, $ex[2], '+q *!*@'.$src{host}); + cmode($src->{svr}, $chan, '+q *!*@'.$src->{host}); } default { - kick($svr, $ex[2], $src{nick}, 'Foul language is prohibited here.'); + kick($src->{svr}, $chan, $src->{nick}, 'Foul language is prohibited here.'); } } } @@ -72,7 +70,7 @@ sub actonbadword } -API::Std::mod_init("Badwords", "Xelhua", "1.00", "3.0.0d", __PACKAGE__); +API::Std::mod_init('Badwords', 'Xelhua', '1.00', '3.0.0d', __PACKAGE__); # vim: set ai sw=4 ts=4: # build: perl=5.010000