summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2016-01-14 15:00:46 -0700
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2016-01-14 15:00:46 -0700
commit5d92725043195ba4ad9831b3489d65738b794d29 (patch)
tree64ba59b6c676f21f3ea9aa3572badda00626e811
parent8ff9ba40fcbfc00260466509c4cbb95d43f8b682 (diff)
Register services-processing handler inside the services module, rather than having it be called by the Event module
-rw-r--r--lib/ASM/Event.pm1
-rw-r--r--lib/ASM/Services.pm6
-rwxr-xr-xmeta.pl2
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/ASM/Event.pm b/lib/ASM/Event.pm
index 3d7beb6..ca48f7e 100644
--- a/lib/ASM/Event.pm
+++ b/lib/ASM/Event.pm
@@ -365,7 +365,6 @@ sub on_notice
$::log->logg( $event );
$::db->logg( $event ) if defined $::db;
$::inspector->inspect( $conn, $event );
- $::services->doServices($conn, $event);
}
sub on_errnickinuse
diff --git a/lib/ASM/Services.pm b/lib/ASM/Services.pm
index 7e1df9d..b44b194 100644
--- a/lib/ASM/Services.pm
+++ b/lib/ASM/Services.pm
@@ -9,13 +9,17 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
sub new
{
+ my $module = shift;
+ my ($conn) = @_;
my $self = {};
+ $self->{CONN} = $conn;
bless($self);
+ $conn->add_handler('notice', \&doServices, "after");
return $self;
}
sub doServices {
- my ($self, $conn, $event) = @_;
+ my ($conn, $event) = @_;
my $i = 1;
if ($event->{from} eq 'NickServ!NickServ@services.')
{
diff --git a/meta.pl b/meta.pl
index 4591417..dd42b83 100755
--- a/meta.pl
+++ b/meta.pl
@@ -132,9 +132,9 @@ sub init {
$conn->debugsock(1);
}
$::inspector = ASM::Inspect->new();
- $::services = ASM::Services->new();
$::event = ASM::Event->new($conn, $::inspector);
$::commander = ASM::Commander->new($conn);
+ $::services = ASM::Services->new($conn);
$::classes = ASM::Classes->new();
$::fifo = ASM::Fifo->new($irc, $conn);
my @nickbl = io('nick_blacklist.txt')->getlines;