line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::IRC::Plugin::Whois; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:HINRIK'; |
3
|
|
|
|
|
|
|
$POE::Component::IRC::Plugin::Whois::VERSION = '6.91'; |
4
|
79
|
|
|
79
|
|
499
|
use strict; |
|
79
|
|
|
|
|
207
|
|
|
79
|
|
|
|
|
2381
|
|
5
|
79
|
|
|
79
|
|
467
|
use warnings FATAL => 'all'; |
|
79
|
|
|
|
|
141
|
|
|
79
|
|
|
|
|
2423
|
|
6
|
79
|
|
|
79
|
|
375
|
use POE; |
|
79
|
|
|
|
|
140
|
|
|
79
|
|
|
|
|
450
|
|
7
|
79
|
|
|
79
|
|
25744
|
use POE::Component::IRC::Plugin qw( PCI_EAT_NONE ); |
|
79
|
|
|
|
|
178
|
|
|
79
|
|
|
|
|
3761
|
|
8
|
79
|
|
|
79
|
|
30130
|
use IRC::Utils qw(uc_irc); |
|
79
|
|
|
|
|
978228
|
|
|
79
|
|
|
|
|
62079
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
116
|
|
|
116
|
1
|
2984
|
return bless { }, shift; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub PCI_register { |
15
|
116
|
|
|
116
|
0
|
10934
|
my( $self, $irc ) = @_; |
16
|
116
|
|
|
|
|
929
|
$irc->plugin_register( $self, 'SERVER', qw(307 310 311 312 313 314 317 318 319 330 338 369) ); |
17
|
116
|
|
|
|
|
10408
|
return 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub PCI_unregister { |
21
|
116
|
|
|
116
|
0
|
18294
|
return 1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# RPL_WHOISUSER |
25
|
|
|
|
|
|
|
sub S_311 { |
26
|
4
|
|
|
4
|
0
|
1747
|
my ($self, $irc) = splice @_, 0, 2; |
27
|
4
|
|
|
|
|
26
|
my $mapping = $irc->isupport('CASEMAPPING'); |
28
|
4
|
|
|
|
|
20
|
my @args = @{ ${ $_[2] } }; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
17
|
|
29
|
4
|
|
|
|
|
8
|
my $real = pop @args; |
30
|
4
|
|
|
|
|
14
|
my ($rnick,$user,$host) = @args; |
31
|
4
|
|
|
|
|
18
|
my $nick = uc_irc $rnick, $mapping; |
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
56
|
$self->{WHOIS}->{ $nick }->{nick} = $rnick; |
34
|
4
|
|
|
|
|
13
|
$self->{WHOIS}->{ $nick }->{user} = $user; |
35
|
4
|
|
|
|
|
10
|
$self->{WHOIS}->{ $nick }->{host} = $host; |
36
|
4
|
|
|
|
|
11
|
$self->{WHOIS}->{ $nick }->{real} = $real; |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
15
|
return PCI_EAT_NONE; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# RPL_WHOISOPERATOR |
42
|
|
|
|
|
|
|
sub S_313 { |
43
|
0
|
|
|
0
|
0
|
0
|
my ($self, $irc) = splice @_, 0, 2; |
44
|
0
|
|
|
|
|
0
|
my $mapping = $irc->isupport('CASEMAPPING'); |
45
|
0
|
|
|
|
|
0
|
my $nick = uc_irc ${ $_[2] }->[0], $mapping; |
|
0
|
|
|
|
|
0
|
|
46
|
0
|
|
|
|
|
0
|
my $oper = ${ $_[2] }->[1]; |
|
0
|
|
|
|
|
0
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
$self->{WHOIS}->{ $nick }->{oper} = $oper; |
49
|
0
|
|
|
|
|
0
|
return PCI_EAT_NONE; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# RPL_WHOISSERVER |
53
|
|
|
|
|
|
|
sub S_312 { |
54
|
4
|
|
|
4
|
0
|
1111
|
my ($self, $irc) = splice @_, 0, 2; |
55
|
4
|
|
|
|
|
22
|
my $mapping = $irc->isupport('CASEMAPPING'); |
56
|
4
|
|
|
|
|
11
|
my ($nick,$server) = @{ ${ $_[2] } }; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
13
|
|
57
|
4
|
|
|
|
|
21
|
$nick = uc_irc $nick, $mapping; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# This can be returned in reply to either a WHOIS or a WHOWAS *sigh* |
60
|
4
|
50
|
|
|
|
70
|
if ( defined $self->{WHOWAS}->{ $nick } ) { |
61
|
0
|
|
|
|
|
0
|
$self->{WHOWAS}->{ $nick }->{server} = $server; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
4
|
|
|
|
|
15
|
$self->{WHOIS}->{ $nick }->{server} = $server; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
12
|
return PCI_EAT_NONE; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# RPL_WHOISIDLE |
71
|
|
|
|
|
|
|
sub S_317 { |
72
|
4
|
|
|
4
|
0
|
1009
|
my ($self, $irc) = splice @_, 0, 2; |
73
|
4
|
|
|
|
|
14
|
my $mapping = $irc->isupport('CASEMAPPING'); |
74
|
4
|
|
|
|
|
9
|
my ($nick,@args) = @{ ${ $_[2] } }; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
14
|
|
75
|
4
|
|
|
|
|
13
|
$nick = uc_irc $nick, $mapping; |
76
|
|
|
|
|
|
|
|
77
|
4
|
|
|
|
|
47
|
$self->{WHOIS}->{ $nick }->{idle} = $args[0]; |
78
|
4
|
|
|
|
|
16
|
$self->{WHOIS}->{ $nick }->{signon} = $args[1]; |
79
|
|
|
|
|
|
|
|
80
|
4
|
|
|
|
|
20
|
return PCI_EAT_NONE; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# RPL_WHOISCHANNELS |
84
|
|
|
|
|
|
|
sub S_319 { |
85
|
0
|
|
|
0
|
0
|
0
|
my ($self, $irc) = splice @_, 0, 2; |
86
|
0
|
|
|
|
|
0
|
my $mapping = $irc->isupport('CASEMAPPING'); |
87
|
0
|
|
|
|
|
0
|
my @args = @{ ${ $_[2] } }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
88
|
0
|
|
|
|
|
0
|
my $nick = uc_irc shift ( @args ), $mapping; |
89
|
0
|
|
|
|
|
0
|
my @chans = split / /, shift @args; |
90
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
0
|
if ( !defined $self->{WHOIS}->{ $nick }->{channels} ) { |
92
|
0
|
|
|
|
|
0
|
$self->{WHOIS}->{ $nick }->{channels} = [ @chans ]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else { |
95
|
0
|
|
|
|
|
0
|
push( @{ $self->{WHOIS}->{ $nick }->{channels} }, @chans ); |
|
0
|
|
|
|
|
0
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
return PCI_EAT_NONE; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# RPL_WHOISACCOUNT |
102
|
|
|
|
|
|
|
sub S_330 { |
103
|
0
|
|
|
0
|
0
|
0
|
my ($self, $irc) = splice @_, 0, 2; |
104
|
0
|
|
|
|
|
0
|
my $mapping = $irc->isupport('CASEMAPPING'); |
105
|
0
|
|
|
|
|
0
|
my ($nick, $ident) = @{ ${ $_[2] } }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
$self->{WHOIS}->{ uc_irc ( $nick, $mapping ) }->{identified} = $ident; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
0
|
return PCI_EAT_NONE; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
{ |
113
|
79
|
|
|
79
|
|
749
|
no warnings 'once'; |
|
79
|
|
|
|
|
180
|
|
|
79
|
|
|
|
|
40620
|
|
114
|
|
|
|
|
|
|
*S_307 = \&S_330; # RPL_WHOISREGNICK |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# RPL_WHOISMODES |
118
|
|
|
|
|
|
|
sub S_310 { |
119
|
0
|
|
|
0
|
0
|
0
|
my ($self, $irc) = splice @_, 0, 2; |
120
|
0
|
|
|
|
|
0
|
my $mapping = $irc->isupport('CASEMAPPING'); |
121
|
0
|
|
|
|
|
0
|
my ($nick, $modes) = @{ ${ $_[2] } }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
0
|
$self->{WHOIS}->{ uc_irc ( $nick, $mapping ) }->{modes} = $modes; |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
0
|
return PCI_EAT_NONE; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# RPL_WHOISACTUALLY (Hybrid/Ratbox/others) |
129
|
|
|
|
|
|
|
sub S_338 { |
130
|
4
|
|
|
4
|
0
|
1493
|
my ($self, $irc) = splice @_, 0, 2; |
131
|
4
|
|
|
|
|
19
|
my $mapping = $irc->isupport('CASEMAPPING'); |
132
|
4
|
|
|
|
|
9
|
my $nick = uc_irc ${ $_[2] }->[0], $mapping; |
|
4
|
|
|
|
|
19
|
|
133
|
4
|
|
|
|
|
44
|
my $ip = ${ $_[2] }->[1]; |
|
4
|
|
|
|
|
11
|
|
134
|
|
|
|
|
|
|
|
135
|
4
|
|
|
|
|
11
|
$self->{WHOIS}->{ $nick }->{actually} = $ip; |
136
|
|
|
|
|
|
|
|
137
|
4
|
|
|
|
|
12
|
return PCI_EAT_NONE; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# RPL_ENDOFWHOIS |
141
|
|
|
|
|
|
|
sub S_318 { |
142
|
4
|
|
|
4
|
0
|
1343
|
my ($self, $irc) = splice @_, 0, 2; |
143
|
4
|
|
|
|
|
15
|
my $mapping = $irc->isupport('CASEMAPPING'); |
144
|
4
|
|
|
|
|
12
|
my $nick = uc_irc ${ $_[2] }->[0], $mapping; |
|
4
|
|
|
|
|
20
|
|
145
|
4
|
|
|
|
|
49
|
my $whois = delete $self->{WHOIS}->{ $nick }; |
146
|
|
|
|
|
|
|
|
147
|
4
|
50
|
|
|
|
77
|
$irc->send_event_next( 'irc_whois', $whois ) if defined $whois; |
148
|
4
|
|
|
|
|
136
|
return PCI_EAT_NONE; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# RPL_WHOWASUSER |
152
|
|
|
|
|
|
|
sub S_314 { |
153
|
0
|
|
|
0
|
0
|
|
my ($self, $irc) = splice @_, 0, 2; |
154
|
0
|
|
|
|
|
|
my $mapping = $irc->isupport('CASEMAPPING'); |
155
|
0
|
|
|
|
|
|
my @args = @{ ${ $_[2] } }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
my $real = pop @args; |
157
|
0
|
|
|
|
|
|
my ($rnick,$user,$host) = @args; |
158
|
0
|
|
|
|
|
|
my $nick = uc_irc $rnick, $mapping; |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
$self->{WHOWAS}->{ $nick }->{nick} = $rnick; |
161
|
0
|
|
|
|
|
|
$self->{WHOWAS}->{ $nick }->{user} = $user; |
162
|
0
|
|
|
|
|
|
$self->{WHOWAS}->{ $nick }->{host} = $host; |
163
|
0
|
|
|
|
|
|
$self->{WHOWAS}->{ $nick }->{real} = $real; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
return PCI_EAT_NONE; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# RPL_ENDOFWHOWAS |
169
|
|
|
|
|
|
|
sub S_369 { |
170
|
0
|
|
|
0
|
0
|
|
my ($self, $irc) = splice @_, 0, 2; |
171
|
0
|
|
|
|
|
|
my $mapping = $irc->isupport('CASEMAPPING'); |
172
|
0
|
|
|
|
|
|
my $nick = uc_irc ${ $_[2] }->[0], $mapping; |
|
0
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
my $whowas = delete $self->{WHOWAS}->{ $nick }; |
175
|
0
|
0
|
|
|
|
|
$irc->send_event_next( 'irc_whowas', $whowas ) if defined $whowas; |
176
|
0
|
|
|
|
|
|
return PCI_EAT_NONE; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
1; |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=encoding utf8 |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 NAME |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
POE::Component::IRC::Plugin::Whois - A PoCo-IRC plugin that generates events |
186
|
|
|
|
|
|
|
for WHOIS and WHOWAS replies |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 DESCRIPTION |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
POE::Component::IRC::Plugin::Whois is the reimplementation of the C |
191
|
|
|
|
|
|
|
and C code from L as a |
192
|
|
|
|
|
|
|
plugin. It is used internally by L |
193
|
|
|
|
|
|
|
so there is no need to use this plugin yourself. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 METHODS |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 C |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
No arguments required. Returns a plugin object suitable for feeding to |
200
|
|
|
|
|
|
|
L's C method. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 AUTHOR |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Chris "BinGOs" Williams |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 SEE ALSO |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
L |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
L |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |