- Timestamp:
- 11/11/11 17:40:04 (12 years ago)
- Location:
- bot/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
bot/trunk/MANIFEST
r378 r397 8 8 lib/Sophie/Bot/Term.pm 9 9 lib/Sophie/Bot.pm 10 sophie-tools.spec.in 10 11 t/Sophie-Bot.t -
bot/trunk/lib/Sophie/Bot/IRC.pm
r302 r397 8 8 9 9 our $VERSION = '0.01'; 10 11 sub PING_INTERVAL { 60 } 12 sub NO_PONG_TOUT { 5 } 10 13 11 14 sub setup_server { … … 25 28 Server => $server, 26 29 Ircname => 'Rpm2sql', 27 Debug => 0,30 Debug => 1, 28 31 ); 29 32 … … 37 40 }, 38 41 package_states => [ 39 ref($self) => [ qw(_start irc_001 irc_public irc_msg) ], 42 ref($self) => [ qw(_start irc_001 irc_public irc_msg ping_server 43 irc_pong) ], 40 44 ], 41 45 ); … … 44 48 sub _start { 45 49 my $heap = $_[HEAP]; 46 my $irc = $heap->{irc}; 50 my $kernel = $_[KERNEL]; 51 my $irc = $heap->{irc}; 52 47 53 $irc->yield('register', 'all', '001'); 48 54 $irc->yield('connect', { }); 55 56 $kernel->delay( 'ping_server' => PING_INTERVAL ); 57 } 58 59 sub ping_server { 60 my $heap = $_[HEAP]; 61 my $kernel = $_[KERNEL]; 62 $heap->{nopong} ||= 0; 63 if ($heap->{nopong} >= NO_PONG_TOUT) { 64 $heap->{irc}->yield( 'connect', { } ); 65 return; 66 } 67 $heap->{nopong}++; 68 $heap->{irc}->yield( 'ping' => scalar(time()) ); 69 $kernel->delay( 'ping_server' => PING_INTERVAL ); 70 } 71 72 sub irc_pong { 73 my $heap = $_[HEAP]; 74 my $kernel = $_[KERNEL]; 75 $heap->{nopong} = 0; 76 } 77 78 sub irc_433 { 79 my $heap = $_[HEAP]; 80 my $irc = $heap->{irc}; 81 my $self = $heap->{sophie}; 82 83 die "Nick already in use\n"; 49 84 } 50 85
Note: See TracChangeset
for help on using the changeset viewer.