File Coverage

blib/lib/Bot/Cobalt/Plugin/OutputFilters/StripColor.pm
Criterion Covered Total %
statement 10 31 32.2
branch 0 2 0.0
condition n/a
subroutine 4 9 44.4
pod 0 6 0.0
total 14 48 29.1


line stmt bran cond sub pod time code
1             package Bot::Cobalt::Plugin::OutputFilters::StripColor;
2             $Bot::Cobalt::Plugin::OutputFilters::StripColor::VERSION = '0.021003';
3              
4              
5 1     1   771 use strictures 2;
  1         5  
  1         32  
6              
7 1     1   133 use Object::Pluggable::Constants qw/ :ALL /;
  1         2  
  1         90  
8              
9 1     1   5 use IRC::Utils qw/ strip_color /;
  1         2  
  1         254  
10              
11 1     1 0 331 sub new { bless [], shift }
12              
13             sub Cobalt_register {
14 0     0 0   my ($self, $core) = splice @_, 0, 2;
15              
16 0           $core->plugin_register( $self, 'USER',
17             'message', 'notice', 'ctcp',
18             );
19              
20 0           $core->log->info("Registered, filtering COLORS");
21              
22 0           return PLUGIN_EAT_NONE
23             }
24              
25             sub Cobalt_unregister {
26 0     0 0   my ($self, $core) = splice @_, 0, 2;
27              
28 0           $core->log->info("Unregistered");
29              
30 0           return PLUGIN_EAT_NONE
31             }
32              
33             sub Outgoing_message {
34 0     0 0   my ($self, $core) = splice @_, 0, 2;
35              
36 0           ${$_[2]} = strip_color(${$_[2]});
  0            
  0            
37              
38 0           return PLUGIN_EAT_NONE
39             }
40              
41 0     0 0   sub Outgoing_notice { Outgoing_message(@_) }
42              
43             sub Outgoing_ctcp {
44 0     0 0   my ($self, $core) = splice @_, 0, 2;
45 0           my $type = ${$_[1]};
  0            
46              
47 0 0         return PLUGIN_EAT_NONE unless uc($type) eq 'ACTION';
48              
49 0           ${$_[3]} = strip_color(${$_[3]});
  0            
  0            
50              
51 0           return PLUGIN_EAT_NONE
52             }
53              
54             1;
55             __END__