line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::MobileAgent::Vodafone; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
86
|
use strict; |
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
499
|
|
4
|
14
|
|
|
14
|
|
84
|
use vars qw($VERSION); |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
2226
|
|
5
|
|
|
|
|
|
|
$VERSION = 0.21; |
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
1509
|
use base qw(HTTP::MobileAgent); |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
21145
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->make_accessors( |
10
|
|
|
|
|
|
|
qw(name version model type packet_compliant |
11
|
|
|
|
|
|
|
serial_number vendor vendor_version java_info) |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
73
|
|
|
73
|
0
|
500
|
sub is_j_phone { shift->is_vodafone } |
15
|
|
|
|
|
|
|
|
16
|
90
|
|
|
90
|
1
|
216
|
sub is_vodafone { 1 } |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
0
|
25
|
sub is_softbank { shift->is_vodafone } |
19
|
|
|
|
|
|
|
|
20
|
14
|
|
|
14
|
1
|
159
|
sub carrier { 'V' } |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
|
6
|
1
|
23
|
sub carrier_longname { 'Vodafone' } |
23
|
|
|
|
|
|
|
|
24
|
12
|
|
|
12
|
1
|
106
|
sub is_type_c { shift->{type} =~ /^C/ } |
25
|
10
|
|
|
10
|
1
|
107
|
sub is_type_p { shift->{type} =~ /^P/ } |
26
|
16
|
|
|
16
|
1
|
139
|
sub is_type_w { shift->{type} =~ /^W/ } |
27
|
14
|
|
|
14
|
1
|
113
|
sub is_type_3gc { shift->{type} eq '3GC' } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub parse { |
30
|
85
|
|
|
85
|
0
|
126
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
85
|
100
|
|
|
|
4499
|
return $self->_parse_3gc if($self->user_agent =~ /^Vodafone/); |
33
|
80
|
100
|
|
|
|
407
|
return $self->_parse_softbank_3gc if($self->user_agent =~ /^SoftBank/); |
34
|
75
|
100
|
|
|
|
250
|
return $self->_parse_motorola_3gc if($self->user_agent =~ /^MOT-/); |
35
|
73
|
100
|
|
|
|
278
|
return $self->_parse_crawler if($self->user_agent =~ /^Nokia/); # ad hoc |
36
|
|
|
|
|
|
|
|
37
|
72
|
|
|
|
|
521
|
my($main, @rest) = split / /, _subtract_ua($self->user_agent); |
38
|
|
|
|
|
|
|
|
39
|
72
|
100
|
|
|
|
190
|
if (@rest) { |
40
|
|
|
|
|
|
|
# J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 |
41
|
22
|
|
|
|
|
46
|
$self->{packet_compliant} = 1; |
42
|
22
|
|
|
|
|
61
|
@{$self}{qw(name version model serial_number)} = split m!/!, $main; |
|
22
|
|
|
|
|
100
|
|
43
|
22
|
100
|
|
|
|
70
|
if ($self->{serial_number}) { |
44
|
20
|
50
|
|
|
|
109
|
$self->{serial_number} =~ s/^SN// or return $self->no_match; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
22
|
|
|
|
|
40
|
my $vendor = shift @rest; |
48
|
22
|
|
|
|
|
46
|
@{$self}{qw(vendor vendor_version)} = split m!/!, $vendor; |
|
22
|
|
|
|
|
91
|
|
49
|
|
|
|
|
|
|
|
50
|
22
|
|
|
|
|
176
|
my %java_info = map split(m!/!), @rest; |
51
|
22
|
|
|
|
|
61
|
$self->{java_info} = \%java_info; |
52
|
|
|
|
|
|
|
} else { |
53
|
|
|
|
|
|
|
# J-PHONE/2.0/J-DN02 |
54
|
50
|
|
|
|
|
193
|
@{$self}{qw(name version model)} = split m!/!, $main; |
|
50
|
|
|
|
|
222
|
|
55
|
50
|
100
|
|
|
|
198
|
$self->{name} = 'J-PHONE' if $self->{name} eq 'J-Phone'; # for J-Phone/5.0/J-SH03 (YahooSeeker) |
56
|
50
|
100
|
|
|
|
663
|
$self->{vendor} = ($self->{model} =~ /J-([A-Z]+)/)[0] if $self->{model}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
72
|
100
|
|
|
|
330
|
if ($self->version =~ /^2\./) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
60
|
15
|
|
|
|
|
2380
|
$self->{type} = 'C2'; |
61
|
|
|
|
|
|
|
} elsif ($self->version =~ /^3\./) { |
62
|
32
|
50
|
|
|
|
95
|
if ($self->get_header('x-jphone-java')) { |
63
|
0
|
|
|
|
|
0
|
$self->{type} = 'C4'; |
64
|
|
|
|
|
|
|
} else { |
65
|
32
|
|
|
|
|
119
|
$self->{type} = 'C3'; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} elsif ($self->version =~ /^4\./) { |
68
|
21
|
|
|
|
|
109
|
my($jscl_ver) = ($self->{java_info}->{'Ext-Profile'} =~ /JSCL-(\d.+)/); |
69
|
|
|
|
|
|
|
|
70
|
21
|
50
|
|
|
|
67
|
if ($jscl_ver =~ /^1\.1\./) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
71
|
21
|
|
|
|
|
87
|
$self->{type} = 'P4'; |
72
|
|
|
|
|
|
|
} elsif ($jscl_ver eq '1.2.1') { |
73
|
0
|
|
|
|
|
0
|
$self->{type} = 'P5'; |
74
|
|
|
|
|
|
|
} elsif ($jscl_ver eq '1.2.2') { |
75
|
0
|
|
|
|
|
0
|
$self->{type} = 'P6'; |
76
|
|
|
|
|
|
|
} else { |
77
|
0
|
|
|
|
|
0
|
$self->{type} = 'P7'; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} elsif ($self->version =~ /^5\./) { |
80
|
3
|
|
|
|
|
13
|
$self->{type} = 'W'; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# for 3gc |
85
|
|
|
|
|
|
|
sub _parse_3gc { |
86
|
10
|
|
|
10
|
|
58
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Vodafone/1.0/V802SE/SEJ001 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
89
|
|
|
|
|
|
|
# Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
90
|
|
|
|
|
|
|
# SoftBank/1.0/910T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
91
|
10
|
|
|
|
|
30
|
my($main, @rest) = split / /, $self->user_agent; |
92
|
10
|
|
|
|
|
59
|
$self->{packet_compliant} = 1; |
93
|
10
|
|
|
|
|
23
|
$self->{type} = '3GC'; |
94
|
|
|
|
|
|
|
|
95
|
10
|
|
|
|
|
35
|
@{$self}{qw(name version model _maker serial_number)} = split m!/!, $main; |
|
10
|
|
|
|
|
66
|
|
96
|
10
|
100
|
|
|
|
38
|
if ($self->{serial_number}) { |
97
|
6
|
50
|
|
|
|
37
|
$self->{serial_number} =~ s/^SN// or return $self->no_match; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
10
|
|
|
|
|
67
|
my($java_info) = $self->user_agent =~ /(Profile.*)$/; |
101
|
10
|
|
|
|
|
127
|
my %java_info = map split(m!/!), split / /,$java_info; |
102
|
10
|
|
|
|
|
52
|
$self->{java_info} = \%java_info; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# for softbank 3gc |
106
|
|
|
|
|
|
|
*_parse_softbank_3gc = \&_parse_3gc; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# for motorola 3gc |
109
|
|
|
|
|
|
|
sub _parse_motorola_3gc{ |
110
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
111
|
2
|
|
|
|
|
5
|
my($main, @rest) = split / /, $self->user_agent; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#MOT-V980/80.2B.04I MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
114
|
|
|
|
|
|
|
|
115
|
2
|
|
|
|
|
6
|
$self->{packet_compliant} = 1; |
116
|
2
|
|
|
|
|
5
|
$self->{type} = '3GC'; |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
|
|
|
5
|
@{$self}{qw(name)} = split m!/!, $main; |
|
2
|
|
|
|
|
5
|
|
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
|
|
4
|
shift @rest; |
121
|
2
|
|
|
|
|
14
|
my %java_info = map split(m!/!), @rest; |
122
|
2
|
|
|
|
|
5
|
$self->{java_info} = \%java_info; |
123
|
|
|
|
|
|
|
|
124
|
2
|
50
|
|
|
|
9
|
$self->{model} = 'V702MO' if $self->{name} eq 'MOT-V980'; |
125
|
2
|
50
|
|
|
|
5
|
$self->{model} = 'V702sMO' if $self->{name} eq 'MOT-C980'; |
126
|
2
|
|
33
|
|
|
10
|
$self->{model} ||= $self->get_header('x-jphone-msname'); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# for crawler |
130
|
|
|
|
|
|
|
sub _parse_crawler { |
131
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
132
|
1
|
|
|
|
|
25
|
my($main, @rest) = split / /, _subtract_ua($self->user_agent); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# Nokia6820/2.0 (4.83) Profile/MIDP-1.0 Configuration/CLDC-1.0 |
135
|
1
|
|
|
|
|
13
|
@{$self}{qw(model)} = split m!/!, $main; |
|
1
|
|
|
|
|
4
|
|
136
|
1
|
|
|
|
|
3
|
$self->{name} = 'Vodafone'; |
137
|
1
|
|
|
|
|
3
|
$self->{type} = '3GC'; |
138
|
|
|
|
|
|
|
|
139
|
1
|
|
|
|
|
1
|
shift @rest; |
140
|
1
|
|
|
|
|
6
|
my %java_info = map split(m!/!), @rest; |
141
|
1
|
|
|
|
|
4
|
$self->{java_info} = \%java_info; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub _make_display { |
145
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
146
|
1
|
|
|
|
|
13
|
my($width, $height) = split /\*/, $self->get_header('x-jphone-display'); |
147
|
|
|
|
|
|
|
|
148
|
1
|
|
|
|
|
3
|
my($color, $depth); |
149
|
1
|
50
|
|
|
|
3
|
if (my $c_str = $self->get_header('x-jphone-color')) { |
150
|
1
|
|
|
|
|
13
|
($color, $depth) = $c_str =~ /^([CG])(\d+)$/; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
1
|
|
|
|
|
13
|
return HTTP::MobileAgent::Display->new( |
154
|
|
|
|
|
|
|
width => $width, |
155
|
|
|
|
|
|
|
height => $height, |
156
|
|
|
|
|
|
|
color => $color eq 'C', |
157
|
|
|
|
|
|
|
depth => $depth, |
158
|
|
|
|
|
|
|
); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub _subtract_ua { |
162
|
73
|
|
|
73
|
|
166
|
my $user_agent = shift; |
163
|
73
|
|
|
|
|
183
|
$user_agent =~ s/\s*\(compatible\s*[^\)]+\)//i; |
164
|
73
|
|
|
|
|
357
|
return $user_agent; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub xhtml_compliant { |
168
|
6
|
|
|
6
|
1
|
23
|
my $self = shift; |
169
|
6
|
100
|
100
|
|
|
22
|
return ($self->is_type_w || $self->is_type_3gc) ? 1 : 0; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub gps_compliant { |
173
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
174
|
0
|
|
|
|
|
0
|
return $self->is_type_3gc; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub user_id { |
178
|
2
|
|
|
2
|
1
|
17
|
my $self = shift; |
179
|
2
|
100
|
|
|
|
11
|
return if $self->is_type_c; |
180
|
1
|
|
|
|
|
5
|
return $self->get_header( 'x-jphone-uid' ); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1; |
184
|
|
|
|
|
|
|
__END__ |