summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarunknown <unknown@unknown.invalid>2015-03-01 06:08:04 +0400
committerLibravatarJanik Kleinhoff <janik@kleinhoff.de>2015-03-01 06:08:04 +0400
commitdb5b04d263036f53c2cbd429d2da019baafc2a12 (patch)
tree0109622012201d0bd9c56cb7113f47e846a4f51e
parent3df6a2a17870b80ca7ec65ef0eeaca0b33dfe8d6 (diff)
modules/event.pl: Narrow down a regex
(at a glance I have no idea wtf that regex does and I'm normally not too bad at deciphering horrible Cthulhu regex so please forgive me for the horribly useless commit message; it's 3 AM. --bcode)
-rw-r--r--modules/event.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/event.pl b/modules/event.pl
index 06e366c..05003eb 100644
--- a/modules/event.pl
+++ b/modules/event.pl
@@ -727,7 +727,8 @@ sub on_banlist
my ($conn, $event) = @_;
my ($me, $chan, $ban, $banner, $bantime) = @{$event->{args}};
$::sc{lc $chan}{bans}{$ban} = { bannedBy => $banner, bannedOn => $bantime };
- if ($ban =~ /^\*\!\*\@(.*)$/) {
+ if ($ban =~ /^\*\!\*\@((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))$/) {
+ # ASM::Util->dprint("banlist hostname $ban $1", 'sync');
my $ip = ASM::Util->getHostIP($1);
$::sc{lc $chan}{ipbans}{$ip} = { bannedBy => $banner, bannedOn => $bantime } if defined($ip);
}
@@ -738,7 +739,8 @@ sub on_quietlist
my ($conn, $event) = @_;
my ($me, $chan, $mode, $ban, $banner, $bantime) = @{$event->{args}};
$::sc{lc $chan}{quiets}{$ban} = { bannedBy => $banner, bannedOn => $bantime };
- if ($ban =~ /^\*\!\*\@(.*)$/) {
+ if ($ban =~ /^\*\!\*\@((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))$/) {
+ # ASM::Util->dprint("quietlist hostname $ban $1", 'sync');
my $ip = ASM::Util->getHostIP($1);
$::sc{lc $chan}{ipquiets}{$ip} = { bannedBy => $banner, bannedOn => $bantime } if defined($ip);
}