line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::Core::ContextMeta::Ignore; |
2
|
|
|
|
|
|
|
$Bot::Cobalt::Core::ContextMeta::Ignore::VERSION = '0.021001'; |
3
|
6
|
|
|
6
|
|
13684
|
use strictures 2; |
|
6
|
|
|
|
|
1118
|
|
|
6
|
|
|
|
|
173
|
|
4
|
6
|
|
|
6
|
|
762
|
use Carp; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
266
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
442
|
use IRC::Utils 'normalize_mask'; |
|
6
|
|
|
|
|
14755
|
|
|
6
|
|
|
|
|
216
|
|
7
|
6
|
|
|
6
|
|
343
|
use Bot::Cobalt::Common ':types'; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
28
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
432
|
use Moo; |
|
6
|
|
|
|
|
6484
|
|
|
6
|
|
|
|
|
27
|
|
11
|
|
|
|
|
|
|
extends 'Bot::Cobalt::Core::ContextMeta'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
around add => sub { |
15
|
|
|
|
|
|
|
my $orig = shift; |
16
|
|
|
|
|
|
|
my ($self, $context, $mask, $reason, $addedby) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($pkg, $line) = (caller)[0,2]; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
confess "Missing arguments in ignore add()" |
21
|
|
|
|
|
|
|
unless defined $context and defined $mask; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$mask = normalize_mask($mask); |
24
|
|
|
|
|
|
|
$addedby = $pkg unless defined $addedby; |
25
|
|
|
|
|
|
|
$reason = "Added by $pkg" unless defined $reason; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $meta = +{ |
28
|
|
|
|
|
|
|
AddedBy => $addedby, |
29
|
|
|
|
|
|
|
Reason => $reason, |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$self->$orig($context, $mask, $meta) |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub reason { |
36
|
1
|
|
|
1
|
1
|
205
|
my ($self, $context, $mask) = @_; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return unless exists $self->_list->{$context} |
39
|
1
|
50
|
33
|
|
|
20
|
and exists $self->_list->{$context}->{$mask}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$self->_list->{$context}->{$mask}->{Reason} |
42
|
1
|
|
|
|
|
33
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub addedby { |
45
|
1
|
|
|
1
|
1
|
174
|
my ($self, $context, $mask) = @_; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return unless exists $self->_list->{$context} |
48
|
1
|
50
|
33
|
|
|
17
|
and exists $self->_list->{$context}->{$mask}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$self->_list->{$context}->{$mask}->{AddedBy} |
51
|
1
|
|
|
|
|
40
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |