| 1 | package Mojo::Weixin::Friend; | ||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Mojo::Weixin::Base 'Mojo::Weixin::Model::Base'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 1 | has name => ''; | |||||||||||||||||||||||||||||||||||||
| 5 | 1 | has [qw( | |||||||||||||||||||||||||||||||||||||
| 6 | account | ||||||||||||||||||||||||||||||||||||||
| 7 | province | ||||||||||||||||||||||||||||||||||||||
| 8 | city | ||||||||||||||||||||||||||||||||||||||
| 9 | sex | ||||||||||||||||||||||||||||||||||||||
| 10 | id | ||||||||||||||||||||||||||||||||||||||
| 11 | uid | ||||||||||||||||||||||||||||||||||||||
| 12 | signature | ||||||||||||||||||||||||||||||||||||||
| 13 | display | ||||||||||||||||||||||||||||||||||||||
| 14 | markname | ||||||||||||||||||||||||||||||||||||||
| 15 | _avatar | ||||||||||||||||||||||||||||||||||||||
| 16 | _verifyflag | ||||||||||||||||||||||||||||||||||||||
| 17 | )]; | ||||||||||||||||||||||||||||||||||||||
| 18 | 1 | has 'category' => '好友'; #系统帐号|公众号|好友 | |||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||
| 20 | 1 | my %special_id = map {$_=>undef} ("filehelper","fmessage","newsapp","weibo", "qqmail", "tmessage", "qmessage", "qqsync", "floatbottle", "lbsapp", "shakeapp", "medianote", "qqfriend", "readerapp", "blogapp", "facebookapp", "masssendapp", "meishiapp", "feedsapp", "voip", "blogappweixin", "brandsessionholder", "weixinreminder", "wxid_novlwrv3lqwv11", "gh_22b87fa7cb3c", "officialaccounts", "notification_messages"); | |||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 24 | 0 | $self = $self->Mojo::Weixin::Base::new(@_); | |||||||||||||||||||||||||||||||||||||
| 25 | 0 | $self->client->emoji_convert(\$self->{name},$self->client->emoji_to_text); | |||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->client->emoji_convert(\$self->{display},$self->client->emoji_to_text); | |||||||||||||||||||||||||||||||||||||
| 27 | 0 | $self->client->emoji_convert(\$self->{markname},$self->client->emoji_to_text); | |||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | if(exists $special_id{$self->id}){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $self->category("系统帐号"); | |||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||
| 31 | ▶ | elsif(defined $self->_verifyflag and $self->_verifyflag & 8){ | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $self->_verifyflag and $self->_verifyflag & 8
MC/DC0%0/2
defined $self->_verifyflag and $self->_verifyflag & 8
defined $self->_verifyflag
$self->_verifyflag & 8
Truth table0%0/3
A and B
A= defined $self->_verifyflagB= $self->_verifyflag & 8
| |||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $self->category("公众号"); | |||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||
| 34 | 0 | else{$self->category("好友");} | |||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | $self->uid("") if not $self->uid; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $self; | |||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub get_avatar{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_avatar: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 40 | 0 | $self->client->get_avatar($self,@_); | |||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub displayname{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
displayname: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | return $self->display || $self->markname || $self->name || '昵称未知'; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$self->display || $self->markname || $self->name || "\346\230\265\347\247\260\346\234\252\347\237\245"
$self->display or $self->markname or $self->name
$self->display or $self->markname
MC/DC0%0/3
$self->display || $self->markname || $self->name || "\346\230\265\347\247\260\346\234\252\347\237\245"
$self->display
$self->markname
$self->name
Truth table0%0/4
A or B or C
A= $self->displayB= $self->marknameC= $self->name
| |||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub update{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $hash = shift; | |||||||||||||||||||||||||||||||||||||
| 51 | 0 | for(grep {substr($_,0,1) ne "_"} keys %$hash){ | |||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if(exists $hash->{$_}){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $self->client->emoji_convert(\$hash->{$_},$self->client->emoji_to_text) if $_ eq "name"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $self->client->emoji_convert(\$hash->{$_},$self->client->emoji_to_text) if $_ eq "display"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | $self->client->emoji_convert(\$hash->{$_},$self->client->emoji_to_text) if $_ eq "markname"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if(defined $hash->{$_} and defined $self->{$_}){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $hash->{$_} and defined $self->{$_}
MC/DC0%0/2
defined $hash->{$_} and defined $self->{$_}
defined $hash->{$_}
defined $self->{$_}
Truth table0%0/3
A and B
A= defined $hash->{$_}B= defined $self->{$_}
| |||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | if($hash->{$_} ne $self->{$_}){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $old_property = $self->{$_}; | |||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $new_property = $hash->{$_}; | |||||||||||||||||||||||||||||||||||||
| 60 | 0 | $self->{$_} = $hash->{$_}; | |||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | $self->client->emit("friend_property_change"=>$self,$_,$old_property,$new_property) if defined $self->client; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||
| 64 | ▶ | elsif( ! (!defined $hash->{$_} and !defined $self->{$_}) ){ | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $hash->{$_} || defined $self->{$_}
MC/DC0%0/2
defined $hash->{$_} || defined $self->{$_}
defined $hash->{$_}
defined $self->{$_}
Truth table0%0/3
A || B
A= defined $hash->{$_}B= defined $self->{$_}
| |||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $old_property = $self->{$_}; | |||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $new_property = $hash->{$_}; | |||||||||||||||||||||||||||||||||||||
| 67 | 0 | $self->{$_} = $hash->{$_}; | |||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | $self->client->emit("friend_property_change"=>$self,$_,$old_property,$new_property) if defined $self->client; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self; | |||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub send{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
send: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 78 | 0 | $self->client->send_message($self,@_); | |||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub send_media{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
send_media: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 82 | 0 | $self->client->send_media($self,@_); | |||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub set_markname { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
set_markname: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 86 | 0 | $self->client->set_markname($self,@_); | |||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub stick{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
stick: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 90 | 0 | $self->client->stick($self,@_); | |||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||
| 92 | 1 | 1; | |||||||||||||||||||||||||||||||||||||