line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use JSON; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
2
|
1
|
|
|
1
|
|
86
|
use Webqq::Client::Util qw(console); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
337
|
|
3
|
|
|
|
|
|
|
sub Webqq::Client::_relink{ |
4
|
0
|
|
|
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
|
0
|
|
|
|
|
my @headers = $self->{type} eq 'webqq'? (Referer=>'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3') |
10
|
|
|
|
|
|
|
: (Referer=>'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2') |
11
|
|
|
|
|
|
|
; |
12
|
0
|
|
|
|
|
|
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
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if($self->{type} eq 'webqq'){ |
21
|
0
|
|
|
|
|
|
$r{passwd_sig} = $self->{qq_param}{passwd_sig}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
for(my $i=0;$i<=$self->{ua_retry_times};$i++){ |
25
|
0
|
|
|
|
|
|
my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)], @headers); |
26
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
27
|
0
|
0
|
|
|
|
|
print $response->content() if $self->{debug}; |
28
|
0
|
|
|
|
|
|
my $content = $response->content(); |
29
|
0
|
|
|
|
|
|
my $data = JSON->new->utf8->decode($content); |
30
|
0
|
0
|
|
|
|
|
if($data->{retcode} ==0){ |
31
|
0
|
0
|
|
|
|
|
$self->{qq_param}{psessionid} = $data->{result}{psessionid} if $data->{result}{psessionid}; |
32
|
0
|
0
|
|
|
|
|
$self->{qq_param}{vfwebqq} = $data->{result}{vfwebqq} if $data->{result}{vfwebqq}; |
33
|
0
|
0
|
|
|
|
|
$self->{qq_param}{clientid} = $data->{result}{clientid} if $data->{result}{clientid}; |
34
|
0
|
0
|
|
|
|
|
$self->{qq_param}{ptwebqq} = $data->{result}{ptwebqq} if $data->{result}{ptwebqq}; |
35
|
0
|
0
|
|
|
|
|
$self->{qq_param}{skey} = $data->{result}{skey} if $data->{result}{skey}; |
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; |