ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/version.ext
Revision: 1.3
Committed: Sat Oct 16 22:56:18 2010 UTC (13 years, 7 months ago) by root
Branch: MAIN
Changes since 1.2: +3 -0 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl # mandatory
2
3 # the version command
4
5 cf::client->attach (
6 on_connect => sub {
7 my ($ns) = @_;
8
9 $ns->send_packet ("version " . $cf::json_coder->encode ({
10 server => "Deliantra Server",
11 serverver => cf::VERSION,
12 }));
13 },
14 on_version => sub {
15 my ($ns, $arg) = @_;
16
17 if ($arg =~ /^\{/) {
18 # past 2.10
19 my $ver = $cf::json_coder->decode ($arg);
20 $ns->{version} = $ver;
21 $ns->{who_version} = "$ver->{clientver} $ver->{osver}";
22
23 # dclient prefers bump messages
24 $ns->bumpmsg ($ns->{client} eq "dclient");
25
26 } elsif ($arg =~ /^(\d+) (\d+) (.*)$/) {
27 # 2.10 and earlier
28 $ns->{who_version} = $3;
29 $ns->{version} = {
30 protover => 0,
31 cs_version => $1,
32 sc_version => $2,
33 client => $3,
34 };
35 }
36 },
37 );
38