| Revision: | 1.1 |
| Committed: | Thu Apr 8 17:36:53 2010 UTC (16 years, 6 months ago) by root |
| Branch: | MAIN |
| Log Message: | move version to perl, support json versions |
| # | User | Rev | Content |
|---|---|---|---|
| 1 | root | 1.1 | #! perl # mandatory |
| 2 | |||
| 3 | # the version command | ||
| 4 | |||
| 5 | cf::client->attach ( | ||
| 6 | on_version => sub { | ||
| 7 | my ($ns, $arg) = @_; | ||
| 8 | |||
| 9 | if ($arg =~ /^\{/) { | ||
| 10 | my $ver = $cf::json_coder->decode ($arg); | ||
| 11 | $ns->{version} = $ver; | ||
| 12 | $ns->{who_version} = "$ver->{clientver} $ver->{osver}"; | ||
| 13 | |||
| 14 | } elsif ($arg =~ /^(\d+) (\d+) (.*)$/) { | ||
| 15 | $ns->{who_version} = $3; | ||
| 16 | $ns->{version} = { | ||
| 17 | protover => 0, | ||
| 18 | cs_version => $1, | ||
| 19 | sc_version => $2, | ||
| 20 | client => $3, | ||
| 21 | }; | ||
| 22 | } | ||
| 23 | }, | ||
| 24 | ); | ||
| 25 |