| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::IPMessenger::ToStdoutEventHandler; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3009
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
5
|
1
|
|
|
1
|
|
1223
|
use Encode qw( from_to ); |
|
|
1
|
|
|
|
|
17180
|
|
|
|
1
|
|
|
|
|
201
|
|
|
6
|
1
|
|
|
1
|
|
11
|
use IO::Socket; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
11
|
|
|
7
|
1
|
|
|
1
|
|
1127
|
use POSIX; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
11
|
|
|
8
|
1
|
|
|
1
|
|
5135
|
use Term::ANSIColor qw(:constants); |
|
|
1
|
|
|
|
|
11170
|
|
|
|
1
|
|
|
|
|
1235
|
|
|
9
|
|
|
|
|
|
|
$Term::ANSIColor::AUTORESET = 1; |
|
10
|
1
|
|
|
1
|
|
13
|
use base qw( Net::IPMessenger::EventHandler ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
636
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub output { |
|
13
|
0
|
|
|
0
|
1
|
|
my $str = shift; |
|
14
|
0
|
|
|
|
|
|
from_to($str, 'shiftjis', 'euc-jp'); |
|
15
|
0
|
|
|
|
|
|
my $time = strftime("%Y-%m-%d %H:%M:%S", localtime); |
|
16
|
0
|
|
|
|
|
|
print YELLOW "At \"$time\", " . $str; |
|
17
|
0
|
|
|
|
|
|
print RESET "\n"; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub debug { |
|
21
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
22
|
0
|
|
|
|
|
|
my $them = shift; |
|
23
|
0
|
|
|
|
|
|
my $user = shift; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $peeraddr = inet_ntoa( $them->socket->peeraddr ); |
|
26
|
0
|
|
|
|
|
|
my $peerport = $them->socket->peerport; |
|
27
|
0
|
|
|
|
|
|
my $command = $them->messagecommand( $user->command ); |
|
28
|
0
|
|
|
|
|
|
my $modename = $command->modename; |
|
29
|
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
print CYAN "Received $modename from [$peeraddr:$peerport]"; |
|
31
|
0
|
|
|
|
|
|
print RESET "\n"; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub BR_ENTRY { |
|
35
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
36
|
0
|
|
|
|
|
|
my $them = shift; |
|
37
|
0
|
|
|
|
|
|
my $user = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
output($user->nickname . " joined."); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub BR_EXIT { |
|
43
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
44
|
0
|
|
|
|
|
|
my $them = shift; |
|
45
|
0
|
|
|
|
|
|
my $user = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
output($user->nickname . " left."); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub SENDMSG { |
|
51
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
52
|
0
|
|
|
|
|
|
my $them = shift; |
|
53
|
0
|
|
|
|
|
|
my $user = shift; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
output("you got message from " . $user->nickname . " .\a"); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
|
59
|
|
|
|
|
|
|
__END__ |