Changeset 33836

Show
Ignore:
Timestamp:
06/08/09 13:24:29 (4 years ago)
Author:
clouder
Message:

lang/perl/HTTP-MobileAgent?/branches/feature-imode-browser2.0: modified some functions

Location:
lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0
Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0/Changes

    r9288 r33836  
    11Revision history for Perl extension HTTP::MobileAgent 
     2 
     30.28 Fri Jun  5 21:44:58 2009 
     4    * Added gps_compliant() method in DoCoMo.pm/EZweb.pm/Vodafone.pm(SoftBank). 
     5    * Added browser_version() method in DoCoMo.pm. 
     6    * $GPSModels and is_gps() method is obsolute but leave for backward compatibility in DoCoMo.pm. 
     7    * Fixed user_id() problem in Vodafone.pm(SoftBank). (Thanks to masutaro) 
    28 
    390.27 Fri Apr 11 13:34:23 2008 
  • lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0/lib/HTTP/MobileAgent.pm

    r9288 r33836  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = '0.27'; 
     5$VERSION = '0.28'; 
    66 
    77use HTTP::MobileAgent::Request; 
  • lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0/lib/HTTP/MobileAgent/DoCoMo.pm

    r9288 r33836  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.19; 
     5$VERSION = 0.20; 
    66 
    77use base qw(HTTP::MobileAgent); 
     
    1515 
    1616# various preferences 
    17 use vars qw($DefaultCacheSize $HTMLVerMap $GPSModels); 
     17use vars qw($DefaultCacheSize $HTMLVerMap $GPSModels $GPSModelsRe); 
    1818$DefaultCacheSize = 5; 
    1919 
     
    2828    qr/505i|506i|252i|253i|P213i|600i|700i|701i|800i|880i|SH851i|P851i|881i|900i|901i/ => '5.0', 
    2929    qr/702i|D851iWM|902i/ => '6.0', 
     30    qr/70[34]i|(F|D|SH)705i|SH706ie|883i|801i|90[34]i|F05A/ => '7.0', 
     31    qr/(P|N|SO)705i|(N|SO|P|N)706i|884i|905i|N906iL|N03A|N05A|F07A/ => '7.1', 
     32    qr/(F|SH|P)706|906i|F0[12346]A|P0[123456]A|SH0[1234]A|N0[124]A/ => '7.2', 
    3033]; 
    3134 
    32 $GPSModels = { map { $_ => 1 } qw(F661i F505iGPS) }; 
     35$GPSModels = { map { $_ => 1 } qw(F661i F505iGPS) }; # This value is obsolute, 
     36                                                     # and will be removed in the near future. 
     37$GPSModelsRe = qr/(?-xism:(?:F(?:8(?:8(?:4i(?:ES)?|3iES?S)|01i)|0[13569]A|505iGPS|661i)|S(?:A(?:70(?:0iS|2i)|800i)|H0[1234567]A)|(?:N0[12689]|P0[12789])A|90(?:3i(?!TV|X)|[4-6]i)))/; 
    3338 
    3439sub is_docomo { 1 } 
     
    150155sub is_gps { 
    151156    my $self = shift; 
    152     return exists $GPSModels->{$self->model}; 
     157    return $self->gps_compliant; 
     158} 
     159 
     160sub gps_compliant { 
     161    my $self = shift; 
     162    return $self->model =~ qr/$GPSModelsRe/; 
    153163} 
    154164 
     
    156166    my $self = shift; 
    157167    return $self->get_header( 'x-dcmguid' ); 
     168} 
     169 
     170sub browser_version { 
     171    my $self = shift; 
     172    return $self->is_foma && $self->cache_size >= 500 ? '2.0' : '1.0'; 
    158173} 
    159174 
  • lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0/lib/HTTP/MobileAgent/EZweb.pm

    r9288 r33836  
    7474        depth  => 2 ** $depth, 
    7575    ); 
     76} 
     77 
     78sub gps_compliant { 
     79    my $self = shift; 
     80    my @specs = split //, $ENV{ HTTP_X_UP_DEVCAP_MULTIMEDIA } || ''; 
     81    return defined $specs[ 1 ] && $specs[ 1 ] =~ /^[23]$/; 
    7682} 
    7783 
  • lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0/lib/HTTP/MobileAgent/Vodafone.pm

    r9288 r33836  
    170170} 
    171171 
     172sub gps_compliant { 
     173    my $self = shift; 
     174    return $self->is_type_3gc; 
     175} 
     176 
    172177sub user_id { 
    173178    my $self = shift; 
    174     return $self->get_header( 'x-jphone-uid' ) unless $self->is_type_c; 
     179    return if $self->is_type_c; 
     180    return $self->get_header( 'x-jphone-uid' ); 
    175181} 
    176182 
  • lang/perl/HTTP-MobileAgent/branches/feature-imode-browser2.0/t/12_guid.t

    r9288 r33836  
    1919    my $ma = HTTP::MobileAgent->new( $header ); 
    2020    my @keys = qw/carrier user_id/; 
    21     +{ map { $_ => $ma->$_ } @keys }; 
     21    +{ map { $_ => $ma->$_ || '' } @keys }; 
    2222} 
    2323 
     
    4242user_id: abcdef0123456789 
    4343 
     44=== Vodafone 
     45--- input 
     46headers: 
     47  User-Agent: J-PHONE/2.0/J-DN02 
     48  X-JPHONE-UID: 
     49--- expected 
     50carrier: V 
     51user_id: 
     52 
    4453=== KDDI 
    4554--- input