ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/schmorplog.ext
(Generate patch)

Comparing deliantra/server/ext/schmorplog.ext (file contents):
Revision 1.9 by root, Sat May 19 11:04:16 2007 UTC vs.
Revision 1.12 by root, Mon Jan 7 01:55:19 2008 UTC

1#! perl 1#! perl # depends=irc
2 2
3our $UPDATE_LOGINS = Event->idle (repeat => 0, min => 1, data => cf::WF_AUTOCANCEL, cb => Coro::unblock_sub { 3use Fcntl;
4 my ($status, @pl) = ext::commands::who_listing; 4use Coro::AIO;
5 5
6 #TODO: write files asynchronously 6our $UPDATE_LOGINS = EV::idle sub {
7 open my $fh, ">", "$LOCALDIR/usercount"; 7 $_[0]->stop;
8 print $fh scalar @pl;
9 8
10 open my $fh, ">", "$LOCALDIR/userlisting.html"; 9 cf::async {
10 my ($status, @pl) = ext::commands::who_listing;
11
12 my $fh = aio_open "$LOCALDIR/usercount", O_WRONLY | O_CREAT | O_TRUNC, 0644
13 or return;
14 aio_write $fh, 0, undef, scalar @pl, 0;
15 aio_close $fh;
16
17 my $who;
11 for ($status, @pl) { 18 for ($status, @pl) {
12 s/[<&]//g; 19 s/[<&]//g;
13 print $fh "$_<br />\n"; 20 $who .= "$_<br />\n";
21 }
22
23 my $fh = aio_open "$LOCALDIR/userlisting.html", O_WRONLY | O_CREAT | O_TRUNC, 0644
24 or return;
25 aio_write $fh, 0, undef, $who, 0;
26 aio_close $fh;
14 } 27 };
15}); 28};
16 29
17cf::player->attach ( 30cf::player->attach (
18 on_login => sub { 31 on_login => sub {
19 my ($pl) = @_; 32 my ($pl) = @_;
20 $pl->ob->set_ob_key_value (schmorplog_last_login => time); 33 $pl->ob->set_ob_key_value (schmorplog_last_login => time);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines