line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::IRC::Event::Nick; |
2
|
|
|
|
|
|
|
$Bot::Cobalt::IRC::Event::Nick::VERSION = '0.021003'; |
3
|
5
|
|
|
5
|
|
14332
|
use strictures 2; |
|
5
|
|
|
|
|
1112
|
|
|
5
|
|
|
|
|
191
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
1063
|
use Bot::Cobalt::Common qw/:types/; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
require Bot::Cobalt::Core; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
23
|
use IRC::Utils qw/eq_irc/; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
235
|
|
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
576
|
use Moo; |
|
5
|
|
|
|
|
6279
|
|
|
5
|
|
|
|
|
24
|
|
11
|
|
|
|
|
|
|
extends 'Bot::Cobalt::IRC::Event'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has old_nick => ( |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
is => 'rw', |
16
|
|
|
|
|
|
|
isa => Str, |
17
|
|
|
|
|
|
|
predicate => 'has_old_nick', |
18
|
|
|
|
|
|
|
default => sub { $_[0]->src_nick }, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has new_nick => ( |
22
|
|
|
|
|
|
|
required => 1, |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => Str, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has channels => ( |
28
|
|
|
|
|
|
|
required => 1, |
29
|
|
|
|
|
|
|
is => 'rw', |
30
|
|
|
|
|
|
|
isa => ArrayObj, |
31
|
|
|
|
|
|
|
coerce => 1, |
32
|
|
|
|
|
|
|
trigger => sub { |
33
|
|
|
|
|
|
|
my ($self, $value) = @_; |
34
|
|
|
|
|
|
|
$self->_set_common($value) if $self->has_common; |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
## ...just to remain compat with ::Quit: |
39
|
|
|
|
|
|
|
has common => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
lazy => 1, |
42
|
|
|
|
|
|
|
predicate => 'has_common', |
43
|
|
|
|
|
|
|
writer => '_set_common', |
44
|
|
|
|
|
|
|
default => sub { $_[0]->channels }, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
## Changing src on a Nick event makes no sense, as far as I can tell. |
48
|
|
|
|
|
|
|
## ...but you can do it! |
49
|
|
|
|
|
|
|
after 'src' => sub { |
50
|
|
|
|
|
|
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
$self->old_nick( $self->src_nick ) if $self->has_old_nick; |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub equal { |
55
|
2
|
|
|
2
|
1
|
1538
|
my ($self) = @_; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
3
|
my $casemap; |
58
|
2
|
50
|
|
|
|
13
|
if (Bot::Cobalt::Core->has_instance) { |
59
|
0
|
|
0
|
|
|
0
|
$casemap = core->get_irc_casemap($self->context) || 'rfc1459'; |
60
|
|
|
|
|
|
|
} else { |
61
|
2
|
|
|
|
|
7
|
$casemap = 'rfc1459'; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
25
|
eq_irc($self->old_nick, $self->new_nick, $casemap) |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
__END__ |