ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/schmorp-irc.ext
(Generate patch)

Comparing deliantra/maps/perl/schmorp-irc.ext (file contents):
Revision 1.17 by root, Sun Oct 1 18:18:34 2006 UTC vs.
Revision 1.20 by root, Fri Dec 15 19:06:29 2006 UTC

3use Time::HiRes; 3use Time::HiRes;
4use Net::IRC3::Client::Connection; 4use Net::IRC3::Client::Connection;
5 5
6# requires: commands.ext 6# requires: commands.ext
7 7
8return unless $cf::CFG{irc_server}; 8return unless exists $cf::CFG{irc_server};
9 9
10my $BOTSERVER = $cf::CFG{irc_server}; 10my $BOTSERVER = $cf::CFG{irc_server};
11my $BOTPORT = $cf::CFG{irc_port}; 11my $BOTPORT = $cf::CFG{irc_port};
12my $BOTNAME = $cf::CFG{irc_nick}; 12my $BOTNAME = $cf::CFG{irc_nick};
13my $BOTCHAN = $cf::CFG{irc_chan}; 13my $BOTCHAN = $cf::CFG{irc_chan};
21 21
22sub do_notice { 22sub do_notice {
23 my ($msg) = @_; 23 my ($msg) = @_;
24 $CON->send_chan ($BOTCHAN, NOTICE => $msg, $BOTCHAN) 24 $CON->send_chan ($BOTCHAN, NOTICE => $msg, $BOTCHAN)
25 if $CON; 25 if $CON;
26}
27
28sub users {
29 $CON
30 ? grep $_ ne $CON->nick, keys %{ $CON->channel_list->{$BOTCHAN} || {} }
31 : ()
26} 32}
27 33
28sub handle_fcmd { 34sub handle_fcmd {
29 my ($name, $me, $msg) = @_; 35 my ($name, $me, $msg) = @_;
30 36
91 0; 97 0;
92 } 98 }
93 ); 99 );
94} 100}
95 101
96my $timer; 102Event->timer (after => 1, interval => 30, data => cf::WF_AUTOCANCEL, cb => \&check_connection);
97 103
98sub new_timer {
99 $timer = AnyEvent->timer (after => 10, cb => sub {
100 check_connection ();
101 &new_timer; # and restart the time
102 });
103}
104
105new_timer; # create first timer
106check_connection ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines