File Coverage

blib/lib/Bot/Cobalt/Plugin/OutputFilters/StripFormat.pm
Criterion Covered Total %
statement 13 34 38.2
branch 0 2 0.0
condition n/a
subroutine 5 10 50.0
pod 0 6 0.0
total 18 52 34.6


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