… | |
… | |
481 | sub fork_call(&@) { |
481 | sub fork_call(&@) { |
482 | my ($cb, @args) = @_; |
482 | my ($cb, @args) = @_; |
483 | |
483 | |
484 | # we seemingly have to make a local copy of the whole thing, |
484 | # we seemingly have to make a local copy of the whole thing, |
485 | # otherwise perl prematurely frees the stuff :/ |
485 | # otherwise perl prematurely frees the stuff :/ |
486 | # TODO: investigate and fix (liekly this will be rather laborious) |
486 | # TODO: investigate and fix (likely this will be rather laborious) |
487 | |
487 | |
488 | my @res = Coro::Util::fork_eval { |
488 | my @res = Coro::Util::fork_eval { |
489 | reset_signals; |
489 | reset_signals; |
490 | &$cb |
490 | &$cb |
491 | }, @args; |
491 | }, @args; |
… | |
… | |
1413 | or return []; |
1413 | or return []; |
1414 | |
1414 | |
1415 | my @logins; |
1415 | my @logins; |
1416 | |
1416 | |
1417 | for my $login (@$dirs) { |
1417 | for my $login (@$dirs) { |
|
|
1418 | my $path = path $login; |
|
|
1419 | |
|
|
1420 | # a .pst is a dead give-away for a valid player |
|
|
1421 | unless (-e "$path.pst") { |
1418 | my $fh = aio_open path $login, Fcntl::O_RDONLY, 0 or next; |
1422 | my $fh = aio_open $path, Fcntl::O_RDONLY, 0 or next; |
1419 | aio_read $fh, 0, 512, my $buf, 0 or next; |
1423 | aio_read $fh, 0, 512, my $buf, 0 or next; |
1420 | $buf !~ /^password -------------$/m or next; # official not-valid tag |
1424 | $buf !~ /^password -------------$/m or next; # official not-valid tag |
|
|
1425 | } |
1421 | |
1426 | |
1422 | utf8::decode $login; |
1427 | utf8::decode $login; |
1423 | push @logins, $login; |
1428 | push @logins, $login; |
1424 | } |
1429 | } |
1425 | |
1430 | |
… | |
… | |
1463 | sub expand_cfpod { |
1468 | sub expand_cfpod { |
1464 | ((my $self), (local $_)) = @_; |
1469 | ((my $self), (local $_)) = @_; |
1465 | |
1470 | |
1466 | # escape & and < |
1471 | # escape & and < |
1467 | s/&/&/g; |
1472 | s/&/&/g; |
1468 | s/(?<![BIUGH])</</g; |
1473 | s/(?<![BIUGHT])</</g; |
1469 | |
1474 | |
1470 | # this is buggy, it needs to properly take care of nested <'s |
1475 | # this is buggy, it needs to properly take care of nested <'s |
1471 | |
1476 | |
1472 | 1 while |
1477 | 1 while |
1473 | # replace B<>, I<>, U<> etc. |
1478 | # replace B<>, I<>, U<> etc. |
1474 | s/B<([^\>]*)>/<b>$1<\/b>/ |
1479 | s/B<([^\>]*)>/<b>$1<\/b>/ |
1475 | || s/I<([^\>]*)>/<i>$1<\/i>/ |
1480 | || s/I<([^\>]*)>/<i>$1<\/i>/ |
1476 | || s/U<([^\>]*)>/<u>$1<\/u>/ |
1481 | || s/U<([^\>]*)>/<u>$1<\/u>/ |
|
|
1482 | || s/T<([^\>]*)>/<big><b>$1<\/b><\/big>/ |
1477 | # replace G<male|female> tags |
1483 | # replace G<male|female> tags |
1478 | || s{G<([^>|]*)\|([^>]*)>}{ |
1484 | || s{G<([^>|]*)\|([^>]*)>}{ |
1479 | $self->gender ? $2 : $1 |
1485 | $self->gender ? $2 : $1 |
1480 | }ge |
1486 | }ge |
1481 | # replace H<hint text> |
1487 | # replace H<hint text> |
… | |
… | |
2091 | { |
2097 | { |
2092 | my $lock = cf::lock_acquire "map_data:$self->{path}"; |
2098 | my $lock = cf::lock_acquire "map_data:$self->{path}"; |
2093 | |
2099 | |
2094 | delete $cf::MAP{$self->path}; |
2100 | delete $cf::MAP{$self->path}; |
2095 | |
2101 | |
|
|
2102 | $self->unlink_save; |
|
|
2103 | |
2096 | bless $self, "cf::map"; |
2104 | bless $self, "cf::map"; |
2097 | delete $self->{deny_reset}; |
2105 | delete $self->{deny_reset}; |
2098 | $self->{deny_save} = 1; |
2106 | $self->{deny_save} = 1; |
2099 | $self->reset_timeout (1); |
2107 | $self->reset_timeout (1); |
2100 | $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); |
2108 | $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); |
2101 | |
|
|
2102 | $self->unlink_save; |
|
|
2103 | |
2109 | |
2104 | $cf::MAP{$self->path} = $self; |
2110 | $cf::MAP{$self->path} = $self; |
2105 | } |
2111 | } |
2106 | |
2112 | |
2107 | $self->reset; # polite request, might not happen |
2113 | $self->reset; # polite request, might not happen |
… | |
… | |
2511 | id => "identify", |
2517 | id => "identify", |
2512 | title => "Identify", |
2518 | title => "Identify", |
2513 | reply => undef, |
2519 | reply => undef, |
2514 | tooltip => "Items recently identified", |
2520 | tooltip => "Items recently identified", |
2515 | }, |
2521 | }, |
|
|
2522 | "c/examine" => { |
|
|
2523 | id => "examine", |
|
|
2524 | title => "Examine", |
|
|
2525 | reply => undef, |
|
|
2526 | tooltip => "Signs and other items you examined", |
|
|
2527 | }, |
2516 | ); |
2528 | ); |
2517 | |
2529 | |
2518 | sub cf::client::send_msg { |
2530 | sub cf::client::send_msg { |
2519 | my ($self, $channel, $msg, $color, @extra) = @_; |
2531 | my ($self, $channel, $msg, $color, @extra) = @_; |
2520 | |
2532 | |
… | |
… | |
2527 | |
2539 | |
2528 | if (ref $channel) { |
2540 | if (ref $channel) { |
2529 | # send meta info to client, if not yet sent |
2541 | # send meta info to client, if not yet sent |
2530 | unless (exists $self->{channel}{$channel->{id}}) { |
2542 | unless (exists $self->{channel}{$channel->{id}}) { |
2531 | $self->{channel}{$channel->{id}} = $channel; |
2543 | $self->{channel}{$channel->{id}} = $channel; |
2532 | $self->ext_msg (channel_info => $channel); |
2544 | $self->ext_msg (channel_info => $channel) |
|
|
2545 | if $self->can_msg; |
2533 | } |
2546 | } |
2534 | |
2547 | |
2535 | $channel = $channel->{id}; |
2548 | $channel = $channel->{id}; |
2536 | } |
2549 | } |
2537 | |
2550 | |