… | |
… | |
427 | my $time = Event::time; |
427 | my $time = Event::time; |
428 | |
428 | |
429 | # this is the main coro, too bad, we have to block |
429 | # this is the main coro, too bad, we have to block |
430 | # till the operation succeeds, freezing the server :/ |
430 | # till the operation succeeds, freezing the server :/ |
431 | |
431 | |
|
|
432 | LOG llevError | logBacktrace, Carp::longmess "sync job";#d# |
|
|
433 | |
432 | # TODO: use suspend/resume instead |
434 | # TODO: use suspend/resume instead |
433 | # (but this is cancel-safe) |
435 | # (but this is cancel-safe) |
434 | my $freeze_guard = freeze_mainloop; |
436 | my $freeze_guard = freeze_mainloop; |
435 | |
437 | |
436 | my $busy = 1; |
438 | my $busy = 1; |
… | |
… | |
2273 | =cut |
2275 | =cut |
2274 | |
2276 | |
2275 | sub deref { |
2277 | sub deref { |
2276 | my ($ref) = @_; |
2278 | my ($ref) = @_; |
2277 | |
2279 | |
2278 | # temporary compatibility#TODO#remove |
|
|
2279 | $ref =~ s{^<}{player/<}; |
|
|
2280 | |
|
|
2281 | if ($ref =~ m{^player\/(<1\.\d+>)/(.*)$}) { |
2280 | if ($ref =~ m{^player\/(<1\.[0-9a-f]+>)/(.*)$}) { |
2282 | my ($uuid, $name) = ($1, $2); |
2281 | my ($uuid, $name) = ($1, $2); |
2283 | my $pl = $cf::PLAYER_LOADING{$name} || cf::player::find $name |
2282 | my $pl = $cf::PLAYER_LOADING{$name} || cf::player::find $name |
2284 | or return; |
2283 | or return; |
2285 | $pl->ob->uuid eq $uuid |
2284 | $pl->ob->uuid eq $uuid |
2286 | or return; |
2285 | or return; |
… | |
… | |
2633 | |
2632 | |
2634 | =cut |
2633 | =cut |
2635 | |
2634 | |
2636 | our %CHANNEL = ( |
2635 | our %CHANNEL = ( |
2637 | "c/identify" => { |
2636 | "c/identify" => { |
2638 | id => "identify", |
2637 | id => "infobox", |
2639 | title => "Identify", |
2638 | title => "Identify", |
2640 | reply => undef, |
2639 | reply => undef, |
2641 | tooltip => "Items recently identified", |
2640 | tooltip => "Items recently identified", |
2642 | }, |
2641 | }, |
2643 | "c/examine" => { |
2642 | "c/examine" => { |
2644 | id => "examine", |
2643 | id => "infobox", |
2645 | title => "Examine", |
2644 | title => "Examine", |
2646 | reply => undef, |
2645 | reply => undef, |
2647 | tooltip => "Signs and other items you examined", |
2646 | tooltip => "Signs and other items you examined", |
2648 | }, |
2647 | }, |
|
|
2648 | "c/lookat" => { |
|
|
2649 | id => "infobox", |
|
|
2650 | title => "Look", |
|
|
2651 | reply => undef, |
|
|
2652 | tooltip => "What you saw there", |
|
|
2653 | }, |
2649 | ); |
2654 | ); |
2650 | |
2655 | |
2651 | sub cf::client::send_msg { |
2656 | sub cf::client::send_msg { |
2652 | my ($self, $channel, $msg, $color, @extra) = @_; |
2657 | my ($self, $channel, $msg, $color, @extra) = @_; |
2653 | |
2658 | |
2654 | $msg = $self->pl->expand_cfpod ($msg); |
2659 | $msg = $self->pl->expand_cfpod ($msg); |
2655 | |
2660 | |
2656 | $color &= cf::NDI_CLIENT_MASK; # just in case... |
2661 | $color &= cf::NDI_CLIENT_MASK; # just in case... |
2657 | |
2662 | |
2658 | # check predefined channels, for the benefit of C |
2663 | # check predefined channels, for the benefit of C |
2659 | $channel = $CHANNEL{$channel} if $CHANNEL{$channel}; |
2664 | if ($CHANNEL{$channel}) { |
|
|
2665 | $channel = $CHANNEL{$channel}; |
2660 | |
2666 | |
|
|
2667 | $self->ext_msg (channel_info => $channel) |
|
|
2668 | if $self->can_msg; |
|
|
2669 | |
|
|
2670 | $channel = $channel->{id}; |
|
|
2671 | |
2661 | if (ref $channel) { |
2672 | } elsif (ref $channel) { |
2662 | # send meta info to client, if not yet sent |
2673 | # send meta info to client, if not yet sent |
2663 | unless (exists $self->{channel}{$channel->{id}}) { |
2674 | unless (exists $self->{channel}{$channel->{id}}) { |
2664 | $self->{channel}{$channel->{id}} = $channel; |
2675 | $self->{channel}{$channel->{id}} = $channel; |
2665 | $self->ext_msg (channel_info => $channel) |
2676 | $self->ext_msg (channel_info => $channel) |
2666 | if $self->can_msg; |
2677 | if $self->can_msg; |
… | |
… | |
3614 | $AIO_POLL_WATCHER = Event->io ( |
3625 | $AIO_POLL_WATCHER = Event->io ( |
3615 | reentrant => 0, |
3626 | reentrant => 0, |
3616 | data => WF_AUTOCANCEL, |
3627 | data => WF_AUTOCANCEL, |
3617 | fd => IO::AIO::poll_fileno, |
3628 | fd => IO::AIO::poll_fileno, |
3618 | poll => 'r', |
3629 | poll => 'r', |
3619 | prio => 6, |
3630 | prio => 0, |
3620 | cb => \&IO::AIO::poll_cb, |
3631 | cb => \&IO::AIO::poll_cb, |
3621 | ); |
3632 | ); |
3622 | } |
3633 | } |
3623 | |
3634 | |
3624 | my $_log_backtrace; |
3635 | my $_log_backtrace; |