X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=CommonStates.pm;h=7da1c512788281d2d9954689e4a9a59824576e10;hb=139b1bb64717ec8be8d97d2d9efc6caaf9e800ca;hp=655bbba8442c6b6eedb18fffde017c6e8ce1bdc9;hpb=e8c94cdebefdc428ea92fde6db63f18d3e8399b2;p=NDIRC.git diff --git a/CommonStates.pm b/CommonStates.pm index 655bbba..7da1c51 100644 --- a/CommonStates.pm +++ b/CommonStates.pm @@ -23,6 +23,7 @@ use warnings; use feature ':5.10'; use POE::Session; +use NDIRC::Dispatcher; # We registered for all events, this will produce some debug info. sub _default { @@ -63,6 +64,28 @@ sub _start { return; } +sub sig_usr2 { + my $heap = $_[HEAP]; + + open COMMANDS, 'commands'; + my @commands = split /\W+/, do { local $/; }; + close COMMANDS; + + my $disp = new NDIRC::Dispatcher; + $disp->load(@commands); + + open CHANNELS, 'channels'; + while (){ + print; + my ($chan, @types) = split /\s+/; + say "$chan - @types"; + $disp->add_channel($chan,\@types); + } + close CHANNELS; + + $heap->{disp} = $disp; +} + sub sig_DIE { my( $kernel,$sig, $ex ) = @_[ KERNEL,ARG0, ARG1 ]; say "DIED!!!!!!!!!!!!!!";