… | |
… | |
1505 | =cut |
1505 | =cut |
1506 | |
1506 | |
1507 | sub ext_reply($$@) { |
1507 | sub ext_reply($$@) { |
1508 | my ($self, $id, @msg) = @_; |
1508 | my ($self, $id, @msg) = @_; |
1509 | |
1509 | |
1510 | if ($self->ns->extcmd == 2) { |
1510 | $self->ns->ext_reply ($id, @msg) |
1511 | $self->send ("ext " . $self->ns->{json_coder}->encode (["reply-$id", @msg])); |
|
|
1512 | } elsif ($self->ns->extcmd == 1) { |
|
|
1513 | #TODO: version 1, remove |
|
|
1514 | unshift @msg, msgtype => "reply", msgid => $id; |
|
|
1515 | $self->send ("ext " . $self->ns->{json_coder}->encode ({@msg})); |
|
|
1516 | } |
|
|
1517 | } |
1511 | } |
1518 | |
1512 | |
1519 | =item $player->ext_msg ($type, @msg) |
1513 | =item $player->ext_msg ($type, @msg) |
1520 | |
1514 | |
1521 | Sends an ext event to the client. |
1515 | Sends an ext event to the client. |
… | |
… | |
2567 | push @msg, msgtype => "event_$type"; |
2561 | push @msg, msgtype => "event_$type"; |
2568 | $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); |
2562 | $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); |
2569 | } |
2563 | } |
2570 | } |
2564 | } |
2571 | |
2565 | |
|
|
2566 | =item $client->ext_reply ($msgid, @msg) |
|
|
2567 | |
|
|
2568 | Sends an ext reply to the client. |
|
|
2569 | |
|
|
2570 | =cut |
|
|
2571 | |
|
|
2572 | sub cf::client::ext_reply($$@) { |
|
|
2573 | my ($self, $id, @msg) = @_; |
|
|
2574 | |
|
|
2575 | if ($self->extcmd == 2) { |
|
|
2576 | $self->send_packet ("ext " . $self->{json_coder}->encode (["reply-$id", @msg])); |
|
|
2577 | } elsif ($self->ns->extcmd == 1) { |
|
|
2578 | #TODO: version 1, remove |
|
|
2579 | unshift @msg, msgtype => "reply", msgid => $id; |
|
|
2580 | $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); |
|
|
2581 | } |
|
|
2582 | } |
|
|
2583 | |
2572 | =item $success = $client->query ($flags, "text", \&cb) |
2584 | =item $success = $client->query ($flags, "text", \&cb) |
2573 | |
2585 | |
2574 | Queues a query to the client, calling the given callback with |
2586 | Queues a query to the client, calling the given callback with |
2575 | the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, |
2587 | the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, |
2576 | C<cf::CS_QUERY_SINGLECHAR> or C<cf::CS_QUERY_HIDEINPUT> or C<0>. |
2588 | C<cf::CS_QUERY_SINGLECHAR> or C<cf::CS_QUERY_HIDEINPUT> or C<0>. |