summaryrefslogtreecommitdiffstats
path: root/meta.pl
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-06-29 02:21:38 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-06-29 02:21:38 +0000
commitf52c9bd6e6e018ff0c45f1dea4ded2aeb4ae1427 (patch)
tree395c0133072d89da4a936e0a180e836997c1cb56 /meta.pl
parent6907da0a5da3d45a91c3ac4893e5b890200b27eb (diff)
lots of modularization done, needs testing and is unstable
Diffstat (limited to 'meta.pl')
-rwxr-xr-xmeta.pl66
1 files changed, 8 insertions, 58 deletions
diff --git a/meta.pl b/meta.pl
index 79f0f90..64236f3 100755
--- a/meta.pl
+++ b/meta.pl
@@ -1,7 +1,6 @@
#!/usr/bin/perl -w
use lib '/home/icxcnika/AntiSpamMeta';
-#use lib '/home/wheimbigner/perl/lib/perl5/site_perl/5.8.8';
use warnings;
use strict;
use Net::IRC;
@@ -12,25 +11,10 @@ use Getopt::Long;
@::eline=();
$::pass = '';
-my @modules = qw/Xml Util Inspect Services Log Command Event Classes Actions Mysql/;
+my @modules = qw/Xml Util Inspect Services Log Command Event Classes Actions Mysql OperQueue/;
require 'modules/' . lc $_ . '.pl' foreach @modules;
-sub rePlug
-{
- my ($conn) = @_;
- foreach (@modules) {
- eval $_ . '::killsub();';
- warn $@ if $@;
- eval 'undef &' . $_ . '::killsub;';
- warn $@ if $@;
- delete $INC{'modules/' . lc $_ . '.pl'};
- require 'modules/' . lc $_ . '.pl';
- }
- registerHandlers($conn); # this is necessary in case event.pl has changed
- # because handlers are registered via pointers
-}
-
sub init {
my ( $conn, $host );
my $debug = 0;
@@ -40,17 +24,13 @@ sub init {
'pass|p:s' => \$::pass,
'config|c:s' => \$::cset
);
- readXML();
+ ASM::XML->readXML();
$::log = ASM::Log->new($::settings->{log});
$::pass = $::settings->{pass} if $::pass eq '';
$host = ${$::settings->{server}}[rand @{$::settings->{server}}];
print "Connecting to $host\n";
$irc->debug($debug);
$::db = ASM::DB->new($::mysql->{db}, $::mysql->{host}, $::mysql->{port}, $::mysql->{user}, $::mysql->{pass}, $::mysql->{table});
-# $::dbh = DBI->connect("DBI:mysql:database=$::mysql->{db};host=$::mysql->{host};port=$::mysql->{port}",
-# $::mysql->{user}, $::mysql->{pass});
-#
-# sql_connect();
$conn = $irc->newconn( Server => $host,
Port => $::settings->{port} || '6667',
Nick => $::settings->{nick},
@@ -59,45 +39,15 @@ sub init {
Password => $::settings->{pass},
Pacing => 1 );
$conn->debug($debug);
- registerHandlers($conn);
+ $::inspector = ASM::Inspect->new();
+ $::services = ASM::Services->new();
+ $::oq = ASM::OperQueue->new();
+ $::commander = ASM::Commander->new();
+ $::event = ASM::Event->new($conn, $::inspector);
+ $::classes = ASM::Classes->new();
@::eline=io('exempt.txt')->getlines;
chomp @::eline;
$irc->start();
}
-sub registerHandlers {
- my ($conn) = @_;
- print "Installing handler routines...\n";
- $conn->add_default_handler(\&blah);
- $conn->add_handler('bannedfromchan', \&on_bannedfromchan);
- $conn->add_handler('mode', \&on_mode);
- $conn->add_handler('join', \&on_join);
- $conn->add_handler('part', \&on_part);
- $conn->add_handler('quit', \&on_quit);
- $conn->add_handler('nick', \&on_nick);
- $conn->add_handler('notice', \&on_notice);
- $conn->add_handler('caction', \&on_public);
- $conn->add_handler('msg', \&on_msg);
- $conn->add_handler('namreply', \&on_names);
- $conn->add_handler('endofnames', \&on_names);
- $conn->add_handler('public', \&on_public);
- $conn->add_handler('376', \&on_connect);
- $conn->add_handler('topic', \&irc_topic);
- $conn->add_handler('topicinfo', \&irc_topic);
- $conn->add_handler('nicknameinuse', \&on_errnickinuse);
- $conn->add_handler('kick', \&on_kick);
- $conn->add_handler('cping', \&on_ctcp);
- $conn->add_handler('cversion', \&on_ctcp);
- $conn->add_handler('csource', \&on_ctcp);
- $conn->add_handler('ctime', \&on_ctcp);
- $conn->add_handler('cdcc', \&on_ctcp);
- $conn->add_handler('cuserinfo', \&on_ctcp);
- $conn->add_handler('cclientinfo', \&on_ctcp);
- $conn->add_handler('cfinger', \&on_ctcp);
- $conn->add_handler('320', \&whois_identified);
- $conn->add_handler('318', \&whois_end);
- $conn->add_handler('311', \&whois_user);
- $conn->add_handler('352', \&on_whoreply);
-}
-
init();