diff options
| author | 2016-01-14 14:50:40 -0700 | |
|---|---|---|
| committer | 2016-01-14 14:50:40 -0700 | |
| commit | 8ff9ba40fcbfc00260466509c4cbb95d43f8b682 (patch) | |
| tree | b2d3a4d0e71b27931625194054365561a0613c80 /lib | |
| parent | da7d90773b8acf3dde1731f81237bb451ab73e33 (diff) | |
Register command-processing handlers inside of the command module, rather than having the event handler module call the command handler module
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ASM/Commander.pm | 4 | ||||
| -rw-r--r-- | lib/ASM/Event.pm | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/ASM/Commander.pm b/lib/ASM/Commander.pm index 054c57c..f53781f 100644 --- a/lib/ASM/Commander.pm +++ b/lib/ASM/Commander.pm @@ -142,9 +142,13 @@ my $cmdtbl = { sub new { my $module = shift; + my ($conn) = @_; my $self = {}; $self->{cmdtbl} = $cmdtbl; + $self->{CONN} = $conn; bless($self); + $conn->add_handler('msg', sub { command($self, @_); }, "after"); + $conn->add_handler('public', sub { command($self, @_); }, "after"); return $self; } diff --git a/lib/ASM/Event.pm b/lib/ASM/Event.pm index 90ba542..3d7beb6 100644 --- a/lib/ASM/Event.pm +++ b/lib/ASM/Event.pm @@ -311,7 +311,6 @@ sub on_part sub on_msg { my ($conn, $event) = @_; - $::commander->command($conn, $event); ASM::Util->dprint($event->{from} . " - " . $event->{args}->[0], 'msg'); if ((ASM::Util->notRestricted($event->{nick}, "nomsgs")) && ($event->{args}->[0] !~ /^;;/)) { # disabled by DL 130513 due to spammer abuse @@ -337,7 +336,6 @@ sub on_public else { $conn->schedule( 1, sub { checkHTTP($conn); } ); } } $::inspector->inspect( $conn, $event ); - $::commander->command( $conn, $event ); $::sc{$chan}{users}{lc $event->{nick}}{msgtime} = time; } |
