| 1 | package App::Pocoirc::Status; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $App::Pocoirc::Status::AUTHORITY = 'cpan:HINRIK'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||
| 5 | { | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | $App::Pocoirc::Status::VERSION = '0.47'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | } | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use IRC::Utils qw(decode_irc strip_color strip_formatting numeric_to_name); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use POE::Component::IRC::Plugin qw(PCI_EAT_NONE); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my ($package) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | croak "$package requires an even number of arguments" if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | return bless { @_ }, $package; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub PCI_register { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PCI_register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my ($self, $irc, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $irc->raw_events(1); | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $irc->plugin_register($self, 'SERVER', 'all'); | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $irc->plugin_register($self, 'USER', 'all'); | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub PCI_unregister { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PCI_unregister: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub verbose { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verbose: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $self->{Verbose} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub trace { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trace: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $self->{Trace} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub _normalize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_normalize: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my ($line) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $line = decode_irc($line); | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $line = strip_color($line); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $line = strip_formatting($line); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $line; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub _dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if (ref $arg eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my @elems; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | for my $elem (@$arg) { | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | push @elems, _dump($elem); | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return '['. join(', ', @elems) .']'; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | elsif (ref $arg eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my @pairs; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | for my $key (keys %$arg) { | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | push @pairs, [$key, _dump($arg->{$key})]; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return '{'. join(', ', map { "$_->[0] => $_->[1]" } @pairs) .'}'; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | elsif (ref $arg) { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | require overload; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return overload::StrVal($arg); | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | elsif (defined $arg) { | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return $arg if looks_like_number($arg); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | return "'".decode_irc($arg)."'"; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return 'undef'; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub _event_debug { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_event_debug: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my ($self, $irc, $args, $event) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if (!defined $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $event = (caller(1))[3]; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $event =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | pop @$args; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my @output; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | for my $i (0..$#{ $args }) { | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | push @output, "ARG$i: " . _dump(${ $args->[$i] }); | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'debug', "$event: ".join(', ', @output)); | |||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub S_connected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_connected: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $address = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Connected to server $address"); | |||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub S_disconnected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_disconnected: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $server = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Disconnected from server $server"); | |||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub S_snotice { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_snotice: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $notice = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Server notice: $notice"); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub S_notice { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_notice: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $sender = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $notice = _normalize(${ $_[2] }); | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if (defined $irc->server_name() && $sender ne $irc->server_name()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $irc->server_name and $sender ne $irc->server_name
MC/DC0%0/2
defined $irc->server_name and $sender ne $irc->server_name
defined $irc->server_name
$sender ne $irc->server_name
Truth table0%0/3
A and B
A= defined $irc->server_nameB= $sender ne $irc->server_name
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Server notice: $notice"); | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub S_001 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_001: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $server = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $nick = $irc->nick_name(); | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $event = 'S_001 ('.numeric_to_name('001').')'; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | $self->_event_debug($irc, \@_, $event) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Logged in to server $server with nick $nick"); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub S_identified { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_identified: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $nick = $irc->nick_name(); | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Identified with NickServ as $nick"); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub S_isupport { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_isupport: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my $isupport = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $network = $isupport->isupport('NETWORK'); | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if (!$self->{Dynamic} && defined $network && length $network) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $self->{"Dynamic"} and defined $network and length $network
not $self->{"Dynamic"} and defined $network
MC/DC0%0/3
not $self->{"Dynamic"} and defined $network and length $network
not $self->{"Dynamic"}
defined $network
length $network
Truth table0%0/4
not(A) and B and C
A= not $self->{"Dynamic"}B= defined $networkC= length $network
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $irc->send_event_next('irc_network', $network); | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | sub S_nick { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_nick: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my $user = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $newnick = _normalize(${ $_[1] }); | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $oldnick = (split /!/, $user)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | return PCI_EAT_NONE if $newnick ne $irc->nick_name(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Nickname changed from $oldnick to $newnick"); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub S_join { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_join: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $user = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $chan = _normalize(${ $_[1] }); | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $nick = (split /!/, $user)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | return PCI_EAT_NONE if $nick ne $irc->nick_name(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Joined channel $chan"); | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | sub S_part { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_part: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my $user = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $chan = _normalize(${ $_[1] }); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | my $reason = ref $_[2] eq 'SCALAR' ? _normalize(${ $_[2] }) : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $nick = (split /!/, $user)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | return PCI_EAT_NONE if $nick ne $irc->nick_name(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $msg = "Parted channel $chan"; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $msg .= " ($reason)" if $reason ne ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', $msg); | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | sub S_kick { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_kick: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $kicker = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $chan = _normalize(${ $_[1] }); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $victim = _normalize(${ $_[2] }); | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $reason = _normalize(${ $_[3] }); | |||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $kicker = (split /!/, $kicker)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | return PCI_EAT_NONE if $victim ne $irc->nick_name(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my $msg = "Kicked from $chan by $kicker"; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $msg .= " ($reason)" if length $reason; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', $msg); | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub S_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_error: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $error = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Error from IRC server: $error"); | |||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub S_quit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_quit: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $user = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $reason = _normalize(${ $_[1] }); | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $nick = (split /!/, $user)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | return PCI_EAT_NONE if $nick ne $irc->nick_name(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $msg = 'Quit from IRC'; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | $msg .= " ($reason)" if length $reason; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', $msg); | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub S_socketerr { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_socketerr: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my $reason = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Failed to connect to server: $reason"); | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | sub S_socks_failed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_socks_failed: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my $reason = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Failed to connect to SOCKS server: $reason"); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub S_socks_rejected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_socks_rejected: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $code = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | $self->_event_debug($irc, \@_) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'normal', "Connection rejected by SOCKS server (code $code)"); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | sub S_raw { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_raw: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $raw = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | return PCI_EAT_NONE if !$self->{Verbose}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'debug', "<<< $raw"); | |||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub S_raw_out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_raw_out: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my ($self, $irc) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my $raw = _normalize(${ $_[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | return PCI_EAT_NONE if !$self->{Verbose}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $irc->send_event_next('irc_plugin_status', $self, 'debug', ">>> $raw"); | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub _default { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my ($self, $irc, $event) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | return PCI_EAT_NONE if !$self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | return PCI_EAT_NONE if $event =~ /^S_plugin_/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if (my ($numeric) = $event =~ /^[SU]_(\d+)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $name = numeric_to_name($numeric); | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | $event .= " ($name)" if defined $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | $self->_event_debug($irc, \@_, $event) if $self->{Trace}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | return PCI_EAT_NONE; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | App::Pocoirc::Status - A PoCo-IRC plugin which logs IRC status | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | This plugin is used internally by L<App::Pocoirc|App::Pocoirc>. No need for | ||||||||||||||||||||||||||||||||||||||||||
| 313 | you to use it. | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | =cut | ||||||||||||||||||||||||||||||||||||||||||