… | |
… | |
6 | |
6 | |
7 | # requires: commands.ext |
7 | # requires: commands.ext |
8 | |
8 | |
9 | return unless exists $cf::CFG{irc_server}; |
9 | return unless exists $cf::CFG{irc_server}; |
10 | |
10 | |
11 | my $BOTSERVER = $cf::CFG{irc_server} || "localhost"; |
11 | our $BOTSERVER = $cf::CFG{irc_server}; |
12 | my $BOTPORT = $cf::CFG{irc_port} || 6667; |
12 | our $BOTPORT = $cf::CFG{irc_port}; |
13 | my $BOTNAME = $cf::CFG{irc_nick} || "server"; |
13 | our $BOTNAME = $cf::CFG{irc_nick}; |
14 | my $BOTCHAN = $cf::CFG{irc_chan} || "cf"; |
14 | our $BOTCHAN = $cf::CFG{irc_chan}; |
15 | |
15 | |
16 | my $CON; # the connection |
16 | our $CON; # the connection |
17 | |
17 | |
18 | sub unload { |
18 | sub unload { |
19 | $CON->disconnect if $CON; |
19 | $CON->disconnect if $CON; |
20 | undef $CON; |
20 | undef $CON; |
21 | } |
21 | } |
… | |
… | |
126 | undef $CON; |
126 | undef $CON; |
127 | } |
127 | } |
128 | ); |
128 | ); |
129 | } |
129 | } |
130 | |
130 | |
131 | our $RECONNECT = cf::periodic 30, Coro::unblock_sub { |
131 | our $RECONNECT = length $BOTSERVER && cf::periodic 30, Coro::unblock_sub { |
132 | check_connection; |
132 | check_connection; |
133 | }; |
133 | }; |
134 | |
134 | |