summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-06-26 09:17:21 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-06-26 09:17:21 +0000
commit14bd999ada56e20ffc355ef32d7a8a0bbf9d1032 (patch)
tree05e8351b5dca645e6fd6eaf86db5813227af4083 /modules
parent7e08e2e87e3de903b8810a0bd357a45a65cc3b49 (diff)
new commands, users, hilights, rules, bugfixes, and all sorts of other good stuff
Diffstat (limited to 'modules')
-rw-r--r--modules/event.pl32
-rw-r--r--modules/inspect.pl15
-rw-r--r--modules/util.pl6
-rw-r--r--modules/xml.pl17
4 files changed, 60 insertions, 10 deletions
diff --git a/modules/event.pl b/modules/event.pl
index 77583e4..2feb915 100644
--- a/modules/event.pl
+++ b/modules/event.pl
@@ -234,6 +234,38 @@ sub whois_end {
$::idqueue{$who} = [];
}
+sub whois_user {
+ my ($conn, $event2) = @_;
+ my $lnick = lc $event2->{args}->[1]
+ unless (defined($::sn{$lnick})) {
+ $::sn{$lnick} = {};
+ }
+ $::sn{$lnick}{gecos} = $event2->{args}->[5];
+ $::sn{$lnick}{user} = $event2->{args}->[2];
+ $::sn{$lnick}{host} = $event2->{args}->[3];
+ if (defined( $::needgeco{$lnick} )) {
+ inspect(shift($::needgeco{$lnick}));
+ delete $::needgeco{$lnick} if $::needgeco{$lnick} eq ();
+ }
+}
+#<<< :kubrick.freenode.net 311 AntiSpamMeta AfterDeath i=icxcnika atheme/troll/about.linux.afterdeath * :[[User:WHeimbigner]]
+#Trying to handle event 'whoisuser'.
+#Handler for 'whoisuser' called.
+#<<< :kubrick.freenode.net 319 AntiSpamMeta AfterDeath :#nslu2-general @#bash @##asb-testing +#vandalism-en-wp +#thetestwiki #arbchat #wikipedia-social #wikipedia-en #wikimedia-stewards #wikimedia-irc @##krypt77 #wikipedia #freenode #hyperion ##linux #gentoo #debian ##windows #defocus #atheme.org #freenode-dev +##asb-nexus #houseofhack ##linux-ops @#baadf00d #wikimedia-ops #ubuntu ##socialites
+#Trying to handle event 'whoischannels'.
+#Handler for 'whoischannels' called.
+#<<< :kubrick.freenode.net 312 AntiSpamMeta AfterDeath irc.freenode.net :http://freenode.net/
+#Trying to handle event 'whoisserver'.
+#Handler for 'whoisserver' called.
+#<<< :kubrick.freenode.net 320 AntiSpamMeta AfterDeath :is identified to services
+#Trying to handle event 'whoisvworld'.
+#Handler for 'whoisvworld' called.
+#<<< :kubrick.freenode.net 318 AntiSpamMeta afterdeath :End of /WHOIS list.
+#Trying to handle event 'endofwhois'.
+#Handler for 'endofwhois' called.
+
+
+
sub on_bannedfromchan {
my ($conn, $event) = @_;
$conn->privmsg('ChanServ', "unban $event->{args}->[1]");
diff --git a/modules/inspect.pl b/modules/inspect.pl
index 3837ba9..76b520f 100644
--- a/modules/inspect.pl
+++ b/modules/inspect.pl
@@ -4,16 +4,18 @@ use strict;
use List::Util qw(first);
#my @ignored = ();
+@::ignored = ();
sub inspect {
our ($conn, $event) = @_;
my (%conx, %monx);
our (%aonx, %dct, $rev, $chan, $id);
- %aonx=(); %dct=(); $rev=""; $chan=""; $id="";
+ %aonx=(); %dct=(); $rev; $chan=""; $id="";
my (@dnsbl, @unpakt, @uniq, @cut);
my ($match, $txtz, $iaddr);
my @override = [];
our $unmode='';
+ my $nick = lc $event->{nick};
return if (defined(first { ( lc $event->{nick} eq lc $_ ) } @::eline));
return if (defined(first { ( lc $event->{user} eq lc $_ ) } @::eline));
return if (defined(first { ( lc $event->{host} eq lc $_ ) } @::eline));
@@ -21,9 +23,9 @@ sub inspect {
$rev = join('.', reverse(unpack('C4', $iaddr))).'.' if (defined $iaddr);
%monx = defined($::channels->{channel}->{master}->{event}) ? %{$::channels->{channel}->{master}->{event}} : ();
## NB: isn't there a better way to do this with grep, somehow?
-# foreach ( @ignored ) {
-# return if (lc $event->{nick} eq $_);
-# }
+ foreach ( @::ignored ) {
+ return if (lc $event->{nick} eq $_);
+ }
foreach $chan ( @{$event->{to}} ) {
next unless $chan =~ /^#/;
%conx = defined($::channels->{channel}->{lc $chan}->{event}) ? %{$::channels->{channel}->{lc $chan}->{event}} : ();
@@ -42,6 +44,7 @@ sub inspect {
delete $dct{$_} foreach @override;
foreach $chan (@{$event->{to}}) {
foreach $id ( keys %dct ) {
+ sql_record($chan, $event->{nick}, $event->{user}, $event->{host}, $dct{$id}{risk}, $id, $dct{$id}{reason});
$txtz = "$dct{$id}{risk} risk threat: ".
"Detected $event->{nick} $dct{$id}{reason} in $chan ";
$txtz = $txtz . commaAndify(getAlert(lc $chan, $dct{$id}{risk}, 'hilights')) if (getAlert(lc $chan, $dct{$id}{risk}, 'hilights'));
@@ -59,8 +62,8 @@ sub inspect {
}
}
$conn->privmsg($_, $txtz) foreach getAlert($chan, $dct{$id}{risk}, 'msgs');
-# push(@ignored, lc $event->{nick});
-# $conn->schedule(10, sub { @ignored = grep { $_ ne lc $event->{nick} } @ignored; });
+ push(@::ignored, lc $event->{nick});
+ $conn->schedule(15, sub { @::ignored = grep { lc $_ ne lc $nick } @::ignored; });
}
}
}
diff --git a/modules/util.pl b/modules/util.pl
index 060eee0..fb10356 100644
--- a/modules/util.pl
+++ b/modules/util.pl
@@ -6,7 +6,7 @@ use strict;
my %sf;
my %oq;
-my %RISKS =
+%::RISKS =
(
'debug' => 10,
'info' => 20,
@@ -91,8 +91,8 @@ sub getAlert {
my ($c, $risk, $t) = @_;
@_ = ();
$c = lc $c;
- foreach my $prisk ( keys %RISKS) {
- if ( $RISKS{$risk} >= $RISKS{$prisk} ) {
+ foreach my $prisk ( keys %::RISKS) {
+ if ( $::RISKS{$risk} >= $::RISKS{$prisk} ) {
push( @_, @{$::channels->{channel}->{master}->{$t}->{$prisk}} ) if defined $::channels->{channel}->{master}->{$t}->{$prisk};
push( @_, @{cs($c)->{$t}->{$prisk}} ) if defined cs($c)->{$t}->{$prisk};
}
diff --git a/modules/xml.pl b/modules/xml.pl
index 2cb2505..9e7e526 100644
--- a/modules/xml.pl
+++ b/modules/xml.pl
@@ -15,10 +15,11 @@ sub readXML {
$::users = $xs1->XMLin( "$p/users.xml", ForceArray => 'person' );
$::xusers = $::users->{person};
$::commands = $xs1->XMLin( "$p/commands.xml", ForceArray => [qw/command/]);
+ $::mysql = $xs1->XMLin( "$p/mysql.xml", ForceArray => [] );
}
sub writeXML {
- my ( $p ) = @_;
+ my ( $p ) = $::cset; #@_;
$p = 'default' if $p eq '';
$p = "config-$p";
$xs1->XMLout($::settings, RootName => 'settings', KeyAttr => ['id'],
@@ -31,6 +32,20 @@ sub writeXML {
$xs1->XMLout($::commands, RootName => 'commands', KeyAttr => ['id']) > io("$p/commands.xml");
}
+sub writeChannels {
+ my ( $p ) = $::cset; #@_;
+ $p = 'default' if $p eq '';
+ $p = "config-$p";
+ $xs1->XMLout($::channels, RootName => 'channels', KeyAttr => ['id']) > io("$p/channels.xml");
+}
+
+sub writeUsers {
+ my ( $p ) = $::cset; #@_;
+ $p = 'default' if $p eq '';
+ $p = "config-$p";
+ $xs1->XMLout($::users, RootName => 'people', KeyAttr => ['id']) > io("$p/users.xml");
+}
+
sub Xml::killsub {
undef &readXML;
undef &writeXML;