1 | #! perl |
1 | #! perl # depends=irc |
2 | |
2 | |
3 | our $UPDATE_LOGINS = Event->idle (repeat => 0, min => 1, data => cf::WF_AUTOCANCEL, cb => Coro::unblock_sub { |
3 | our $UPDATE_LOGINS = EV::idle Coro::unblock_sub { |
|
|
4 | $_[0]->stop; |
|
|
5 | |
4 | my ($status, @pl) = ext::commands::who_listing; |
6 | my ($status, @pl) = ext::commands::who_listing; |
5 | |
7 | |
6 | #TODO: write files asynchronously |
8 | #TODO: write files asynchronously |
7 | open my $fh, ">", "$LOCALDIR/usercount"; |
9 | open my $fh, ">", "$LOCALDIR/usercount"; |
8 | print $fh scalar @pl; |
10 | print $fh scalar @pl; |
… | |
… | |
10 | open my $fh, ">", "$LOCALDIR/userlisting.html"; |
12 | open my $fh, ">", "$LOCALDIR/userlisting.html"; |
11 | for ($status, @pl) { |
13 | for ($status, @pl) { |
12 | s/[<&]//g; |
14 | s/[<&]//g; |
13 | print $fh "$_<br />\n"; |
15 | print $fh "$_<br />\n"; |
14 | } |
16 | } |
15 | }); |
17 | }; |
16 | |
18 | |
17 | cf::player->attach ( |
19 | cf::player->attach ( |
18 | on_login => sub { |
20 | on_login => sub { |
19 | my ($pl) = @_; |
21 | my ($pl) = @_; |
20 | $pl->ob->set_ob_key_value (schmorplog_last_login => time); |
22 | $pl->ob->set_ob_key_value (schmorplog_last_login => time); |