ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/version.ext
Revision: 1.2
Committed: Thu Apr 8 19:31:22 2010 UTC (14 years, 1 month ago) by root
Branch: MAIN
CVS Tags: rel-3_0
Changes since 1.1: +10 -0 lines
Log Message:
new server protocol

File Contents

# User Rev Content
1 root 1.1 #! perl # mandatory
2    
3     # the version command
4    
5     cf::client->attach (
6 root 1.2 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 root 1.1 on_version => sub {
15     my ($ns, $arg) = @_;
16    
17     if ($arg =~ /^\{/) {
18 root 1.2 # past 2.10
19 root 1.1 my $ver = $cf::json_coder->decode ($arg);
20     $ns->{version} = $ver;
21     $ns->{who_version} = "$ver->{clientver} $ver->{osver}";
22    
23     } elsif ($arg =~ /^(\d+) (\d+) (.*)$/) {
24 root 1.2 # 2.10 and earlier
25 root 1.1 $ns->{who_version} = $3;
26     $ns->{version} = {
27     protover => 0,
28     cs_version => $1,
29     sc_version => $2,
30     client => $3,
31     };
32     }
33     },
34     );
35