Allow a hook to block an event.
This commit is contained in:
1 parent
067da4d7ad
commit
deb95a7ee7
1 file changed
+3
-1
+3
-1
@@ -180,7 +180,8 @@ sub event_run
|
|||||||
|
|
||||||
if (defined $EVENTS{lc $event} and defined $HOOKS{lc $event}) {
|
if (defined $EVENTS{lc $event} and defined $HOOKS{lc $event}) {
|
||||||
foreach my $hk (keys %{ $HOOKS{lc $event} }) {
|
foreach my $hk (keys %{ $HOOKS{lc $event} }) {
|
||||||
&{ $HOOKS{lc $event}{$hk} }(@args);
|
my $ri = &{ $HOOKS{lc $event}{$hk} }(@args);
|
||||||
|
if ($ri == -1) { last; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +440,7 @@ sub ratelimit_check
|
|||||||
# If the user has not passed the rate limit.
|
# If the user has not passed the rate limit.
|
||||||
if ($Core::IRC::usercmd{$src{nick}.'@'.$src{host}.'/'.$src{svr}} <= (conf_get('ratelimit_amount'))[0][0]) {
|
if ($Core::IRC::usercmd{$src{nick}.'@'.$src{host}.'/'.$src{svr}} <= (conf_get('ratelimit_amount'))[0][0]) {
|
||||||
# Increment their uses and return 1.
|
# Increment their uses and return 1.
|
||||||
|
|
||||||
$Core::IRC::usercmd{$src{nick}.'@'.$src{host}.'/'.$src{svr}}++;
|
$Core::IRC::usercmd{$src{nick}.'@'.$src{host}.'/'.$src{svr}}++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user