line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Webqq::Discuss::Member; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
8
|
use Mojo::Webqq::Base 'Mojo::Webqq::Model::Base'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
has [qw( |
5
|
|
|
|
|
|
|
name |
6
|
|
|
|
|
|
|
id |
7
|
|
|
|
|
|
|
state |
8
|
|
|
|
|
|
|
client_type |
9
|
|
|
|
|
|
|
_discuss_id |
10
|
|
|
|
|
|
|
_flag |
11
|
|
|
|
|
|
|
)]; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has uid => sub{ |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
return $self->{uid} if defined $self->{uid}; |
16
|
|
|
|
|
|
|
return $self->client->get_qq_from_id($self->id); |
17
|
|
|
|
|
|
|
}; |
18
|
0
|
|
|
0
|
0
|
|
sub qq {$_[0]->uid} |
19
|
0
|
|
|
0
|
0
|
|
sub nick {$_[0]->name} |
20
|
|
|
|
|
|
|
sub AUTOLOAD { |
21
|
0
|
|
|
0
|
|
|
my $self = shift; |
22
|
0
|
0
|
|
|
|
|
if($Mojo::Webqq::Discuss::Member::AUTOLOAD =~ /.*::d(.*)/){ |
23
|
0
|
|
|
|
|
|
my $attr = $1; |
24
|
0
|
|
|
|
|
|
$self->group->$attr(@_); |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
|
else{die("undefined subroutine $Mojo::Webqq::Discuss::Member::AUTOLOAD");} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
sub displayname { |
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my $f = $self->client->search_friend(id=>$self->id); |
31
|
0
|
0
|
|
|
|
|
if(defined $f){ |
32
|
0
|
|
0
|
|
|
|
return $f->markname // $self->name; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else{ |
35
|
0
|
|
|
|
|
|
return $self->name; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
sub update{ |
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
40
|
0
|
|
|
|
|
|
my $hash = shift; |
41
|
0
|
|
|
|
|
|
for(grep {substr($_,0,1) ne "_"} keys %$hash){ |
|
0
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if(exists $hash->{$_}){ |
43
|
0
|
0
|
0
|
|
|
|
if(defined $hash->{$_} and defined $self->{$_}){ |
|
|
0
|
0
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if($hash->{$_} ne $self->{$_}){ |
45
|
0
|
|
|
|
|
|
my $old_property = $self->{$_}; |
46
|
0
|
|
|
|
|
|
my $new_property = $hash->{$_}; |
47
|
0
|
|
|
|
|
|
$self->{$_} = $hash->{$_}; |
48
|
0
|
|
|
|
|
|
$self->client->emit("discuss_member_property_change"=>$self,$_,$old_property,$new_property); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
elsif( ! (!defined $hash->{$_} and !defined $self->{$_}) ){ |
52
|
0
|
|
|
|
|
|
my $old_property = $self->{$_}; |
53
|
0
|
|
|
|
|
|
my $new_property = $hash->{$_}; |
54
|
0
|
|
|
|
|
|
$self->{$_} = $hash->{$_}; |
55
|
0
|
|
|
|
|
|
$self->client->emit("discuss_member_property_change"=>$self,$_,$old_property,$new_property); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
$self; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub send { |
63
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
64
|
0
|
|
|
|
|
|
$self->client->send_sess_message($self,@_); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub discuss { |
68
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
return scalar $self->client->search_discuss(id=>$self->_discuss_id); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |