1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # check client version and string for old clients and possibly issue warnings for them |
3 | # check client version and string for old clients and possibly issue warnings for them |
4 | |
4 | |
5 | sub on_login { |
5 | cf::attach_to_players |
|
|
6 | on_login => sub { |
6 | my ($pl, $host) = @_; |
7 | my ($pl) = @_; |
7 | |
8 | |
8 | my $client = $pl->client; |
9 | my $client = $pl->client; |
9 | |
10 | |
10 | my $is_cf = $client =~ /^(?:GTK|X11) (?:Unix|Win32) Client ([.0-9]+)/ && $1; |
11 | my $is_cf = $client =~ /^(?:GTK|X11) (?:Unix|Win32) Client ([.0-9]+)/ |
11 | warn "$client> is_cf is <$is_cf>\n";#d# |
12 | ? join "", map chr, split /\./, $1 |
|
|
13 | : undef; |
12 | |
14 | |
13 | if ($is_cf && (join "", map chr, split /\./, $is_cf) lt v1.9.1) { |
15 | my $is_jx = $client =~ /^JCrossclient 1.0 alpha-(\d+)/ |
|
|
16 | ? join "", map chr, split /\./, $1 |
|
|
17 | : undef; |
|
|
18 | |
|
|
19 | if ($is_cf) { # && $is_cf lt v1.9.2) { |
|
|
20 | $pl->ob->message ("(enabling workaround for client buffer overflow)", cf::NDI_RED | cf::NDI_UNIQUE); |
|
|
21 | $pl->buggy_mapscroll; |
|
|
22 | } |
|
|
23 | |
|
|
24 | if ($is_jx) { |
|
|
25 | $pl->ob->message ("(enabling buggy map scroll workaround)", cf::NDI_RED | cf::NDI_UNIQUE); |
|
|
26 | $pl->buggy_mapscroll; |
|
|
27 | } |
|
|
28 | |
|
|
29 | if ($is_jx) { |
|
|
30 | $pl->ob->message ("You are using a known to be buggy client (an alpha version, too). " |
|
|
31 | . "If you encounter map freezes or other bugs, consider using a more stable client " |
|
|
32 | . "such as CFPlus or gcfclient or gcfclient2"); |
|
|
33 | } |
|
|
34 | |
|
|
35 | if ($is_cf && $is_cf lt v1.9.1) { |
14 | $pl->ob->message (<<EOF, cf::NDI_RED | cf::NDI_UNIQUE); |
36 | $pl->ob->message (<<EOF, cf::NDI_RED | cf::NDI_UNIQUE); |
15 | |
37 | |
16 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
38 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
17 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
39 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
18 | *** WARNING: Your client is BUGGY |
40 | *** WARNING: Your client is BUGGY |
19 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
41 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
20 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
42 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
21 | |
43 | |
22 | Your client ($client) is known to be buggy. If you experience crashes, strange lockups or other problems, consider upgrading to the current version. |
44 | Your client ($client) is known to be buggy. Upgrading is highly recommended, otherwise you may experience crashes, strange lockups or other problems. |
23 | |
45 | |
24 | EOF |
46 | EOF |
|
|
47 | } |
25 | } |
48 | }, |
|
|
49 | ; |
26 | |
50 | |
27 | () |
|
|
28 | } |
|
|