- ban on join added.
- added 'b' to &hookMode()'s stats keeping.
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@278
c11ca15a-4712-0410-83d8-
924469b57eb5
+ if (defined $userHandle) {
+ &DEBUG("IrcHooks.pl: line 104: remove vUser");
+ }
+
$userHandle = &verifyUser($who, $nuh);
&status("$b_red=$b_cyan$who$b_red=$ob $message");
$userHandle = &verifyUser($who, $nuh);
&status("$b_red=$b_cyan$who$b_red=$ob $message");
### chanserv support.
### TODO: what if we rejoin a channel.. need to set a var that
### we've done the request-for-ops-on-join.
### chanserv support.
### TODO: what if we rejoin a channel.. need to set a var that
### we've done the request-for-ops-on-join.
- return unless (&IsParam("chanServ_ops"));
+ return unless (&IsChanConf("chanServ_ops") > 0);
return unless ($nickserv);
return unless ($nickserv);
- my @chans = split(/[\s\t]+/, $param{'chanServ_ops'});
-
- ### TODO: since this function has a chan arg, why don't we use
- ### that instead of doing the following?
- foreach $chan (keys %channels) {
- next unless (grep /^$chan$/i, @chans);
-
- if (!exists $channels{$chan}{'o'}{$ident}) {
- &status("ChanServ ==> Requesting ops for $chan.");
- &rawout("PRIVMSG ChanServ :OP $chan $ident");
- }
+ if (!exists $channels{$chan}{'o'}{$ident}) {
+ &status("ChanServ ==> Requesting ops for $chan.");
+ &rawout("PRIVMSG ChanServ :OP $chan $ident");
$channels{$chan}{''}{$who}++;
$nuh{lc $who} = $who."!".$user."\@".$host unless (exists $nuh{lc $who});
$channels{$chan}{''}{$who}++;
$nuh{lc $who} = $who."!".$user."\@".$host unless (exists $nuh{lc $who});
+ ### on-join ban. (TODO: kick)
+ if (exists $bans{$chan}) {
+ ### TODO: need to do $chan and _default
+ foreach (keys %{ $bans{$chan} }) {
+ s/\*/\\S*/g;
+ next unless /^\Q$nuh\E$/i;
+
+ foreach (keys %{ $channels{$chan}{'b'} }) {
+ &DEBUG(" bans_on_chan($chan) => $_");
+ }
+
+ ### TODO: check $channels{$chan}{'b'} if ban already exists.
+ &ban( "*!*@".&makeHostMask($host), $chan);
+ last;
+ }
+ }
+
### ROOTWARN:
&rootWarn($who,$user,$host,$chan)
if (&IsParam("rootWarn") &&
### ROOTWARN:
&rootWarn($who,$user,$host,$chan)
if (&IsParam("rootWarn") &&
sub on_msg {
my ($self, $event) = @_;
my $nick = $event->nick;
sub on_msg {
my ($self, $event) = @_;
my $nick = $event->nick;
- my $chan = lc ( ($event->to)[0] ); # CASING.
- my $msg = ($event->args)[0];
+ my $msg = ($event->args)[0];
($user,$host) = split(/\@/, $event->userhost);
$uh = $event->userhost();
$nuh = $nick."!".$uh;
($user,$host) = split(/\@/, $event->userhost);
$uh = $event->userhost();
$nuh = $nick."!".$uh;
- &hookMsg('private', $chan, $nick, $msg);
+ &hookMsg('private', undef, $nick, $msg);
}
# modes w/ target affecting nick => cache it.
}
# modes w/ target affecting nick => cache it.
+ if ($mode =~ /[bov]/) {
$channels{$chan}{$mode}{$target}++ if $parity;
delete $channels{$chan}{$mode}{$target} if !$parity;
}
$channels{$chan}{$mode}{$target}++ if $parity;
delete $channels{$chan}{$mode}{$target} if !$parity;
}
$flood{$floodwho}{$message} = time();
}
$flood{$floodwho}{$message} = time();
}
- # public.
- if ($msgType =~ /public/i) {
- $talkchannel = $chan;
+ if ($msgType =~ /public/i) { # public.
+ $talkchannel = $chan;
&status("<$orig{who}/$chan> $orig{message}");
&status("<$orig{who}/$chan> $orig{message}");
- }
-
- # private.
- if ($msgType =~ /private/i) {
+ } elsif ($msgType =~ /private/i) { # private.
&status("[$orig{who}] $orig{message}");
&status("[$orig{who}] $orig{message}");
+ $talkchannel = undef;
+ $chan = "_default";
+ } else {
+ &DEBUG("unknown msgType => $msgType.");
}
if ((!$skipmessage or &IsParam("seenStoreAll")) and
}
if ((!$skipmessage or &IsParam("seenStoreAll")) and
return if ($skipmessage);
return unless (&IsParam("minVolunteerLength") or $addressed);
return if ($skipmessage);
return unless (&IsParam("minVolunteerLength") or $addressed);
- ### TODO: hash list of already-checked users.
- ### eg: $ignoreChecked{$mask} = time();
- my $checked = 0;
-
- if (my @m = grep /^$nuh$/i, keys %ignoreChecked) {
- &DEBUG("found ignore for $nuh.");
- foreach (@m) {
- &DEBUG("masks => $_ ($ignoreChecked{$_})");
- }
- }
-
- foreach (keys %ignore) {
- my $c = $_;
- &DEBUG("c = $_, chan = $chan.");
-
- foreach (keys %{ $ignore{$c} }) {
- my $m = $_;
- $m =~ s/\*/\\S*/g;
+ if (exists $ignore{lc $chan}) {
+ foreach (keys %{ $ignore{lc $chan} }) {
+ s/\*/\\S*/g;
- next unless ($nuh =~ /^\Q$m\E$/i);
+ next unless ($nuh =~ /^\Q$_\E$/i);
- $ignoreChecked{$nuh} = $c;
- if (!$ignore and !$checked) {
- push(@ignore_off, $nuh);
- }
-
+ if (defined $userHandle) {
+ &DEBUG("line 1074: remove verifyUser");
+ }
$userHandle = &verifyUser($who, $nuh);
} else {
&DEBUG("hookMsg: 'nuh' not defined?");
$userHandle = &verifyUser($who, $nuh);
} else {
&DEBUG("hookMsg: 'nuh' not defined?");