… | |
… | |
3 | use Time::HiRes; |
3 | use Time::HiRes; |
4 | use Net::IRC3::Client::Connection; |
4 | use Net::IRC3::Client::Connection; |
5 | |
5 | |
6 | # requires: commands.ext |
6 | # requires: commands.ext |
7 | |
7 | |
8 | return unless $cf::CFG{irc_server}; |
8 | return unless exists $cf::CFG{irc_server}; |
9 | |
9 | |
10 | my $BOTSERVER = $cf::CFG{irc_server}; |
10 | my $BOTSERVER = $cf::CFG{irc_server}; |
11 | my $BOTPORT = $cf::CFG{irc_port}; |
11 | my $BOTPORT = $cf::CFG{irc_port}; |
12 | my $BOTNAME = $cf::CFG{irc_nick}; |
12 | my $BOTNAME = $cf::CFG{irc_nick}; |
13 | my $BOTCHAN = $cf::CFG{irc_chan}; |
13 | my $BOTCHAN = $cf::CFG{irc_chan}; |
… | |
… | |
91 | 0; |
91 | 0; |
92 | } |
92 | } |
93 | ); |
93 | ); |
94 | } |
94 | } |
95 | |
95 | |
96 | my $timer; |
96 | Event->timer (after => 1, interval => 30, cb => \&check_connection); |
97 | |
97 | |
98 | sub new_timer { |
|
|
99 | $timer = AnyEvent->timer (after => 10, cb => sub { |
|
|
100 | check_connection (); |
|
|
101 | &new_timer; # and restart the time |
|
|
102 | }); |
|
|
103 | } |
|
|
104 | |
|
|
105 | new_timer; # create first timer |
|
|
106 | check_connection (); |
|
|