| 1 | package Webqq::Message; | ||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Webqq::Message::Face; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Webqq::Client::Util qw(console code2client); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | 0 | ▶ | sub reply_message{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
reply_message: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 8 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 9 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 10 | 0 | my $content = shift; | |||||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | unless(blessed($msg)){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 12 | 0 | console "输入的msg数据非法\n"; | |||||||||||||||||||||||||||||||||||||
| 13 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | if($msg->{type} eq 'message'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||
| 16 | $client->send_message( | ||||||||||||||||||||||||||||||||||||||
| 17 | 0 | $client->create_msg(to_uin=>$msg->{from_uin},content=>$content) | |||||||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||
| 20 | elsif($msg->{type} eq 'group_message'){ | ||||||||||||||||||||||||||||||||||||||
| 21 | $client->send_group_message( | ||||||||||||||||||||||||||||||||||||||
| 22 | $client->create_group_msg( | ||||||||||||||||||||||||||||||||||||||
| 23 | to_uin=>$msg->{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 24 | content=>$content, | ||||||||||||||||||||||||||||||||||||||
| 25 | group_code=>$msg->{group_code} | ||||||||||||||||||||||||||||||||||||||
| 26 | ) | ||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ); | |||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||
| 29 | elsif($msg->{type} eq 'discuss_message'){ | ||||||||||||||||||||||||||||||||||||||
| 30 | $client->send_discuss_message( | ||||||||||||||||||||||||||||||||||||||
| 31 | $client->create_discuss_msg( | ||||||||||||||||||||||||||||||||||||||
| 32 | to_uin =>$msg->{did} || $msg->{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | content =>$content, | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$msg->{'did'} || $msg->{'from_uin'}
MC/DC0%0/2
$msg->{'did'} || $msg->{'from_uin'}
$msg->{'did'}
$msg->{'from_uin'}
Truth table0%0/3
A || B
A= $msg->{'did'}B= $msg->{'from_uin'}
| |||||||||||||||||||||||||||||||||||||||
| 34 | ) | ||||||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||
| 37 | elsif($msg->{type} eq 'sess_message'){ | ||||||||||||||||||||||||||||||||||||||
| 38 | #群临时消息 | ||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if($msg->{via} eq 'group'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 40 | $client->send_sess_message( | ||||||||||||||||||||||||||||||||||||||
| 41 | $client->create_sess_msg( | ||||||||||||||||||||||||||||||||||||||
| 42 | to_uin => $msg->{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 43 | content => $content, | ||||||||||||||||||||||||||||||||||||||
| 44 | group_code => $msg->{group_code}, | ||||||||||||||||||||||||||||||||||||||
| 45 | gid => $msg->{gid}, | ||||||||||||||||||||||||||||||||||||||
| 46 | ) | ||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ); | |||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||
| 49 | #讨论组临时消息 | ||||||||||||||||||||||||||||||||||||||
| 50 | elsif($msg->{via} eq 'discuss'){ | ||||||||||||||||||||||||||||||||||||||
| 51 | $client->send_sess_message( | ||||||||||||||||||||||||||||||||||||||
| 52 | $client->create_sess_msg( | ||||||||||||||||||||||||||||||||||||||
| 53 | to_uin => $msg->{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 54 | content => $content, | ||||||||||||||||||||||||||||||||||||||
| 55 | did => $msg->{did}, | ||||||||||||||||||||||||||||||||||||||
| 56 | ) | ||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ); | |||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub create_sess_msg{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
create_sess_msg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 64 | 0 | return $client->_create_msg(@_,type=>'sess_message'); | |||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub create_group_msg{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
create_group_msg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 68 | 0 | return $client->_create_msg(@_,type=>'group_message'); | |||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub create_msg{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
create_msg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 72 | 0 | return $client->_create_msg(@_,type=>'message'); | |||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub create_discuss_msg{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
create_discuss_msg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 76 | 0 | return $client->_create_msg(@_,type=>'discuss_message'); | |||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub _create_msg { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_create_msg: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 80 | 0 | my %p = @_; | |||||||||||||||||||||||||||||||||||||
| 81 | 0 | $p{content} =~s/\r|\n/\n/g; | |||||||||||||||||||||||||||||||||||||
| 82 | my %msg = ( | ||||||||||||||||||||||||||||||||||||||
| 83 | type => $p{type}, | ||||||||||||||||||||||||||||||||||||||
| 84 | msg_id => $p{msg_id} || ++$client->{qq_param}{send_msg_id}, | ||||||||||||||||||||||||||||||||||||||
| 85 | from_uin => $p{from_uin} || $client->{qq_param}{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 86 | to_uin => $p{to_uin}, | ||||||||||||||||||||||||||||||||||||||
| 87 | content => $p{content}, | ||||||||||||||||||||||||||||||||||||||
| 88 | msg_class => "send", | ||||||||||||||||||||||||||||||||||||||
| 89 | msg_time => time, | ||||||||||||||||||||||||||||||||||||||
| 90 | cb => $p{cb}, | ||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | ttl => 5, | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$p{'msg_id'} || ++$client->{'qq_param'}{'send_msg_id'}
$p{'from_uin'} || $client->{'qq_param'}{'from_uin'}
MC/DC0%0/2
$p{'msg_id'} || ++$client->{'qq_param'}{'send_msg_id'}
$p{'msg_id'}
++$client->{'qq_param'}{'send_msg_id'}
MC/DC0%0/2
$p{'from_uin'} || $client->{'qq_param'}{'from_uin'}
$p{'from_uin'}
$client->{'qq_param'}{'from_uin'}
Truth table0%0/3
A || B
A= $p{'msg_id'}B= ++$client->{'qq_param'}{'send_msg_id'}
Truth table0%0/3
A || B
A= $p{'from_uin'}B= $client->{'qq_param'}{'from_uin'}
| |||||||||||||||||||||||||||||||||||||||
| 92 | allow_plugin => 1, | ||||||||||||||||||||||||||||||||||||||
| 93 | client => $client, | ||||||||||||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if($p{type} eq 'sess_message'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if(defined $p{group_code}){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $msg{group_code} = $p{group_code}; | |||||||||||||||||||||||||||||||||||||
| 98 | 0 | $msg{service_type} = 0; | |||||||||||||||||||||||||||||||||||||
| 99 | 0 | $msg{via} = 'group'; | |||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | my $id = defined $p{gid}?$p{gid}:$client->search_group($p{group_code})->{gid}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $msg{group_sig} = $client->_get_group_sig($id,$p{to_uin},$msg{service_type}); | |||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||
| 103 | elsif(defined $p{gid}){ | ||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $msg{group_code} = $client->get_group_code_from_gid($p{gid}); | |||||||||||||||||||||||||||||||||||||
| 105 | 0 | $msg{service_type} = 0; | |||||||||||||||||||||||||||||||||||||
| 106 | 0 | $msg{via} = 'group'; | |||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $id = $p{gid}; | |||||||||||||||||||||||||||||||||||||
| 108 | 0 | $msg{group_sig} = $client->_get_group_sig($id,$p{to_uin},$msg{service_type}); | |||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||
| 110 | elsif(defined $p{did}){ | ||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $msg{did} = $p{did}; | |||||||||||||||||||||||||||||||||||||
| 112 | 0 | $msg{service_type} = 1; | |||||||||||||||||||||||||||||||||||||
| 113 | 0 | $msg{via} = 'discuss'; | |||||||||||||||||||||||||||||||||||||
| 114 | 0 | $msg{group_sig} = $client->_get_group_sig($p{did},$p{to_uin},$msg{service_type}); | |||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||
| 116 | else{ | ||||||||||||||||||||||||||||||||||||||
| 117 | 0 | console "create_sess_msg()必须设置group_code或者did\n"; | |||||||||||||||||||||||||||||||||||||
| 118 | 0 | return ; | |||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||
| 121 | elsif($p{type} eq 'group_message'){ | ||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | $msg{group_code} = $p{group_code}||$client->get_group_code_from_gid($p{to_uin}); | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$p{'group_code'} || $client->get_group_code_from_gid($p{'to_uin'})
MC/DC0%0/2
$p{'group_code'} || $client->get_group_code_from_gid($p{'to_uin'})
$p{'group_code'}
$client->get_group_code_from_gid($p{'to_uin'})
Truth table0%0/3
A || B
A= $p{'group_code'}B= $client->get_group_code_from_gid($p{'to_uin'})
| |||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $msg{send_uin} = $msg{from_uin}; | |||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||
| 125 | elsif($p{type} eq 'discuss_message'){ | ||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $msg{did} = $p{did} || $p{to_uin}; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$p{'did'} || $p{'to_uin'}
MC/DC0%0/2
$p{'did'} || $p{'to_uin'}
$p{'did'}
$p{'to_uin'}
Truth table0%0/3
A || B
A= $p{'did'}B= $p{'to_uin'}
| |||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $msg{send_uin} = $msg{from_uin}; | |||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $msg_pkg = "\u$p{type}::Send"; | |||||||||||||||||||||||||||||||||||||
| 130 | 0 | $msg_pkg=~s/_(.)/\u$1/g; | |||||||||||||||||||||||||||||||||||||
| 131 | 0 | return $client->_mk_ro_accessors(\%msg,$msg_pkg); | |||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | sub _load_extra_accessor { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_extra_accessor: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | *Webqq::Message::DiscussMessage::Recv::discuss_name = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $d = $client->search_discuss($msg->{did}); | |||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | return defined $d?$d->{name}:undef ; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 141 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | *Webqq::Message::DiscussMessage::Recv::from_dname = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $d = $client->search_discuss($msg->{did}); | |||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | return defined $d?$d->{name}:undef ; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 147 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | *Webqq::Message::DiscussMessage::Recv::from_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $m = $client->search_member_in_discuss($msg->{did},$msg->{send_uin}); | |||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | return defined $m?$m->{ruin}:$client->get_qq_from_uin($msg->{send_uin}); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 153 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | *Webqq::Message::DiscussMessage::Recv::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $m = $client->search_member_in_discuss($msg->{did},$msg->{send_uin}); | |||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return defined $m?$m->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 159 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | *Webqq::Message::DiscussMessage::Send::discuss_name = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $d = $client->search_discuss($msg->{did}); | |||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | return defined $d?$d->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 166 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | *Webqq::Message::DiscussMessage::Send::to_dname = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $d = $client->search_discuss($msg->{did}); | |||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | return defined $d?$d->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 172 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | *Webqq::Message::DiscussMessage::Send::from_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 176 | 0 | return $client->{qq_param}{qq}; | |||||||||||||||||||||||||||||||||||||
| 177 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | *Webqq::Message::DiscussMessage::Send::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 179 | 0 | return "我"; | |||||||||||||||||||||||||||||||||||||
| 180 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | *Webqq::Message::GroupMessage::Recv::group_name = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $g = $client->search_group($msg->{group_code}); | |||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | return defined $g?$g->{name}:undef ; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 187 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | *Webqq::Message::GroupMessage::Recv::from_gname = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $g = $client->search_group($msg->{group_code}); | |||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | return defined $g?$g->{name}:undef ; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 193 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | *Webqq::Message::GroupMessage::Recv::from_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 197 | #my $m = $client->search_member_in_group($msg->{group_code},$msg->{send_uin}); | ||||||||||||||||||||||||||||||||||||||
| 198 | #return $m->{qq} if(defined $m and defined $m->{qq}); | ||||||||||||||||||||||||||||||||||||||
| 199 | 0 | return $client->get_qq_from_uin($msg->{send_uin}); | |||||||||||||||||||||||||||||||||||||
| 200 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | *Webqq::Message::GroupMessage::Recv::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $m = $client->search_member_in_group($msg->{group_code},$msg->{send_uin}); | |||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | return defined $m?$m->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 206 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | *Webqq::Message::GroupMessage::Recv::from_card = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $m = $client->search_member_in_group($msg->{group_code},$msg->{send_uin}); | |||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | return defined $m?$m->{card}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 212 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | *Webqq::Message::GroupMessage::Recv::from_city = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $m = $client->search_member_in_group($msg->{group_code},$msg->{send_uin}); | |||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | return defined $m?$m->{city}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 218 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | *Webqq::Message::GroupMessage::Send::group_name = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $g = $client->search_group($msg->{group_code}); | |||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | return defined $g?$g->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 225 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | *Webqq::Message::GroupMessage::Send::to_gname = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $g = $client->search_group($msg->{group_code}); | |||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | return defined $g?$g->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 231 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | *Webqq::Message::GroupMessage::Send::from_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 235 | 0 | return $client->{qq_param}{qq}; | |||||||||||||||||||||||||||||||||||||
| 236 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | *Webqq::Message::GroupMessage::Send::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 238 | 0 | return "我"; | |||||||||||||||||||||||||||||||||||||
| 239 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | *Webqq::Message::SessMessage::Recv::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | if($msg->{via} eq 'group'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $m = $client->search_member_in_group($msg->{group_code},$msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | return defined $m?$m->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||
| 249 | elsif($msg->{via} eq 'discuss'){ | ||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my $m = $client->search_member_in_discuss($msg->{did},$msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | return defined $m?$m->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||
| 253 | 0 | else{return undef} | |||||||||||||||||||||||||||||||||||||
| 254 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | *Webqq::Message::SessMessage::Recv::from_qq = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 258 | 0 | return $msg->{ruin}; | |||||||||||||||||||||||||||||||||||||
| 259 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | *Webqq::Message::SessMessage::Recv::to_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return "我"; | |||||||||||||||||||||||||||||||||||||
| 262 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | *Webqq::Message::SessMessage::Recv::to_qq = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 266 | 0 | return $client->{qq_param}{qq}; | |||||||||||||||||||||||||||||||||||||
| 267 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | *Webqq::Message::SessMessage::Recv::via_type = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 271 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 272 | return $msg->{via} eq 'group' ? "群" | ||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | : $msg->{via} eq 'discuss' ? "讨论组" | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 274 | : undef | ||||||||||||||||||||||||||||||||||||||
| 275 | ; | ||||||||||||||||||||||||||||||||||||||
| 276 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | *Webqq::Message::SessMessage::Recv::via_name = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if($msg->{via} eq 'group'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my $g = $client->search_group($msg->{group_code}); | |||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | return defined $g?$g->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||
| 284 | elsif($msg->{via} eq 'discuss'){ | ||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $d = $client->search_discuss($msg->{did}); | |||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | return defined $d?$d->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||
| 288 | 0 | else{return } | |||||||||||||||||||||||||||||||||||||
| 289 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | *Webqq::Message::SessMessage::Send::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 293 | 0 | return "我"; | |||||||||||||||||||||||||||||||||||||
| 294 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | *Webqq::Message::SessMessage::Send::from_qq = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 298 | 0 | return $client->{qq_param}{qq}; | |||||||||||||||||||||||||||||||||||||
| 299 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | *Webqq::Message::SessMessage::Send::to_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 302 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | if($msg->{via} eq 'group'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $m = $client->search_member_in_group($msg->{group_code},$msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | return defined $m?$m->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||
| 307 | elsif($msg->{via} eq 'discuss'){ | ||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $m = $client->search_member_in_discuss($msg->{did},$msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | return defined $m?$m->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||
| 311 | 0 | else{return } | |||||||||||||||||||||||||||||||||||||
| 312 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | *Webqq::Message::SessMessage::Send::to_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 315 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 316 | 0 | return $client->get_qq_from_uin($msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 317 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | *Webqq::Message::SessMessage::Send::via_name = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if($msg->{via} eq 'group'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my $g = $client->search_group($msg->{group_code}); | |||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | return defined $g?$g->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||
| 325 | elsif($msg->{via} eq 'discuss'){ | ||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $d = $client->search_discuss($msg->{did}); | |||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | return defined $d?$d->{name}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||
| 329 | 0 | else{return} | |||||||||||||||||||||||||||||||||||||
| 330 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | *Webqq::Message::SessMessage::Send::via_type = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 335 | return $msg->{via} eq 'group' ? "群" | ||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | : $msg->{via} eq 'discuss' ? "讨论组" | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 337 | : undef | ||||||||||||||||||||||||||||||||||||||
| 338 | ; | ||||||||||||||||||||||||||||||||||||||
| 339 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | *Webqq::Message::Message::Recv::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 343 | 0 | my $f = $client->search_friend($msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | return defined $f?$f->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 345 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | *Webqq::Message::Message::Recv::from_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 347 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 349 | #my $f = $client->search_friend($msg->{from_uin}); | ||||||||||||||||||||||||||||||||||||||
| 350 | #return $f->{qq} if(defined $f and defined $f->{qq}); | ||||||||||||||||||||||||||||||||||||||
| 351 | 0 | return $client->get_qq_from_uin($msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 352 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | *Webqq::Message::Message::Recv::from_markname = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $f = $client->search_friend($msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | return defined $f?$f->{markname}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 358 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | *Webqq::Message::Message::Recv::from_categories = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 362 | 0 | my $f = $client->search_friend($msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | return defined $f?$f->{categories}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 364 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | *Webqq::Message::Message::Recv::from_city = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 368 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $f = $client->search_friend($msg->{from_uin}); | |||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | return defined $f?$f->{city}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 371 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | *Webqq::Message::Message::Recv::to_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 374 | 0 | return "我"; | |||||||||||||||||||||||||||||||||||||
| 375 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | *Webqq::Message::Message::Recv::to_qq = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 379 | 0 | return $client->{qq_param}{qq}; | |||||||||||||||||||||||||||||||||||||
| 380 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | *Webqq::Message::Message::Send::from_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 384 | 0 | return "我"; | |||||||||||||||||||||||||||||||||||||
| 385 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | *Webqq::Message::Message::Send::from_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 389 | 0 | return $client->{qq_param}{qq}; | |||||||||||||||||||||||||||||||||||||
| 390 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | *Webqq::Message::Message::Send::to_nick = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 393 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $f = $client->search_friend($msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | return defined $f?$f->{nick}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 396 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | *Webqq::Message::Message::Send::to_qq = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 400 | 0 | return $client->get_qq_from_uin($msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 401 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | *Webqq::Message::Message::Send::to_markname = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $f = $client->search_friend($msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | return defined $f?$f->{markname}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 407 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | *Webqq::Message::Message::Send::to_categories = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $client = $msg->{client}; | |||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $f = $client->search_friend($msg->{to_uin}); | |||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | return defined $f?$f->{categories}:undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 413 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | sub _mk_ro_accessors { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_mk_ro_accessors: not called CC=2 SCAR=14.4
| |||||||||||||||||||||||||||||||||||||||
| 418 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 419 | 0 | my $msg =shift; | |||||||||||||||||||||||||||||||||||||
| 420 | 0 | my $msg_pkg = shift; | |||||||||||||||||||||||||||||||||||||
| 421 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 422 | 0 | for my $field (keys %$msg){ | |||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | *{"Webqq::Message::${msg_pkg}::$field"} = sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $pkg = ref $self; | |||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | die "the value of \"$field\" in $pkg is read-only\n" if @_!=0; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return $self->{$field}; | |||||||||||||||||||||||||||||||||||||
| 428 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $msg = bless $msg,"Webqq::Message::$msg_pkg"; | |||||||||||||||||||||||||||||||||||||
| 432 | 0 | return $msg; | |||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | sub parse_send_status_msg{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_send_status_msg: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 437 | 0 | my ($json_txt) = @_; | |||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $json = undef; | |||||||||||||||||||||||||||||||||||||
| 439 | 0 | eval{$json = JSON->new->utf8->decode($json_txt)}; | |||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | console "解析消息失败: $@ 对应的消息内容为: $json_txt\n" if $@ and $client->{debug}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and $client->{"debug"}
MC/DC0%0/2
$@ and $client->{"debug"}
$@
$client->{"debug"}
Truth table0%0/3
A and B
A= $@B= $client->{"debug"}
| |||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if(ref $json eq 'HASH' and $json->{retcode}==0){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $json eq "HASH" and $json->{"retcode"} == 0
MC/DC0%0/2
ref $json eq "HASH" and $json->{"retcode"} == 0
ref $json eq "HASH"
$json->{"retcode"} == 0
Truth table0%0/3
A and B
A= ref $json eq "HASH"B= $json->{"retcode"} == 0
| |||||||||||||||||||||||||||||||||||||||
| 442 | 0 | return {is_success=>1,status=>"发送成功"}; | |||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||
| 444 | else{ | ||||||||||||||||||||||||||||||||||||||
| 445 | 0 | return {is_success=>0,status=>"发送失败"}; | |||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||
| 448 | #消息的后期处理 | ||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | sub msg_put{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
msg_put: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 451 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||
| 452 | 0 | $msg->{raw_content} = []; | |||||||||||||||||||||||||||||||||||||
| 453 | 0 | my $msg_content; | |||||||||||||||||||||||||||||||||||||
| 454 | 0 | shift @{ $msg->{content} }; | |||||||||||||||||||||||||||||||||||||
| 455 | 0 | for my $c (@{ $msg->{content} }){ | |||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if(ref $c eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if($c->[0] eq 'cface'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||
| 458 | 0 | push @{$msg->{raw_content}},{ | |||||||||||||||||||||||||||||||||||||
| 459 | type => 'cface', | ||||||||||||||||||||||||||||||||||||||
| 460 | content => '[图片]', | ||||||||||||||||||||||||||||||||||||||
| 461 | name => $c->[1]{name}, | ||||||||||||||||||||||||||||||||||||||
| 462 | file_id => $c->[1]{file_id}, | ||||||||||||||||||||||||||||||||||||||
| 463 | key => $c->[1]{key}, | ||||||||||||||||||||||||||||||||||||||
| 464 | server => $c->[1]{server}, | ||||||||||||||||||||||||||||||||||||||
| 465 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 466 | 0 | $c="[图片]"; | |||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||
| 468 | elsif($c->[0] eq 'offpic'){ | ||||||||||||||||||||||||||||||||||||||
| 469 | 0 | push @{$msg->{raw_content}},{ | |||||||||||||||||||||||||||||||||||||
| 470 | type => 'offpic', | ||||||||||||||||||||||||||||||||||||||
| 471 | content => '[图片]', | ||||||||||||||||||||||||||||||||||||||
| 472 | file_path => $c->[1]{file_path}, | ||||||||||||||||||||||||||||||||||||||
| 473 | 0 | }; | |||||||||||||||||||||||||||||||||||||
| 474 | 0 | $c="[图片]"; | |||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||
| 476 | elsif($c->[0] eq 'face'){ | ||||||||||||||||||||||||||||||||||||||
| 477 | 0 | push @{$msg->{raw_content}},{ | |||||||||||||||||||||||||||||||||||||
| 478 | type => 'face', | ||||||||||||||||||||||||||||||||||||||
| 479 | content => face_to_txt($c), | ||||||||||||||||||||||||||||||||||||||
| 480 | id => $c->[1], | ||||||||||||||||||||||||||||||||||||||
| 481 | }; | ||||||||||||||||||||||||||||||||||||||
| 482 | 0 | $c=face_to_txt($c); | |||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||
| 484 | else{ | ||||||||||||||||||||||||||||||||||||||
| 485 | 0 | push @{$msg->{raw_content}},{ | |||||||||||||||||||||||||||||||||||||
| 486 | type => 'unknown', | ||||||||||||||||||||||||||||||||||||||
| 487 | content => '[未识别内容]', | ||||||||||||||||||||||||||||||||||||||
| 488 | }; | ||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $c = "[未识别内容]"; | |||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||
| 492 | elsif($c eq " "){ | ||||||||||||||||||||||||||||||||||||||
| 493 | 0 | next; | |||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||
| 495 | else{ | ||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $c=encode("utf8",$c); | |||||||||||||||||||||||||||||||||||||
| 497 | 0 | $c=~s/ $//; | |||||||||||||||||||||||||||||||||||||
| 498 | 0 | $c=~s/\r|\n/\n/g; | |||||||||||||||||||||||||||||||||||||
| 499 | #{"retcode":0,"result":[{"poll_type":"group_message","value":{"msg_id":538,"from_uin":2859929324,"to_uin":3072574066,"msg_id2":545490,"msg_type":43,"reply_ip":182424361,"group_code":2904892801,"send_uin":1951767953,"seq":3024,"time":1418955773,"info_seq":390179723,"content":[["font",{"size":12,"color":"000000","style":[0,0,0],"name":"\u5FAE\u8F6F\u96C5\u9ED1"}],"[\u50BB\u7B11]\u0001 "]}}]} | ||||||||||||||||||||||||||||||||||||||
| 500 | #if($c=~/\[[^\[\]]+?\]\x{01}/) | ||||||||||||||||||||||||||||||||||||||
| 501 | 0 | push @{$msg->{raw_content}},{ | |||||||||||||||||||||||||||||||||||||
| 502 | type => 'txt', | ||||||||||||||||||||||||||||||||||||||
| 503 | content => $c, | ||||||||||||||||||||||||||||||||||||||
| 504 | }; | ||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $msg_content .= $c; | |||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||
| 508 | 0 | $msg->{content} = $msg_content; | |||||||||||||||||||||||||||||||||||||
| 509 | 0 | $msg->{client} = $client; | |||||||||||||||||||||||||||||||||||||
| 510 | #将整个hash从unicode转为UTF8编码 | ||||||||||||||||||||||||||||||||||||||
| 511 | #$msg->{$_} = encode("utf8",$msg->{$_} ) for grep {$_ ne 'raw_content'} keys %$msg; | ||||||||||||||||||||||||||||||||||||||
| 512 | #$msg->{content}=~s/\r|\n/\n/g; | ||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if($msg->{content}=~/\(\d+\) 被管理员禁言\d+(分钟|小时|天)$/ or $msg->{content}=~/\(\d+\) 被管理员解除禁言$/){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\347\246\201\350\250\200\d+(\345\210\206\351\222\237|\345\260\217\346\227\266|\345\244\251)$/ or $msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\350\247\243\351\231\244\347\246\201\350\250\200$/
MC/DC0%0/2
$msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\347\246\201\350\250\200\d+(\345\210\206\351\222\237|\345\260\217\346\227\266|\345\244\251)$/ or $msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\350\247\243\351\231\244\347\246\201\350\250\200$/
$msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\347\246\201\350\250\200\d+(\345\210\206\351\222\237|\345\260\217\346\227\266|\345\244\251)$/
$msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\350\247\243\351\231\244\347\246\201\350\250\200$/
Truth table0%0/3
A or B
A= $msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\347\246\201\350\250\200\d+(\345\210\206\351\222\237|\345\260\217\346\227\266|\345\244\251)$/B= $msg->{"content"} =~ /\(\d+\) \350\242\253\347\256\241\347\220\206\345\221\230\350\247\243\351\231\244\347\246\201\350\250\200$/
| |||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $msg->{type} = "sys_g_msg"; | |||||||||||||||||||||||||||||||||||||
| 515 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||
| 517 | 0 | my $msg_pkg = "\u$msg->{type}::Recv"; $msg_pkg=~s/_(.)/\u$1/g; | |||||||||||||||||||||||||||||||||||||
| 518 | 0 | $msg = $client->_mk_ro_accessors($msg,$msg_pkg) ; | |||||||||||||||||||||||||||||||||||||
| 519 | 0 | $client->{receive_message_queue}->put($msg); | |||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub parse_receive_msg{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_receive_msg: not called CC=25 SCAR=64.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my $client = shift; | |||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | return if $client->{is_stop} ; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my ($json_txt) = @_; | |||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $json = undef; | |||||||||||||||||||||||||||||||||||||
| 527 | 0 | eval{$json = JSON->new->utf8->decode($json_txt)}; | |||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | console "解析消息失败: $@ 对应的消息内容为: $json_txt\n" if $@ and $client->{debug}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and $client->{"debug"}
MC/DC0%0/2
$@ and $client->{"debug"}
$@
$client->{"debug"}
Truth table0%0/3
A and B
A= $@B= $client->{"debug"}
| |||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | if($json){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 530 | #一个普通的消息 | ||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | if($json->{retcode}==0){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $client->{poll_failure_count} = 0; | |||||||||||||||||||||||||||||||||||||
| 533 | 0 | for my $m (@{ $json->{result} }){ | |||||||||||||||||||||||||||||||||||||
| 534 | #收到群临时消息 | ||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | if($m->{poll_type} eq 'sess_message'){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||
| 536 | my $msg = { | ||||||||||||||||||||||||||||||||||||||
| 537 | type => 'sess_message', | ||||||||||||||||||||||||||||||||||||||
| 538 | msg_id => $m->{value}{msg_id}, | ||||||||||||||||||||||||||||||||||||||
| 539 | from_uin => $m->{value}{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 540 | to_uin => $m->{value}{to_uin}, | ||||||||||||||||||||||||||||||||||||||
| 541 | msg_time => $m->{value}{'time'}, | ||||||||||||||||||||||||||||||||||||||
| 542 | content => $m->{value}{content}, | ||||||||||||||||||||||||||||||||||||||
| 543 | service_type=> $m->{value}{service_type}, | ||||||||||||||||||||||||||||||||||||||
| 544 | ruin => $m->{value}{ruin}, | ||||||||||||||||||||||||||||||||||||||
| 545 | 0 | msg_class => "recv", | |||||||||||||||||||||||||||||||||||||
| 546 | ttl => 5, | ||||||||||||||||||||||||||||||||||||||
| 547 | allow_plugin => 1, | ||||||||||||||||||||||||||||||||||||||
| 548 | }; | ||||||||||||||||||||||||||||||||||||||
| 549 | #service_type =0 表示群临时消息,1 表示讨论组临时消息 | ||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | if($m->{value}{service_type} == 0){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $msg->{gid} = $m->{value}{id}; | |||||||||||||||||||||||||||||||||||||
| 552 | $msg->{group_code} = $client->get_group_code_from_gid($m->{value}{id}), | ||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $msg->{via} = 'group'; | |||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||
| 555 | elsif($m->{value}{service_type} == 1){ | ||||||||||||||||||||||||||||||||||||||
| 556 | 0 | $msg->{did} = $m->{value}{id}; | |||||||||||||||||||||||||||||||||||||
| 557 | 0 | $msg->{via} = 'discuss'; | |||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||
| 559 | 0 | else{return} | |||||||||||||||||||||||||||||||||||||
| 560 | 0 | $client->msg_put($msg); | |||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||
| 562 | #收到的消息是普通消息 | ||||||||||||||||||||||||||||||||||||||
| 563 | elsif($m->{poll_type} eq 'message'){ | ||||||||||||||||||||||||||||||||||||||
| 564 | my $msg = { | ||||||||||||||||||||||||||||||||||||||
| 565 | type => 'message', | ||||||||||||||||||||||||||||||||||||||
| 566 | msg_id => $m->{value}{msg_id}, | ||||||||||||||||||||||||||||||||||||||
| 567 | from_uin => $m->{value}{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 568 | to_uin => $m->{value}{to_uin}, | ||||||||||||||||||||||||||||||||||||||
| 569 | msg_time => $m->{value}{'time'}, | ||||||||||||||||||||||||||||||||||||||
| 570 | content => $m->{value}{content}, | ||||||||||||||||||||||||||||||||||||||
| 571 | 0 | msg_class => "recv", | |||||||||||||||||||||||||||||||||||||
| 572 | ttl => 5, | ||||||||||||||||||||||||||||||||||||||
| 573 | allow_plugin => 1, | ||||||||||||||||||||||||||||||||||||||
| 574 | }; | ||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $client->msg_put($msg); | |||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||
| 577 | #收到的消息是群消息 | ||||||||||||||||||||||||||||||||||||||
| 578 | elsif($m->{poll_type} eq 'group_message'){ | ||||||||||||||||||||||||||||||||||||||
| 579 | my $msg = { | ||||||||||||||||||||||||||||||||||||||
| 580 | type => 'group_message', | ||||||||||||||||||||||||||||||||||||||
| 581 | msg_id => $m->{value}{msg_id}, | ||||||||||||||||||||||||||||||||||||||
| 582 | from_uin => $m->{value}{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 583 | to_uin => $m->{value}{to_uin}, | ||||||||||||||||||||||||||||||||||||||
| 584 | msg_time => $m->{value}{'time'}, | ||||||||||||||||||||||||||||||||||||||
| 585 | content => $m->{value}{content}, | ||||||||||||||||||||||||||||||||||||||
| 586 | send_uin => $m->{value}{send_uin}, | ||||||||||||||||||||||||||||||||||||||
| 587 | group_code => $m->{value}{group_code}, | ||||||||||||||||||||||||||||||||||||||
| 588 | 0 | msg_class => "recv", | |||||||||||||||||||||||||||||||||||||
| 589 | ttl => 5, | ||||||||||||||||||||||||||||||||||||||
| 590 | allow_plugin => 1, | ||||||||||||||||||||||||||||||||||||||
| 591 | }; | ||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $client->msg_put($msg); | |||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||
| 594 | #收到讨论组消息 | ||||||||||||||||||||||||||||||||||||||
| 595 | elsif($m->{poll_type} eq 'discu_message'){ | ||||||||||||||||||||||||||||||||||||||
| 596 | my $msg = { | ||||||||||||||||||||||||||||||||||||||
| 597 | type => 'discuss_message', | ||||||||||||||||||||||||||||||||||||||
| 598 | did => $m->{value}{did}, | ||||||||||||||||||||||||||||||||||||||
| 599 | from_uin => $m->{value}{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 600 | msg_id => $m->{value}{msg_id}, | ||||||||||||||||||||||||||||||||||||||
| 601 | send_uin => $m->{value}{send_uin}, | ||||||||||||||||||||||||||||||||||||||
| 602 | msg_time => $m->{value}{'time'}, | ||||||||||||||||||||||||||||||||||||||
| 603 | to_uin => $m->{value}{'to_uin'}, | ||||||||||||||||||||||||||||||||||||||
| 604 | content => $m->{value}{content}, | ||||||||||||||||||||||||||||||||||||||
| 605 | 0 | msg_class => "recv", | |||||||||||||||||||||||||||||||||||||
| 606 | ttl => 5, | ||||||||||||||||||||||||||||||||||||||
| 607 | allow_plugin => 1, | ||||||||||||||||||||||||||||||||||||||
| 608 | }; | ||||||||||||||||||||||||||||||||||||||
| 609 | 0 | $client->msg_put($msg); | |||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||
| 611 | elsif($m->{poll_type} eq 'buddies_status_change'){ | ||||||||||||||||||||||||||||||||||||||
| 612 | my $msg = { | ||||||||||||||||||||||||||||||||||||||
| 613 | type => 'buddies_status_change', | ||||||||||||||||||||||||||||||||||||||
| 614 | uin => $m->{value}{uin}, | ||||||||||||||||||||||||||||||||||||||
| 615 | state => $m->{value}{status}, | ||||||||||||||||||||||||||||||||||||||
| 616 | 0 | client_type => code2client($m->{value}{client_type}), | |||||||||||||||||||||||||||||||||||||
| 617 | }; | ||||||||||||||||||||||||||||||||||||||
| 618 | 0 | $client->msg_put($msg); | |||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||
| 620 | #收到系统消息 | ||||||||||||||||||||||||||||||||||||||
| 621 | elsif($m->{poll_type} eq 'sys_g_msg'){ | ||||||||||||||||||||||||||||||||||||||
| 622 | #my $msg = { | ||||||||||||||||||||||||||||||||||||||
| 623 | # type => 'sys_g_msg', | ||||||||||||||||||||||||||||||||||||||
| 624 | # msg_id => $m->{value}{msg_id}, | ||||||||||||||||||||||||||||||||||||||
| 625 | # from_uin => $m->{value}{from_uin}, | ||||||||||||||||||||||||||||||||||||||
| 626 | # to_uin => $m->{value}{to_uin}, | ||||||||||||||||||||||||||||||||||||||
| 627 | # | ||||||||||||||||||||||||||||||||||||||
| 628 | #}; | ||||||||||||||||||||||||||||||||||||||
| 629 | #$client->msg_put($msg); | ||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||
| 631 | #收到强制下线消息 | ||||||||||||||||||||||||||||||||||||||
| 632 | elsif($m->{poll_type} eq 'kick_message'){ | ||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | if($m->{value}{show_reason} ==1){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $reason = encode("utf8",$m->{value}{reason}); | |||||||||||||||||||||||||||||||||||||
| 635 | 0 | console "$reason\n"; | |||||||||||||||||||||||||||||||||||||
| 636 | 0 | $client->stop(); | |||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||
| 638 | 0 | else {console "您已被迫下线\n";$client->stop(); } | |||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||
| 640 | #还未识别和处理的消息 | ||||||||||||||||||||||||||||||||||||||
| 641 | else{ | ||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||
| 646 | #可以忽略的消息,暂时不做任何处理 | ||||||||||||||||||||||||||||||||||||||
| 647 | ▶ | elsif($json->{retcode} == 102 or $json->{retcode} == 109 or $json->{retcode} == 110 ){ | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$json->{"retcode"} == 102 or $json->{"retcode"} == 109 or $json->{"retcode"} == 110
$json->{"retcode"} == 102 or $json->{"retcode"} == 109
MC/DC0%0/3
$json->{"retcode"} == 102 or $json->{"retcode"} == 109 or $json->{"retcode"} == 110
$json->{"retcode"} == 102
$json->{"retcode"} == 109
$json->{"retcode"} == 110
Truth table0%0/4
A or B or C
A= $json->{"retcode"} == 102B= $json->{"retcode"} == 109C= $json->{"retcode"} == 110
| |||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $client->{poll_failure_count} = 0; | |||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||
| 650 | #更新客户端ptwebqq值 | ||||||||||||||||||||||||||||||||||||||
| 651 | elsif($json->{retcode} == 116){ | ||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $client->{qq_param}{ptwebqq} = $json->{p}; | |||||||||||||||||||||||||||||||||||||
| 653 | 0 | $client->{cookie_jar}->set_cookie(0,"ptwebqq",$json->{p},"/","qq.com",); | |||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||
| 655 | #未重新登录 | ||||||||||||||||||||||||||||||||||||||
| 656 | elsif($json->{retcode} ==100){ | ||||||||||||||||||||||||||||||||||||||
| 657 | 0 | console "因网络或其他原因与服务器失去联系,客户端需要重新登录...\n"; | |||||||||||||||||||||||||||||||||||||
| 658 | 0 | $client->relogin(); | |||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||
| 660 | #重新连接失败 | ||||||||||||||||||||||||||||||||||||||
| 661 | ▶ | elsif($json->{retcode} ==120 or $json->{retcode} ==121 ){ | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$json->{"retcode"} == 120 or $json->{"retcode"} == 121
MC/DC0%0/2
$json->{"retcode"} == 120 or $json->{"retcode"} == 121
$json->{"retcode"} == 120
$json->{"retcode"} == 121
Truth table0%0/3
A or B
A= $json->{"retcode"} == 120B= $json->{"retcode"} == 121
| |||||||||||||||||||||||||||||||||||||||
| 662 | 0 | console "因网络或其他原因与服务器失去联系,客户端需要重新连接...\n"; | |||||||||||||||||||||||||||||||||||||
| 663 | 0 | $client->_relink(); | |||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||
| 665 | #其他未知消息 | ||||||||||||||||||||||||||||||||||||||
| 666 | else{ | ||||||||||||||||||||||||||||||||||||||
| 667 | 0 | $client->{poll_failure_count}++; | |||||||||||||||||||||||||||||||||||||
| 668 | 0 | console "获取消息失败,当前失败次数: $client->{poll_failure_count}\n"; | |||||||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | if($client->{poll_failure_count} > $client->{poll_failure_count_max}){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 670 | 0 | console "接收消息失败次数超过最大值,尝试进行重新连接...\n"; | |||||||||||||||||||||||||||||||||||||
| 671 | 0 | $client->{poll_failure_count} = 0; | |||||||||||||||||||||||||||||||||||||
| 672 | 0 | $client->_relink(); | |||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||
| 677 | 1 | 1; | |||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||