+sub auth {
+ my $heap = $_[HEAP];
+
+ if (my $f = new IO::File 'auth'){
+ my $user = <$f>;
+ chomp $user;
+ my $pass = <$f>;
+ chomp $pass;
+ $heap->{irc}->yield(qbot_auth => $user => $pass);
+ }
+}
+
+sub sig_usr1 {
+ my ($kernel,$heap) = @_[KERNEL,HEAP];
+
+ $kernel->yield( 'refresh' );
+}
+
+sub sig_usr2 {
+ my $heap = $_[HEAP];
+
+ my $disp = new NDIRC::Dispatcher;
+
+ if (my $commands = new IO::File 'commands'){
+ my @commands = split /\W+/, do{local $/; <$commands>};
+ say "Loading commands from: @commands";
+ $disp->load(@commands);
+ }
+
+ my $channels = new IO::File 'channels';
+ while (<$channels>){
+ my ($chan, @types) = split /\s+/;
+ say "$chan - @types";
+ $disp->add_channel($chan,\@types);
+ }
+
+ $heap->{disp} = $disp;
+}
+