line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::IPMessenger::ClientData; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
68
|
|
5
|
2
|
|
|
2
|
|
1803
|
use POSIX; |
|
2
|
|
|
|
|
30364
|
|
|
2
|
|
|
|
|
18
|
|
6
|
2
|
|
|
2
|
|
10056
|
use Net::IPMessenger::MessageCommand; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
78
|
|
7
|
2
|
|
|
2
|
|
16
|
use base qw( Class::Accessor::Fast ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
2082
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( |
10
|
|
|
|
|
|
|
qw( |
11
|
|
|
|
|
|
|
version packet_num user host |
12
|
|
|
|
|
|
|
command option nick group |
13
|
|
|
|
|
|
|
peeraddr peerport listaddr time |
14
|
|
|
|
|
|
|
pubkey encrypt attach |
15
|
|
|
|
|
|
|
) |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $NO_NAME = '(noname)'; |
19
|
|
|
|
|
|
|
my $NO_GROUP = '(nogroup)'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
4
|
|
|
4
|
1
|
6
|
my $class = shift; |
23
|
4
|
|
|
|
|
24
|
my %args = @_; |
24
|
|
|
|
|
|
|
|
25
|
4
|
|
|
|
|
9
|
my $self = {}; |
26
|
4
|
|
|
|
|
15
|
bless $self, $class; |
27
|
|
|
|
|
|
|
|
28
|
4
|
50
|
|
|
|
20
|
$self->version( $args{Ver} ) if $args{Ver}; |
29
|
4
|
50
|
|
|
|
16
|
$self->packet_num( $args{PacketNum} ) if $args{PacketNum}; |
30
|
4
|
50
|
|
|
|
28
|
$self->user( $args{User} ) if $args{User}; |
31
|
4
|
50
|
|
|
|
12
|
$self->host( $args{Host} ) if $args{Host}; |
32
|
4
|
50
|
|
|
|
11
|
$self->command( $args{Command} ) if $args{Command}; |
33
|
4
|
50
|
|
|
|
17
|
$self->nick( $args{Nick} ) if $args{Nick}; |
34
|
4
|
50
|
|
|
|
11
|
$self->group( $args{Group} ) if $args{Group}; |
35
|
4
|
50
|
|
|
|
24
|
$self->peeraddr( $args{PeerAddr} ) if $args{PeerAddr}; |
36
|
4
|
50
|
|
|
|
59
|
$self->peerport( $args{PeerPort} ) if $args{PeerPort}; |
37
|
4
|
50
|
|
|
|
29
|
$self->listaddr( $args{ListAddr} ) if $args{ListAddr}; |
38
|
4
|
|
|
|
|
1237
|
$self->time( strftime "%Y-%m-%d %H:%M:%S", localtime(time) ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# some clients set "BS" in the GROUP so deletes it |
41
|
4
|
50
|
33
|
|
|
40
|
if ( $self->group and $self->group eq "\x08" ) { |
42
|
0
|
|
|
|
|
0
|
$self->group($NO_GROUP); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
4
|
50
|
|
|
|
107
|
if ( exists $args{Message} ) { |
46
|
4
|
|
|
|
|
16
|
$self->parse( $args{Message} ); |
47
|
|
|
|
|
|
|
} |
48
|
4
|
|
|
|
|
106
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub parse { |
52
|
4
|
|
|
4
|
1
|
378
|
my $self = shift; |
53
|
4
|
|
|
|
|
8
|
my $message = shift; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
158
|
my( $ver, $packet_num, $user, $host, $command, $option ) = |
56
|
|
|
|
|
|
|
split /:/, $message, 6; |
57
|
|
|
|
|
|
|
|
58
|
4
|
|
|
|
|
18
|
$self->version($ver); |
59
|
4
|
|
|
|
|
37
|
$self->packet_num($packet_num); |
60
|
4
|
|
|
|
|
39
|
$self->user($user); |
61
|
4
|
|
|
|
|
31
|
$self->host($host); |
62
|
4
|
|
|
|
|
34
|
$self->command($command); |
63
|
4
|
|
|
|
|
115
|
$self->option($option); |
64
|
4
|
|
|
|
|
574
|
$self->time( strftime "%Y-%m-%d %H:%M:%S", localtime(time) ); |
65
|
4
|
|
|
|
|
35
|
$self->update_nickname; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub update_nickname { |
69
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
13
|
my $command = Net::IPMessenger::MessageCommand->new( $self->command ); |
72
|
4
|
|
|
|
|
18
|
my $modename = $command->modename; |
73
|
4
|
100
|
100
|
|
|
40
|
if ( $modename eq 'BR_ENTRY' or $modename eq 'ANSENTRY' ) { |
74
|
2
|
|
|
|
|
7
|
my( $nick, $group ) = ( $self->option =~ /(.*?)\0(.*?)\0/o ); |
75
|
|
|
|
|
|
|
|
76
|
2
|
50
|
|
|
|
29
|
$self->nick($nick) if defined $nick; |
77
|
2
|
50
|
|
|
|
18
|
$self->group($group) if defined $group; |
78
|
2
|
|
|
|
|
26
|
$self->encrypt( $command->get_encrypt ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Accessors |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub nickname { |
85
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
86
|
0
|
|
0
|
|
|
0
|
return sprintf "%s\@%s", $self->nick || $self->user || $NO_NAME, |
|
|
|
0
|
|
|
|
|
87
|
|
|
|
|
|
|
$self->group || $self->host || $NO_GROUP; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub key { |
91
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
92
|
4
|
|
|
|
|
16
|
return sprintf "%s\@%s:%s", $self->user, $self->peeraddr, $self->peerport; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
1
|
1
|
1397
|
sub get_message { shift->option; } |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
__END__ |