| 1 | 1 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use Webqq::Client::Util qw(console); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 0 | ▶ | sub Webqq::Client::_relink{ | ||||||||
|
Subroutine
_relink: not called CC=12 SCAR=50.5
| |||||||||||
| 4 | 0 | my $self = shift; | |||||||||
| 5 | 0 | $self->{login_state} = 'relink'; | |||||||||
| 6 | 0 | console "正在进行重新连接...\n"; | |||||||||
| 7 | 0 | my $ua = $self->{ua}; | |||||||||
| 8 | 0 | my $api_url = 'http://d.web2.qq.com/channel/login2'; | |||||||||
| 9 | 0 | ▶ | my @headers = $self->{type} eq 'webqq'? (Referer=>'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | : (Referer=>'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2') | ||||||||||
| 11 | ; | ||||||||||
| 12 | my %r = ( | ||||||||||
| 13 | status => $self->{qq_param}{status}, | ||||||||||
| 14 | key => "", | ||||||||||
| 15 | ptwebqq => $self->{qq_param}{ptwebqq}, | ||||||||||
| 16 | clientid => $self->{qq_param}{clientid}, | ||||||||||
| 17 | psessionid => $self->{qq_param}{psessionid}, | ||||||||||
| 18 | 0 | ); | |||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | if($self->{type} eq 'webqq'){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | $r{passwd_sig} = $self->{qq_param}{passwd_sig}; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | for(my $i=0;$i<=$self->{ua_retry_times};$i++){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)], @headers); | |||||||||
| 26 | 0 | ▶ | if($response->is_success){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | print $response->content() if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | my $content = $response->content(); | |||||||||
| 29 | 0 | my $data = JSON->new->utf8->decode($content); | |||||||||
| 30 | 0 | ▶ | if($data->{retcode} ==0){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | ▶ | $self->{qq_param}{psessionid} = $data->{result}{psessionid} if $data->{result}{psessionid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | ▶ | $self->{qq_param}{vfwebqq} = $data->{result}{vfwebqq} if $data->{result}{vfwebqq}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | ▶ | $self->{qq_param}{clientid} = $data->{result}{clientid} if $data->{result}{clientid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | ▶ | $self->{qq_param}{ptwebqq} = $data->{result}{ptwebqq} if $data->{result}{ptwebqq}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | ▶ | $self->{qq_param}{skey} = $data->{result}{skey} if $data->{result}{skey}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | $self->{cookie_jar}->set_cookie(0,"ptwebqq",$data->{result}{ptwebqq},"/","qq.com"); | |||||||||
| 37 | 0 | $self->_cookie_proxy(); | |||||||||
| 38 | 0 | $self->{login_state} = 'success'; | |||||||||
| 39 | 0 | return 1; | |||||||||
| 40 | } | ||||||||||
| 41 | else{ | ||||||||||
| 42 | 0 | $self->relogin(); | |||||||||
| 43 | 0 | return 0; | |||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | 0 | $self->relogin(); | |||||||||
| 48 | 0 | return 0; | |||||||||
| 49 | } | ||||||||||
| 50 | 1 | 1; | |||||||||