Changeset 1045

Show
Ignore:
Timestamp:
07/03/06 11:24:27
Author:
jbisbee
Message:

* change ->new('bot') to ->spawn( alias => 'bot' )
* add new event 'connect'
* move connect from bot_start to new bot_connect so that the

delay( connect => 60 ) will actually work ( delay only works

on the same session and can't post back to the PoCo?
IRC session
(aliases 'bot' session)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/bin/plagger-ircbot

    r1021 r1045  
    3737 
    3838msg 'creating irc component'; 
    39 POE::Component::IRC->new('bot'
     39POE::Component::IRC->spawn( alias => 'bot'
    4040    or die "Couldn't create IRC POE session: $!"; 
    4141 
     
    4545        _start           => \&bot_start, 
    4646        _stop            => \&bot_stop, 
     47        connect          => \&bot_connect, 
    4748        irc_001          => \&bot_connected, 
    4849        irc_372          => \&bot_motd, 
     
    9293    $kernel->call( IKC => publish => notify_irc => ['update'] ); 
    9394    $kernel->post( bot => register => 'all' ); 
    94     $kernel->post( 
     95    $kernel->yield('connect'); 
     96
     97 
     98sub bot_connect 
     99
     100    my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; 
     101    msg "attempting to connect to server"; 
     102    $kernel->post(  
    95103        bot => connect => { 
    96104            Nick     => $config->{nickname},