]> ruin.nu Git - NDIRC.git/blobdiff - ndawn.pl
Split long lines, using the algorithm from irssi splitlong.pl
[NDIRC.git] / ndawn.pl
index e89dc3a38cb982966c07beb93212779e23bea834..a14ee36fe319bef16eaaeb34b7eda5d8c3e5acf3 100755 (executable)
--- a/ndawn.pl
+++ b/ndawn.pl
@@ -24,10 +24,10 @@ use warnings;
 use feature ':5.10';
 use POE qw(Component::IRC::Qnet::State);
 
-
-use NDIRC::CommonStates;
 eval "require NDIRC::$ARGV[0]";
 
+die $@ if $@;
+
 # We create a new PoCo-IRC object
 my $irc = POE::Component::IRC::Qnet::State->spawn(
        nick => $ARGV[0],
@@ -36,15 +36,13 @@ my $irc = POE::Component::IRC::Qnet::State->spawn(
 
 $irc->service_bots(QBOT => 'P@cservice.netgamers.org');
 
-$ND::scanchan = '#testarmer';
-$ND::defchan = '#testarlite';
-$ND::memchan = '#testarmer';
+my $bot = eval "new NDIRC::$ARGV[0]";
 
 POE::Session->create(
-       package_states => [
-               'NDIRC::CommonStates' => [ qw(_default _start irc_001 sig_DIE sig_usr1 sig_usr2
-                       signal_handler irc_disconnected irc_invite auth) ],
-               "NDIRC::$ARGV[0]" => [ qw(irc_public irc_msg refresh irc_join) ],
+       object_states => [
+               $bot => [ qw(_default _start irc_001 sig_DIE sig_usr1 sig_usr2
+                       signal_handler irc_disconnected irc_invite auth
+                       irc_public irc_msg refresh irc_join) ],
        ],
        heap => { irc => $irc },
 );