Webqq/Client/Remote/_check_login.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 28 CC 4 SCAR 30.0
CC
4
Cov
0%
Mojo::Webqq::Client::_check_login
20.0
CRAP 20.0
1 sub Mojo::Webqq::Client::_check_login {
2 my $self = shift;
3 $self->info("正在检查登录状态...");
4 if($self->search_cookie("supertoken") and $self->search_cookie("superuin")){
5 my $content = $self->http_get('https://ssl.ptlogin2.qq.com/pt4_auth?daid=164&appid=501004106&auth_token=' . $self->time33($self->search_cookie("supertoken")), {Referer => 'https://xui.ptlogin2.qq.com/cgi-bin/xlogin?daid=164&target=self&style=40&pt_disable_pwd=1&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2F' . $self->domain . '%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001'} );
6 return 0 if not defined $content;
7 my( $retcode,$api_check_sig) = $content=~/'(.*?)'/g;
8 $self->info("登录状态检查结果($retcode)");
9 if( $api_check_sig =~ /^https?:\/\/[^\/]+\.qq\.com\/check_sig/){
10 $self->api_check_sig($api_check_sig . '&regmaster=&aid=501004106&s_url=http%3A%2F%2F'. $self->domain . '%2Fproxy.html');
11 $self->info("检查结果:登录状态有效,尝试直接恢复登录...");
12 return 1;
13 }
14 else{
15 $self->info("检查结果:需要重新登录(1)");
16 return 0;
17 }
18 }
19 else{
20 $self->info("检查结果:需要重新登录(2)");
21 return 0;
22 }
23 }
24 1;