summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-default/channels.xml127
-rw-r--r--config-default/commands.xml75
-rw-r--r--config-default/users.xml11
-rwxr-xr-xmeta.pl2
-rw-r--r--modules/classes.pl8
-rw-r--r--modules/event.pl37
-rw-r--r--modules/inspect.pl6
-rw-r--r--modules/log.pl3
-rw-r--r--modules/util.pl33
-rw-r--r--modules/xml.pl3
10 files changed, 244 insertions, 61 deletions
diff --git a/config-default/channels.xml b/config-default/channels.xml
index 7633dbb..c79d99b 100644
--- a/config-default/channels.xml
+++ b/config-default/channels.xml
@@ -1,11 +1,16 @@
<channels>
- <channel id="##asb-meta" op="no" />
+ <channel id="##asb-meta" link="##asb-testing">
+ <hilights></hilights>
+ </channel>
<channel id="##asb-nexus" op="when">
<hilights></hilights>
<msgs></msgs>
</channel>
<channel id="##asb-testing" op="when">
<hilights>
+ <disable>ST47</disable>
+ <disable>alindeman</disable>
+ <disable>seanw</disable>
<low>a</low>
<low>b</low>
<low>c</low>
@@ -17,13 +22,17 @@
</channel>
<channel id="##linux" op="no">
<hilights>
+ <disable>ST47</disable>
<low>WildPikachu</low>
<low>nalioth</low>
<low>quux</low>
<low>denny</low>
- <low>Fieldy</low>
<low>numist</low>
+ <low>Fieldy</low>
+ <low>savetheWorld</low>
+ <low>tomaw</low>
<medium>PhilKC</medium>
+ <opalert>rob</opalert>
</hilights>
<msgs>
<debug>##linux-ops</debug>
@@ -35,14 +44,19 @@
<opalert>WildPikachu</opalert>
<opalert>quux</opalert>
<opalert>denny</opalert>
- <opalert>Fieldy</opalert>
<opalert>numist</opalert>
<opalert>PhilKC</opalert>
</hilights>
- <msgs opalert="##linux-ops" />
+ <msgs>
+ <opalert>##linux-ops</opalert>
+ </msgs>
+ </channel>
+ <channel id="##tomaw" op="no">
+ <hilights></hilights>
</channel>
<channel id="##windows" op="no">
<hilights>
+ <info>njan</info>
<low>numist</low>
<low>quux</low>
<low>HentaiXP</low>
@@ -51,6 +65,7 @@
<low>JonathanD</low>
<low>Cpudan80</low>
<low>AndrewB</low>
+ <low>pinpoint</low>
</hilights>
<msgs></msgs>
</channel>
@@ -58,6 +73,47 @@
<hilights></hilights>
<msgs></msgs>
</channel>
+ <channel id="#cvn-wp-en" op="no" />
+ <channel id="#defocus" link="#freenode">
+ <hilights></hilights>
+ </channel>
+ <channel id="#freenode" op="no">
+ <hilights>
+ <debug>tomaw</debug>
+ <debug>Dave2</debug>
+ <disable>ST47</disable>
+ <high>Dave2</high>
+ <info>tomaw</info>
+ <info>njan</info>
+ <info>Dave2</info>
+ <info>AndrewB</info>
+ <low>AndrewB</low>
+ <low>denny</low>
+ <low>Dave2</low>
+ <medium>tomaw</medium>
+ <medium>ompaul</medium>
+ <medium>kloeri</medium>
+ <medium>PhilKC</medium>
+ <medium>Dave2</medium>
+ </hilights>
+ <msgs>
+ <debug>#freenode-adb</debug>
+ </msgs>
+ </channel>
+ <channel id="#freenode-adb" op="no">
+ <hilights></hilights>
+ <msgs></msgs>
+ </channel>
+ <channel id="#mediawiki" op="no">
+ <hilights>
+ <debug>flyingparchment</debug>
+ <disable>seanw</disable>
+ <disable>ST47</disable>
+ </hilights>
+ <msgs>
+ <debug>#wikimedia-ops</debug>
+ </msgs>
+ </channel>
<channel id="#religion" op="yes">
<hilights>
<debug>Shadow_mil</debug>
@@ -68,6 +124,8 @@
<channel id="#wikimedia" op="no">
<hilights>
<debug>Mbimmler</debug>
+ <low>Majorly</low>
+ <low>Fabexplosive</low>
</hilights>
<msgs>
<low>#wikimedia-ops</low>
@@ -76,6 +134,7 @@
<channel id="#wikimedia-commons" op="no">
<hilights>
<debug>White_cat</debug>
+ <debug>Majorly</debug>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
@@ -90,18 +149,23 @@
</msgs>
</channel>
<channel id="#wikimedia-ops" op="no">
- <hilights></hilights>
+ <hilights>
+ <debug>Cbrown1023</debug>
+ </hilights>
<msgs></msgs>
</channel>
<channel id="#wikipedia" op="no">
<hilights>
<debug>Cbrown1023</debug>
<debug>Sean_William</debug>
- <debug>ST47</debug>
+ <debug>Majorly</debug>
+ <debug>TheLetterE</debug>
+ <debug>Golbez</debug>
+ <debug>Mbimmler</debug>
<info>Karlprof</info>
+ <info>Martinp23</info>
<low>Pilotguy</low>
<low>Eagle-101</low>
- <low>Mbimmler</low>
<low>skenmy</low>
<low>Ral315</low>
<low>tomaw</low>
@@ -116,6 +180,15 @@
<low>SWATJester</low>
<low>njan</low>
<low>mike42</low>
+ <low>Pilotguy</low>
+ </hilights>
+ <msgs>
+ <debug>#wikimedia-ops</debug>
+ </msgs>
+ </channel>
+ <channel id="#wikipedia-bag" op="no">
+ <hilights>
+ <low>TheFearow</low>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
@@ -123,18 +196,38 @@
</channel>
<channel id="#wikipedia-en" op="yes">
<hilights>
- <debug>White_Cat</debug>
<debug>Cometstyles</debug>
+ <debug>Majorly</debug>
+ <debug>Worby</debug>
+ <debug>kmccoy</debug>
+ <debug>Golbez</debug>
+ <debug>KFP</debug>
+ <debug>wimt</debug>
+ <debug>werdan7</debug>
+ <debug>Animum</debug>
<low>AppleBoy</low>
<low>Soms</low>
- <low>ST47</low>
<low>Martinp23</low>
<low>Cbrown1023</low>
+ <low>TheLetterE</low>
+ <low>KFP</low>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
</msgs>
</channel>
+ <channel id="#wikipedia-en-help" op="no">
+ <hilights>
+ <debug>TheLetterE</debug>
+ <debug>werdan7</debug>
+ </hilights>
+ <msgs>
+ <debug>#wikimedia-ops</debug>
+ </msgs>
+ </channel>
+ <channel id="#wikipedia-en-roads">
+ <hilights></hilights>
+ </channel>
<channel id="#wikipedia-en-roads-us" op="yes">
<hilights>
<debug>vishwin60</debug>
@@ -148,8 +241,8 @@
<low>Eagle-101</low>
<low>Mbimmler</low>
<low>Pilotguy</low>
- <low>ST47</low>
<low>skenmy</low>
+ <low>AndrewB</low>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
@@ -157,20 +250,19 @@
</channel>
<channel id="#wikipedia-social" op="no">
<hilights>
- <debug>ST47</debug>
+ <debug>Golbez</debug>
</hilights>
<msgs>
<low>#wikimedia-ops</low>
</msgs>
</channel>
- <channel id="Mbimmler">
- <hilights></hilights>
- </channel>
<channel id="default" op="no">
<event id="flood-15to45" action="none" class="floodqueue" reason="flooding 15 to 45" risk="low" time="0" type="public">15:45</event>
+ <hilights></hilights>
+ <msgs></msgs>
</channel>
<channel id="master">
- <event id="autoremove" action="none" class="re" reason="on chanserv autoremove" risk="info" time="0" type="part">requested by ChanServ</event>
+ <event id="autoremove" action="none" class="re" reason="on chanserv autoremove" risk="info" time="0" type="part">^requested by ChanServ</event>
<event id="badurl1" action="ban" class="re" reason="sending spam url" risk="medium" time="0" type="public">tinyurl\.com/ypvk4n</event>
<event id="blacklist" action="none" class="strbl" reason="sending pm matching string blacklist" risk="low" time="0" type="public">blah</event>
<event id="ctcp-dcc" action="ban" class="re" reason="ctcp-dcc" risk="high" time="0" type="cdcc">.*</event>
@@ -181,8 +273,6 @@
<event id="ddos_countdown" action="none" class="re" reason="doing the ddos countdown thing" risk="medium" time="0" type="public">^... DDOS COUNTDOWN.*</event>
<event id="dronebl" action="ban" class="dnsbl" override="ahbl" reason="in dnsbl.dronebl.org" risk="info" time="0" type="join">dnsbl.dronebl.org</event>
<event id="efnet_rbl" action="none" class="dnsbl" reason="in rbl.efnet.org" risk="info" time="0" type="join">rbl.efnet.org</event>
- <event id="flood-10to30" action="none" class="floodqueue" reason="flooding (10 messages per 30 seconds)" risk="low" time="0" type="public">10:30</event>
- <event id="flood-5to3" action="quiet" class="floodqueue" reason="flooding (5 messages per 3 seconds)" risk="low" time="10" type="public">5:3</event>
<event id="genspam1" action="none" class="re" reason="generic spamming" risk="debug" time="0" type="public">([^ ]{4,} +)\1{5,}</event>
<event id="goatse" action="ban" class="re" reason="posting goatse link" risk="low" time="0" type="public">goatse\.cz</event>
<event id="joinflood-3to20" action="none" class="floodqueue" reason="join flood (3 joins in 20 seconds)" risk="medium" time="0" type="join">3:20</event>
@@ -193,12 +283,13 @@
<event id="magical" action="none" class="ident" reason="typical w00t ident" risk="info" time="0" type="join">i=magical</event>
<event id="massflood" action="ban" class="splitflood" reason="distributed flooding" risk="high" time="0" type="public,part,caction">5:3</event>
<event id="nickspam" action="ban" class="nickspam" reason="nickspamming" risk="high" time="0" type="public">150:20</event>
- <event id="notice" action="ban" class="re" reason="sending a notice to the channel" risk="high" time="0" type="notice">.*</event>
+ <event id="notice" action="ban" class="re" reason="sending a notice to the channel" risk="medium" time="0" type="notice">.*</event>
<event id="redarmyoflol" action="ban" class="re" reason="parting with 'red army of lol'" risk="low" time="0" type="part">RED ARMY OF LOL</event>
<event id="sms_spam" action="none" class="re" reason="spam link / virus" risk="low" time="0" type="public">\.com/sms.exe</event>
<event id="wikifags2" action="none" class="re" reason="saying 'sure are a lot of wikifag'..." risk="low" time="0" type="public">(?i)^sure are a ?lot of .*fags? in here</event>
<hilights>
<debug>AfterDeath</debug>
+ <debug>ST47</debug>
<low>alindeman</low>
<low>seanw</low>
</hilights>
diff --git a/config-default/commands.xml b/config-default/commands.xml
index eedf584..3ab49e9 100644
--- a/config-default/commands.xml
+++ b/config-default/commands.xml
@@ -4,6 +4,11 @@
$conn->privmsg($event->{to}->[0], "help is at http://meta.wikimedia.org/wiki/User:WHeimbigner/AntiSpamMeta");
]]>
</command>
+ <command cmd="^;db$">
+ <![CDATA[
+ $conn->privmsg($event->{to}->[0], "db is at http://antispammeta.net/query.html");
+ ]]>
+ </command>
<command cmd="^;query (\S+) (\S+)$">
<![CDATA[
my $channel = $1;
@@ -22,15 +27,22 @@
$conn->privmsg($event->{to}->[0], "Hiya $nick");
]]>
</command>
- <command cmd="^;user flags set (\S+) ?(\S*)$" flag="d">
+ <command cmd="^;user flags (\S+)(?: (\S+))?$" flag="d">
<![CDATA[
my $nick = lc $1;
my $flags = $2;
- if ($flags eq '') { delete($::users->{person}->{$nick}->{flags}); } else {
+ if ($flags eq '') {
+ if (defined($::users->{person}->{$nick}->{flags})) {
+ $conn->privmsg($event->{to}->[0], "Flags for $nick: $::users->{person}->{$nick}->{flags}");
+ } else {
+ $conn->privmsg($event->{to}->[0], "$nick has no flags");
+ }
+# delete($::users->{person}->{$nick}->{flags});
+ } else {
$::users->{person}->{$nick}->{flags} = $flags;
+ ASM::XML->writeUsers();
+ $conn->privmsg($event->{to}->[0], "Flags for $nick set to $flags");
}
- ASM::XML->writeUsers();
- $conn->privmsg($event->{to}->[0], "Flags for $nick set to $flags");
]]>
</command>
<command cmd="^;user del (\S+)$" flag="d">
@@ -41,7 +53,7 @@
$conn->privmsg($event->{to}->[0], "Byebye $nick");
]]>
</command>
- <command cmd="^;user flags show (\S+)$" flag="d">
+<!-- <command cmd="^;user flags show (\S+)$" flag="a">
<![CDATA[
my $nick = lc $1;
if (defined($::users->{person}->{$nick}->{flags})) {
@@ -50,7 +62,7 @@
$conn->privmsg($event->{to}->[0], "$nick has no flags");
}
]]>
- </command>
+ </command> -->
<command cmd="^;autoban (\S+)$" flag="a">
<![CDATA[
my $chan = $1;
@@ -65,6 +77,11 @@
my $chan = $1;
my $nick = $2;
my $level= $3;
+ my $link = ASM::Util->getLink(lc $chan);
+ if ( lc $link ne lc $chan ) {
+ $conn->privmsg($event->{to}->[0], "Error: $chan is linked to $link - use $link instead.");
+ return;
+ }
if ($level eq '') { $level = 'low'; }
unless (defined($::channels->{channel}->{$chan}->{msgs})) {
$::channels->{channel}->{$chan}->{msgs} = {};
@@ -83,6 +100,11 @@
<![CDATA[
my $chan = $1;
my $nick = $2;
+ my $link = ASM::Util->getLink(lc $chan);
+ if ( lc $link ne lc $chan ) {
+ $conn->privmsg($event->{to}->[0], "Error: $chan is linked to $link - use $link instead.");
+ return;
+ }
foreach my $risk ( keys %::RISKS ) {
next unless defined($::channels->{channel}->{$chan}->{msgs}->{$risk});
my @ppl = @{$::channels->{channel}->{$chan}->{msgs}->{$risk}};
@@ -90,7 +112,25 @@
$::channels->{channel}->{$chan}->{msgs}->{$risk} = \@ppl;
}
ASM::XML->writeChannels();
- $conn->privmsg($event->{to}->[0], "no moar msgs for $nick");
+ $conn->privmsg($event->{to}->[0], "$nick removed from targets for $chan");
+ ]]>
+ </command>
+ <command cmd="^;showhilights (\S+)$" flag="a">
+ <![CDATA[
+ my $nick = lc $1;
+ my @channels = ();
+ foreach my $chan (keys(%{$::channels->{channel}})) {
+ foreach my $level (keys(%{$::channels->{channel}->{$chan}->{hilights}})) {
+ if (grep(/^${nick}$/i, @{$::channels->{channel}->{$chan}->{hilights}->{$level}})) {
+ push @channels, $chan . " ($level)";
+ }
+ }
+ }
+ if (! @channels) {
+ $conn->privmsg($event->{to}->[0], "$nick isn't on any hilights");
+ } else {
+ $conn->privmsg($event->{to}->[0], "$nick is hilighted for " . join(', ', @channels));
+ }
]]>
</command>
<command cmd="^;hilight (\S+) (\S+) ?(\S*)$" flag="a">
@@ -99,6 +139,11 @@
my $nick = $2;
my $level= $3;
if ($level eq '') { $level = 'low'; }
+ my $link = ASM::Util->getLink(lc $chan);
+ if ( lc $link ne lc $chan ) {
+ $conn->privmsg($event->{to}->[0], "Error: $chan is linked to $link - use $link instead.");
+ return;
+ }
unless (defined($::channels->{channel}->{$chan}->{hilights})) {
$::channels->{channel}->{$chan}->{hilights} = {};
}
@@ -116,6 +161,11 @@
<![CDATA[
my $chan = $1;
my $nick = $2;
+ my $link = ASM::Util->getLink(lc $chan);
+ if ( lc $link ne lc $chan ) {
+ $conn->privmsg($event->{to}->[0], "Error: $chan is linked to $link - use $link instead.");
+ return;
+ }
foreach my $risk ( keys %::RISKS ) {
next unless defined($::channels->{channel}->{$chan}->{hilights}->{$risk});
my @ppl = @{$::channels->{channel}->{$chan}->{hilights}->{$risk}};
@@ -123,7 +173,7 @@
$::channels->{channel}->{$chan}->{hilights}->{$risk} = \@ppl;
}
ASM::XML->writeChannels();
- $conn->privmsg($event->{to}->[0], "kthxbai $nick");
+ $conn->privmsg($event->{to}->[0], "Removing hilights for $nick in $chan");
]]>
</command>
<command cmd="^;join (\S+)" flag="a">
@@ -189,10 +239,13 @@
$conn->privmsg($event->{to}->[0], $x . " exempted");
]]>
</command>
- <command cmd="^\!ops *(.*)">
+ <command cmd="^\!ops (#\S+)? ?(.*)">
<![CDATA[
- my $hilite=ASM::Util->commaAndify(ASM::Util->getAlert($event->{to}->[0], 'opalert', 'hilights'));
- $conn->privmsg($_, "[$event->{to}->[0]] - $event->{nick} wants op attention ($1) $hilite") foreach ASM::Util->getAlert($event->{to}->[0], 'opalert', 'msgs');
+ my $tgt = $event->{to}->[0];
+ $tgt = $1 if (defined($1));
+ my $msg = $2;
+ my $hilite=ASM::Util->commaAndify(ASM::Util->getAlert($tgt, 'opalert', 'hilights'));
+ $conn->privmsg($_, "[$tgt] - $event->{nick} wants op attention ($msg) $hilite") foreach ASM::Util->getAlert($tgt, 'opalert', 'msgs');
]]>
</command>
<command cmd="^;re(load|hash) exempts" flag="a">
diff --git a/config-default/users.xml b/config-default/users.xml
index 0c59b57..88fbd66 100644
--- a/config-default/users.xml
+++ b/config-default/users.xml
@@ -1,12 +1,21 @@
<people>
<person id="afterdeath" flags="odat" host="IDENTIFY" />
+ <person id="alindeman" flags="odat" host="freenode/staff/alindeman" />
+ <person id="andrewb" flags="a" host="freenode/helper/ubuntu.member.AndrewB" />
+ <person id="animum" />
<person id="cchan" flags="odat" host="IDENTIFY" />
+ <person id="dave2" flags="odat" host="freenode/staff/dave2" />
+ <person id="denny" flags="+a" host="freenode/staff/denny" />
<person id="dmcdevit" flags="oat" host="IDENTIFY" />
<person id="filiated" flags="odat" host="IDENTIFY" />
+ <person id="karlprof" flags="a" host="freenode/helper/pdpc.student.karlprof" />
<person id="mark_ryan" flags="ot" host="wikimedia/mark" />
+ <person id="ompaul" flags="a" host="freenode/staff/gnewsense.ompaul" />
+ <person id="philkc" flags="odat" host="freenode/staff/philkc" />
<person id="sean_william" flags="a" host="IDENTIFY" />
<person id="seanw" flags="odat" host="freenode/staff/wikimedia.sean-whitton" />
<person id="slowking_man" flags="ot" host="IDENTIFY" />
- <person id="st47" flags="oat" host="IDENTIFY" />
+ <person id="st47" flags="odat" host="IDENTIFY" />
+ <person id="tomaw" flags="odat" host="freenode/staff/tomaw" />
<person id="wildpikachu" flags="odat" host="about/linux/staff/wildpikachu" />
</people>
diff --git a/meta.pl b/meta.pl
index 31059f8..faadd93 100755
--- a/meta.pl
+++ b/meta.pl
@@ -19,7 +19,7 @@ $::pass = '';
@::string_blacklist=();
BEGIN {
-my @modules = qw/Xml Util Inspect Event Services Log Command Classes Actions Mysql OperQueue/;
+my @modules = qw/Util Xml Inspect Event Services Log Command Classes Actions Mysql OperQueue/;
require 'modules/' . lc $_ . '.pl' foreach @modules;
}
diff --git a/modules/classes.pl b/modules/classes.pl
index 4233d88..36a8031 100644
--- a/modules/classes.pl
+++ b/modules/classes.pl
@@ -3,6 +3,7 @@ package ASM::Classes;
use strict;
use warnings;
use Text::LevenshteinXS qw(distance);
+use Data::Dumper;
my %sf = ();
@@ -93,9 +94,10 @@ sub nickspam {
my ($chk, $id, $event, $chan) = @_;
my @cut = split(/:/, $chk->{content});
if ( length $event->{args}->[0] >= int($cut[0]) ) {
- %_ = map { $_=>$_ } lc keys %{$::sc{lc $chan}{users}};
- my @uniq = grep( $_{$_}, split( / / , lc $event->{args}->[0]) );
- return 1 if ( $#{ @uniq } >= int($cut[1]) );
+ my %users = %{$::sc{lc $chan}->{users}};
+ my %x = map { $_=>$_ } keys %users;
+ my @uniq = grep( $x{$_}, split( /[ ,]+/ , lc $event->{args}->[0]) );
+ return 1 if ( @uniq >= int($cut[1]) );
}
return 0;
}
diff --git a/modules/event.pl b/modules/event.pl
index e7b3a66..c77fda1 100644
--- a/modules/event.pl
+++ b/modules/event.pl
@@ -67,8 +67,6 @@ sub on_connect {
$conn->privmsg( 'NickServ', "ghost $::settings->{nick} $::settings->{pass}" ) if lc $event->{args}->[0] ne lc $::settings->{nick};
}
-#my @leven = ();
-
sub on_join {
my ($conn, $event) = @_;
my %evcopyx = %{$event};
@@ -80,6 +78,11 @@ sub on_join {
mkdir($::settings->{log}->{dir} . $chan);
$conn->sl("who $chan");
$conn->privmsg('ChanServ', "op $chan" ) if (defined cs($chan)->{op}) && (cs($chan)->{op} eq 'yes');
+ #TODO: make it settable via config. Hardcoded channames ftl.
+ if ($chan eq '##linux') {
+ $conn->schedule(300, \&do_chancount, $chan, 300);
+ #TODO: mark this as a channel we're watching so we don't schedule this multiple times
+ }
}
$::sc{$chan}{users}{$nick} = {};
$::sc{$chan}{users}{$nick}{hostmask} = $event->{userhost};
@@ -104,21 +107,6 @@ sub on_join {
}
}
$::log->logg( $event );
-# if ( $#leven ne -1 ) {
-# my $ld = ( ( maxlen($nick, $leven[0]) - distance($nick, $leven[0]) ) / maxlen($nick, $leven[0]) );
-# my $mx = $leven[0];
-# foreach my $item ( @leven ) {
-# next if $nick eq $item; # avoid dups
-# my $tld = ( ( maxlen($nick, $item) - distance($nick, $item) ) / maxlen($nick, $item) );
-# if ($tld > $ld) {
-# $ld = $tld;
-# $mx = $item;
-# }
-# }
-# print "Best match for $nick was $mx with $ld\n"
-# }
-# push(@leven, $nick);
-# shift @leven if $#leven > 5;
}
sub on_part
@@ -139,6 +127,7 @@ sub on_part
if ( lc $conn->{_nick} eq lc $nick )
{
delete( $::sc{lc $event->{to}->[0]} );
+ on_byechan(lc $event->{to}->[0]);
}
else
{
@@ -278,6 +267,7 @@ sub on_kick {
if ( lc $conn->{_nick} eq lc $nick )
{
delete( $::sc{lc $event->{args}->[0]} );
+ on_byechan(lc $event->{to}->[0]);
}
else
{
@@ -431,4 +421,17 @@ sub on_bannedfromchan {
$conn->privmsg('ChanServ', "unban $event->{args}->[1]");
}
+sub on_byechan {
+ my ($chan) = @_;
+ #TODO do del event stuff
+}
+
+sub do_chancount {
+ my ($conn, $chan, $repeat) = @_;
+ my @users = keys(%{$::sc{$chan}{users}});
+ my $count = @users;
+ system('/home/icxcnika/AntiSpamMeta/chancount.pl ' . $chan . sprintf(' %d', $count));
+ $conn->schedule($repeat, \&do_chancount, $chan, $repeat);
+}
+
return 1;
diff --git a/modules/inspect.pl b/modules/inspect.pl
index a995202..faa4dd7 100644
--- a/modules/inspect.pl
+++ b/modules/inspect.pl
@@ -64,13 +64,13 @@ sub inspect {
$conn->schedule(int($dct{$id}{time}), sub { $::oq->o_send($lconn,$lunmode); });
}
}
- unless (defined($::ignored{$event->{host}}) && ($::ignored{$event->{host}} >= $::RISKS{$dct{$id}{risk}})) {
+ unless (defined($::ignored{$chan}) && ($::ignored{$chan} >= $::RISKS{$dct{$id}{risk}})) {
my @tgts = ASM::Util->getAlert($chan, $dct{$id}{risk}, 'msgs');
foreach my $tgt (@tgts) {
$conn->privmsg($tgt, $txtz);
}
- $::ignored{$event->{host}} = $::RISKS{$dct{$id}{risk}};
- $conn->schedule(60, sub { delete($::ignored{$event->{host}})});
+ $::ignored{$chan} = $::RISKS{$dct{$id}{risk}};
+ $conn->schedule(45, sub { delete($::ignored{$chan})});
}
}
}
diff --git a/modules/log.pl b/modules/log.pl
index e8a178a..6f25c48 100644
--- a/modules/log.pl
+++ b/modules/log.pl
@@ -27,6 +27,9 @@ sub logg
foreach my $chan ( @chans )
{
$chan = lc $chan;
+ if (substr($chan, 0, 1) eq '@') {
+ $chan = substr($chan, 1);
+ }
my $path = ">>$cfg->{dir}${chan}/${chan}" . strftime($cfg->{filefmt}, @time);
$_ = '';
$_ = "<$event->{nick}> $event->{args}->[0]" if $event->{type} eq 'public';
diff --git a/modules/util.pl b/modules/util.pl
index a385790..4fe63ee 100644
--- a/modules/util.pl
+++ b/modules/util.pl
@@ -1,4 +1,5 @@
package ASM::Util;
+use Array::Utils qw(:all);
use warnings;
use strict;
@@ -7,6 +8,7 @@ my %oq;
%::RISKS =
(
+ 'disable'=> -1, #this isn't really an alert
'debug' => 10,
'info' => 20,
'low' => 30,
@@ -66,8 +68,22 @@ sub maxlen {
sub cs {
my ($module, $chan) = @_;
$chan = lc $chan;
- return $::channels->{channel}->{$chan} if ( defined($::channels->{channel}->{$chan}) );
- return $::channels->{channel}->{default};
+ return $::channels->{channel}->{default} unless defined($::channels->{channel}->{$chan});
+ if ( defined($::channels->{channel}->{$chan}->{link}) ) {
+ return $::channels->{channel}->{ $::channels->{channel}->{$chan}->{link} };
+ }
+ return $::channels->{channel}->{$chan};
+}
+
+sub getLink
+{
+ my ($module, $chan) = @_;
+ $chan = lc $chan;
+ my $link = $::channels->{channel}->{$chan}->{link};
+ if ( defined($link) ) {
+ return $link;
+ }
+ return $chan;
}
#this item is a stub, dur
@@ -126,15 +142,20 @@ sub flood_process {
sub getAlert {
my ($module, $c, $risk, $t) = @_;
- @_ = ();
+ my @disable = ();
+ my @x = ();
$c = lc $c;
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($module, $c)->{$t}->{$prisk}} ) if defined cs($module, $c)->{$t}->{$prisk};
+ push( @x, @{$::channels->{channel}->{master}->{$t}->{$prisk}} ) if defined $::channels->{channel}->{master}->{$t}->{$prisk};
+ push( @x, @{cs($module, $c)->{$t}->{$prisk}} ) if defined cs($module, $c)->{$t}->{$prisk};
}
}
- return @_;
+ push( @disable, @{$::channels->{channel}->{master}->{$t}->{disable}} ) if defined $::channels->{channel}->{master}->{$t}->{disable};
+ push( @disable, @{cs($module, $c)->{$t}->{disable}} ) if defined cs($module, $c)->{$t}->{disable};
+ @x = unique(@x);
+ @x = array_diff(@x, @disable);
+ return @x;
}
sub commaAndify {
diff --git a/modules/xml.pl b/modules/xml.pl
index c3da924..1978af9 100644
--- a/modules/xml.pl
+++ b/modules/xml.pl
@@ -11,8 +11,9 @@ sub readXML {
my ( $p ) = $::cset; #@_;
$p = 'default' if $p eq '';
$p = "config-$p";
+ my @fchan = ( 'event', keys %::RISKS );
$::settings = $::xs1->XMLin( "$p/settings.xml", ForceArray => ['host'], 'GroupTags' => { altnicks => 'altnick', server => 'host', autojoins => 'autojoin' });
- $::channels = $::xs1->XMLin( "$p/channels.xml", ForceArray => [qw/event debug info low medium high/]);
+ $::channels = $::xs1->XMLin( "$p/channels.xml", ForceArray => \@fchan );
$::users = $::xs1->XMLin( "$p/users.xml", ForceArray => 'person');
$::commands = $::xs1->XMLin( "$p/commands.xml", ForceArray => [qw/command/]);
$::mysql = $::xs1->XMLin( "$p/mysql.xml", ForceArray => []);