line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright 2005, Karl Y. Pradene All rights reserved. |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Net::IRC2::Event ; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
28
|
use strict; use warnings ; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
5
|
use Exporter ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
94
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw( Exporter ) ; |
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( new ) ; |
12
|
|
|
|
|
|
|
our @Export = qw( new ) ; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION ) ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
325
|
|
15
|
|
|
|
|
|
|
$VERSION = '0.27' ; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
0
|
|
|
sub new { shift and return bless { @_, 'timestamp'=>time } } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub dump { |
20
|
0
|
|
|
0
|
|
|
my $self = shift ; |
21
|
0
|
0
|
|
|
|
|
print "------------\n" . |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
22
|
|
|
|
|
|
|
' Time : ' . $self->time . "\n" . |
23
|
|
|
|
|
|
|
' Orig : ' . $self->orig . |
24
|
|
|
|
|
|
|
( ( $self->prefix ) ? ' Prefix : ' . $self->prefix . "\n" : '' ) . |
25
|
|
|
|
|
|
|
' Command : ' . $self->command . "\n" . |
26
|
|
|
|
|
|
|
( ( $self->middle ) ? ' Middle : ' . $self->middle . "\n" : '' ) . |
27
|
|
|
|
|
|
|
( ( $self->trailing ) ? ' Trailing : ' . $self->trailing . "\n" : '' ) . |
28
|
|
|
|
|
|
|
( ( $self->servername ) ? ' Server : ' . $self->servername . "\n" : '' ) . |
29
|
|
|
|
|
|
|
( ( $self->nick ) ? ' Nick : ' . $self->nick . "\n" : '' ) . |
30
|
|
|
|
|
|
|
( ( $self->user ) ? ' User : ' . $self->user . "\n" : '' ) . |
31
|
|
|
|
|
|
|
( ( $self->host ) ? ' Host : ' . $self->host . "\n" : '' ) . |
32
|
|
|
|
|
|
|
( ( $self->com_str ) ? ' Com_str : ' . $self->com_str . "\n" : '' ) . |
33
|
|
|
|
|
|
|
# ( ( $self->to ) ? ' To : ' . $self->to . "\n" : '' ) ; |
34
|
|
|
|
|
|
|
' To : ' . $self->to . "\n" ; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
########## |
37
|
|
|
|
|
|
|
# Accessor # |
38
|
|
|
|
|
|
|
########## |
39
|
0
|
|
|
0
|
|
|
sub time { $_[0]->{'timestamp'} } |
40
|
0
|
|
|
0
|
|
|
sub orig { $_[0]->{'orig'} } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
{ my ( $code, $name ) = q{ sub { return $_[0]->{NAME} = $_[1] || $_[0]->{NAME} } } ; |
43
|
1
|
|
|
1
|
|
5
|
no strict 'refs' ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
609
|
|
44
|
|
|
|
|
|
|
foreach $name qw( prefix from servername nick user host to command com_str userhost ) { |
45
|
|
|
|
|
|
|
$_ = $code ; s/NAME/$name/g ; *{$name} = eval } } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub middle { |
48
|
|
|
|
|
|
|
$_[0]->{ 'middle' } = $_[1] || $_[0]->{ 'middle' } ; |
49
|
|
|
|
|
|
|
return ( wantarray ) ? $_[0]->{ 'middle' } : "@{$_[0]->{'middle'}}" } |
50
|
|
|
|
|
|
|
sub trailing { |
51
|
|
|
|
|
|
|
$_[0]->{'trailing' } = $_[1] || $_[0]->{'trailing'} ; |
52
|
|
|
|
|
|
|
return ( wantarray ) ? $_[0]->{'trailing'} : "@{$_[0]->{'trailing'}}" } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub polish_up { |
56
|
|
|
|
|
|
|
if ( $_[0]->command eq 'JOIN' ) { |
57
|
|
|
|
|
|
|
$_[0]->to( $_[0]->trailing ) ; |
58
|
|
|
|
|
|
|
}else{ |
59
|
|
|
|
|
|
|
$_[0]->to( $_[0]->middle ) ; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
*parent = \&Net::IRC2::Connection::parent; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub convert { |
66
|
|
|
|
|
|
|
my %hash = ( |
67
|
|
|
|
|
|
|
401 => 'NOSUCHNICK' ,402 => 'NOSUCHSERVER', |
68
|
|
|
|
|
|
|
403 => 'NOSUCHCHANNEL' ,404 => 'CANNOTSENDTOCHAN', |
69
|
|
|
|
|
|
|
405 => 'TOOMANYCHANNELS' ,406 => 'WASNOSUCHNICK', |
70
|
|
|
|
|
|
|
407 => 'TOOMANYTARGETS' ,409 => 'NOORIGIN', |
71
|
|
|
|
|
|
|
411 => 'NORECIPIENT' ,412 => 'NOTEXTTOSEND', |
72
|
|
|
|
|
|
|
413 => 'NOTOPLEVEL' ,414 => 'WILDTOPLEVEL', |
73
|
|
|
|
|
|
|
421 => 'UNKNOWNCOMMAND' ,422 => 'NOMOTD', |
74
|
|
|
|
|
|
|
423 => 'NOADMININFO' ,424 => 'FILEERROR', |
75
|
|
|
|
|
|
|
431 => 'NONICKNAMEGIVEN' ,432 => 'ERRONEUSNICKNAME', |
76
|
|
|
|
|
|
|
433 => 'NICKNAMEINUSE' ,436 => 'NICKCOLLISION', |
77
|
|
|
|
|
|
|
441 => 'USERNOTINCHANNEL',442 => 'NOTONCHANNEL', |
78
|
|
|
|
|
|
|
443 => 'USERONCHANNEL' ,444 => 'NOLOGIN', |
79
|
|
|
|
|
|
|
445 => 'SUMMONDISABLED' ,446 => 'USERSDISABLED', |
80
|
|
|
|
|
|
|
451 => 'NOTREGISTERED' ,461 => 'NEEDMOREPARAMS', |
81
|
|
|
|
|
|
|
462 => 'ALREADYREGISTRED',463 => 'NOPERMFORHOST', |
82
|
|
|
|
|
|
|
464 => 'PASSWDMISMATCH' ,465 => 'YOUREBANNEDCREEP', |
83
|
|
|
|
|
|
|
467 => 'KEYSET' ,471 => 'CHANNELISFULL', |
84
|
|
|
|
|
|
|
472 => 'UNKNOWNMODE' ,473 => 'INVITEONLYCHAN', |
85
|
|
|
|
|
|
|
474 => 'BANNEDFROMCHAN' ,475 => 'BADCHANNELKEY', |
86
|
|
|
|
|
|
|
481 => 'NOPRIVILEGES' ,482 => 'CHANOPRIVSNEEDED', |
87
|
|
|
|
|
|
|
483 => 'CANTKILLSERVER' ,491 => 'NOOPERHOST', |
88
|
|
|
|
|
|
|
501 => 'UMODEUNKNOWNFLAG',502 => 'USERSDONTMATCH', |
89
|
|
|
|
|
|
|
300 => 'NONE' ,302 => 'USERHOST', |
90
|
|
|
|
|
|
|
303 => 'ISON' ,301 => 'AWAY', |
91
|
|
|
|
|
|
|
305 => 'UNAWAY' ,306 => 'NOWAWAY', |
92
|
|
|
|
|
|
|
311 => 'WHOISUSER' ,312 => 'WHOISSERVER', |
93
|
|
|
|
|
|
|
313 => 'WHOISOPERATOR' ,317 => 'WHOISIDLE', |
94
|
|
|
|
|
|
|
318 => 'ENDOFWHOIS' ,319 => 'WHOISCHANNELS', |
95
|
|
|
|
|
|
|
314 => 'WHOWASUSER' ,369 => 'ENDOFWHOWAS', |
96
|
|
|
|
|
|
|
321 => 'LISTSTART' ,322 => 'LIST', |
97
|
|
|
|
|
|
|
323 => 'LISTEND' ,324 => 'CHANNELMODEIS', |
98
|
|
|
|
|
|
|
331 => 'NOTOPIC' ,332 => 'TOPIC', |
99
|
|
|
|
|
|
|
341 => 'INVITING' ,342 => 'SUMMONING', |
100
|
|
|
|
|
|
|
351 => 'VERSION' ,352 => 'WHOREPLY', |
101
|
|
|
|
|
|
|
315 => 'ENDOFWHO' ,353 => 'NAMREPLY', |
102
|
|
|
|
|
|
|
366 => 'ENDOFNAMES' ,364 => 'LINKS', |
103
|
|
|
|
|
|
|
365 => 'ENDOFLINKS' ,367 => 'BANLIST', |
104
|
|
|
|
|
|
|
368 => 'ENDOFBANLIST' ,371 => 'INFO', |
105
|
|
|
|
|
|
|
374 => 'ENDOFINFO' ,375 => 'MOTDSTART', |
106
|
|
|
|
|
|
|
372 => 'MOTD' ,376 => 'ENDOFMOTD', |
107
|
|
|
|
|
|
|
381 => 'YOUREOPER' ,382 => 'REHASHING', |
108
|
|
|
|
|
|
|
391 => 'TIME' ,392 => 'USERSSTART', |
109
|
|
|
|
|
|
|
393 => 'USERS' ,394 => 'ENDOFUSERS', |
110
|
|
|
|
|
|
|
395 => 'NOUSERS' ,200 => 'TRACELINK', |
111
|
|
|
|
|
|
|
201 => 'TRACECONNECTING' ,202 => 'TRACEHANDSHAKE', |
112
|
|
|
|
|
|
|
203 => 'TRACEUNKNOWN' ,204 => 'TRACEOPERATOR', |
113
|
|
|
|
|
|
|
205 => 'TRACEUSER' ,206 => 'TRACESERVER', |
114
|
|
|
|
|
|
|
208 => 'TRACENEWTYPE' ,261 => 'TRACELOG', |
115
|
|
|
|
|
|
|
211 => 'STATSLINKINFO' ,212 => 'STATSCOMMANDS', |
116
|
|
|
|
|
|
|
213 => 'STATSCLINE' ,214 => 'STATSNLINE', |
117
|
|
|
|
|
|
|
215 => 'STATSILINE' ,216 => 'STATSKLINE', |
118
|
|
|
|
|
|
|
218 => 'STATSYLINE' ,219 => 'ENDOFSTATS', |
119
|
|
|
|
|
|
|
241 => 'STATSLLINE' ,242 => 'STATSUPTIME', |
120
|
|
|
|
|
|
|
243 => 'STATSOLINE' ,244 => 'STATSHLINE', |
121
|
|
|
|
|
|
|
221 => 'UMODEIS' ,251 => 'LUSERCLIENT', |
122
|
|
|
|
|
|
|
252 => 'LUSEROP' ,253 => 'LUSERUNKNOWN', |
123
|
|
|
|
|
|
|
254 => 'LUSERCHANNELS' ,255 => 'LUSERME', |
124
|
|
|
|
|
|
|
256 => 'ADMINME' ,257 => 'ADMINLOC1', |
125
|
|
|
|
|
|
|
258 => 'ADMINLOC2' ,259 => 'ADMINEMAIL', |
126
|
|
|
|
|
|
|
209 => 'TRACECLASS' ,217 => 'STATSQLINE', |
127
|
|
|
|
|
|
|
231 => 'SERVICEINFO' ,232 => 'ENDOFSERVICES', |
128
|
|
|
|
|
|
|
233 => 'SERVICE' ,234 => 'SERVLIST', |
129
|
|
|
|
|
|
|
235 => 'SERVLISTEND' ,316 => 'WHOISCHANOP', |
130
|
|
|
|
|
|
|
361 => 'KILLDONE' ,362 => 'CLOSING', |
131
|
|
|
|
|
|
|
363 => 'CLOSEEND' ,373 => 'INFOSTART', |
132
|
|
|
|
|
|
|
384 => 'MYPORTIS' ,466 => 'YOUWILLBEBANNED', |
133
|
|
|
|
|
|
|
476 => 'BADCHANMASK' ,492 => 'NOSERVICEHOST', |
134
|
|
|
|
|
|
|
); |
135
|
|
|
|
|
|
|
foreach ( keys %hash ) { |
136
|
|
|
|
|
|
|
$hash{$hash{$_}} = $_; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
return $hash{$_[0]} ; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
__END__ |