| 1 | package POEx::IRC::Client::Lite; | ||||||||||||||||||||||||||||
| 2 | 1 | $POEx::IRC::Client::Lite::VERSION = '0.004001'; | |||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strictures 2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp 'confess'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use POE; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use POEx::IRC::Backend; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use IRC::Message::Object 'ircmsg'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use IRC::Toolkit::Case; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use IRC::Toolkit::CTCP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use POE::Filter::IRCv3; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Types::Standard -all; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use MooX::Role::Pluggable::Constants; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 1 | with 'MooX::Role::POE::Emitter'; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =for Pod::Coverage has_(\w+) | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 1 | has server => ( | |||||||||||||||||||||||||||
| 33 | required => 1, | ||||||||||||||||||||||||||||
| 34 | is => 'ro', | ||||||||||||||||||||||||||||
| 35 | isa => Str, | ||||||||||||||||||||||||||||
| 36 | writer => 'set_server', | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | has nick => ( | |||||||||||||||||||||||||||
| 40 | required => 1, | ||||||||||||||||||||||||||||
| 41 | is => 'ro', | ||||||||||||||||||||||||||||
| 42 | isa => Str, | ||||||||||||||||||||||||||||
| 43 | writer => 'set_nick', | ||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | after set_nick => sub { | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my ($self, $nick) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ($self->_has_conn && $self->conn->has_wheel) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_has_conn and $self->conn->has_wheel
MC/DC0%0/2
$self->_has_conn and $self->conn->has_wheel
$self->_has_conn
$self->conn->has_wheel
Truth table0%0/3
A and B
A= $self->_has_connB= $self->conn->has_wheel
| |||||||||||||||||||||||||||||
| 49 | ## Try to change IRC nickname as well. | ||||||||||||||||||||||||||||
| 50 | 0 | $self->nick($nick) | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 1 | }; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | has bindaddr => ( | ||||||||||||||||||||||||||||
| 55 | lazy => 1, | ||||||||||||||||||||||||||||
| 56 | is => 'ro', | ||||||||||||||||||||||||||||
| 57 | isa => Defined, | ||||||||||||||||||||||||||||
| 58 | writer => 'set_bindaddr', | ||||||||||||||||||||||||||||
| 59 | predicate => 'has_bindaddr', | ||||||||||||||||||||||||||||
| 60 | builder => sub { | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_build_bindaddr: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | $self->has_ipv6 && $self->ipv6 ? | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->has_ipv6 and $self->ipv6
MC/DC0%0/2
$self->has_ipv6 and $self->ipv6
$self->has_ipv6
$self->ipv6
Truth table0%0/3
A and B
A= $self->has_ipv6B= $self->ipv6
| |||||||||||||||||||||||||||||
| 63 | '::0' : '0.0.0.0' | ||||||||||||||||||||||||||||
| 64 | }, | ||||||||||||||||||||||||||||
| 65 | 1 | ); | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | has ipv6 => ( | ||||||||||||||||||||||||||||
| 68 | lazy => 1, | ||||||||||||||||||||||||||||
| 69 | is => 'ro', | ||||||||||||||||||||||||||||
| 70 | isa => Bool, | ||||||||||||||||||||||||||||
| 71 | writer => 'set_ipv6', | ||||||||||||||||||||||||||||
| 72 | predicate => 'has_ipv6', | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | builder => sub { 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 74 | 1 | ); | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | has ssl => ( | ||||||||||||||||||||||||||||
| 77 | lazy => 1, | ||||||||||||||||||||||||||||
| 78 | is => 'ro', | ||||||||||||||||||||||||||||
| 79 | isa => Bool, | ||||||||||||||||||||||||||||
| 80 | writer => 'set_ssl', | ||||||||||||||||||||||||||||
| 81 | 1 | ▶ | builder => sub { 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 82 | 1 | ); | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | has ssl_opts => ( | ||||||||||||||||||||||||||||
| 85 | lazy => 1, | ||||||||||||||||||||||||||||
| 86 | is => 'ro', | ||||||||||||||||||||||||||||
| 87 | isa => Maybe[ArrayRef], | ||||||||||||||||||||||||||||
| 88 | writer => 'set_ssl_opts', | ||||||||||||||||||||||||||||
| 89 | 1 | ▶ | builder => sub { undef }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | 1 | ); | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | has pass => ( | ||||||||||||||||||||||||||||
| 93 | lazy => 1, | ||||||||||||||||||||||||||||
| 94 | is => 'ro', | ||||||||||||||||||||||||||||
| 95 | isa => Str, | ||||||||||||||||||||||||||||
| 96 | writer => 'set_pass', | ||||||||||||||||||||||||||||
| 97 | predicate => 'has_pass', | ||||||||||||||||||||||||||||
| 98 | clearer => 'clear_pass', | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | builder => sub { '' }, | ||||||||||||||||||||||||||
|
Subroutine
_build_pass: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 100 | 1 | ); | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | has port => ( | ||||||||||||||||||||||||||||
| 103 | lazy => 1, | ||||||||||||||||||||||||||||
| 104 | is => 'ro', | ||||||||||||||||||||||||||||
| 105 | isa => Num, | ||||||||||||||||||||||||||||
| 106 | writer => 'set_port', | ||||||||||||||||||||||||||||
| 107 | predicate => 'has_port', | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | builder => sub { 6667 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 109 | 1 | ); | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | has realname => ( | ||||||||||||||||||||||||||||
| 112 | lazy => 1, | ||||||||||||||||||||||||||||
| 113 | is => 'ro', | ||||||||||||||||||||||||||||
| 114 | isa => Str, | ||||||||||||||||||||||||||||
| 115 | writer => 'set_realname', | ||||||||||||||||||||||||||||
| 116 | predicate => 'has_realname', | ||||||||||||||||||||||||||||
| 117 | 1 | ▶ | builder => sub { __PACKAGE__ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 118 | 1 | ); | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | has reconnect => ( | ||||||||||||||||||||||||||||
| 121 | lazy => 1, | ||||||||||||||||||||||||||||
| 122 | is => 'ro', | ||||||||||||||||||||||||||||
| 123 | isa => Num, | ||||||||||||||||||||||||||||
| 124 | writer => 'set_reconnect', | ||||||||||||||||||||||||||||
| 125 | 0 | ▶ | builder => sub { 120 }, | ||||||||||||||||||||||||||
|
Subroutine
_build_reconnect: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 126 | 1 | ); | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | has username => ( | ||||||||||||||||||||||||||||
| 129 | lazy => 1, | ||||||||||||||||||||||||||||
| 130 | is => 'ro', | ||||||||||||||||||||||||||||
| 131 | isa => Str, | ||||||||||||||||||||||||||||
| 132 | writer => 'set_username', | ||||||||||||||||||||||||||||
| 133 | predicate => 'has_username', | ||||||||||||||||||||||||||||
| 134 | 0 | ▶ | builder => sub { 'ircplug' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 135 | 1 | ); | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | ### Typically internal: | ||||||||||||||||||||||||||||
| 138 | has backend => ( | ||||||||||||||||||||||||||||
| 139 | lazy => 1, | ||||||||||||||||||||||||||||
| 140 | is => 'ro', | ||||||||||||||||||||||||||||
| 141 | isa => InstanceOf['POEx::IRC::Backend'], | ||||||||||||||||||||||||||||
| 142 | builder => sub { | ||||||||||||||||||||||||||||
| 143 | 1 | ▶ | my $filter = POE::Filter::IRCv3->new(colonify => 0); | ||||||||||||||||||||||||||
|
Subroutine
_build_backend: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 144 | 1 | POEx::IRC::Backend->new(filter_irc => $filter) | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 1 | ); | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 1 | has conn => ( | |||||||||||||||||||||||||||
| 150 | lazy => 1, | ||||||||||||||||||||||||||||
| 151 | weak_ref => 1, | ||||||||||||||||||||||||||||
| 152 | is => 'ro', | ||||||||||||||||||||||||||||
| 153 | isa => Object, | ||||||||||||||||||||||||||||
| 154 | writer => '_set_conn', | ||||||||||||||||||||||||||||
| 155 | predicate => '_has_conn', | ||||||||||||||||||||||||||||
| 156 | clearer => '_clear_conn', | ||||||||||||||||||||||||||||
| 157 | ); | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | sub BUILD { | ||||||||||||||||||||||||||||
| 161 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | $self->set_object_states( | ||||||||||||||||||||||||||||
| 164 | [ | ||||||||||||||||||||||||||||
| 165 | $self => [ qw/ | ||||||||||||||||||||||||||||
| 166 | ircsock_input | ||||||||||||||||||||||||||||
| 167 | ircsock_connector_open | ||||||||||||||||||||||||||||
| 168 | ircsock_connector_failure | ||||||||||||||||||||||||||||
| 169 | ircsock_disconnect | ||||||||||||||||||||||||||||
| 170 | / ], | ||||||||||||||||||||||||||||
| 171 | $self => { | ||||||||||||||||||||||||||||
| 172 | emitter_started => '_emitter_started', | ||||||||||||||||||||||||||||
| 173 | connect => '_connect', | ||||||||||||||||||||||||||||
| 174 | disconnect => '_disconnect', | ||||||||||||||||||||||||||||
| 175 | send => '_send', | ||||||||||||||||||||||||||||
| 176 | privmsg => '_privmsg', | ||||||||||||||||||||||||||||
| 177 | ctcp => '_ctcp', | ||||||||||||||||||||||||||||
| 178 | notice => '_notice', | ||||||||||||||||||||||||||||
| 179 | mode => '_mode', | ||||||||||||||||||||||||||||
| 180 | join => '_join', | ||||||||||||||||||||||||||||
| 181 | part => '_part', | ||||||||||||||||||||||||||||
| 182 | }, | ||||||||||||||||||||||||||||
| 183 | ( | ||||||||||||||||||||||||||||
| 184 | 1 | ▶ | $self->has_object_states ? @{ $self->object_states } : () | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | ), | ||||||||||||||||||||||||||||
| 186 | ], | ||||||||||||||||||||||||||||
| 187 | ); | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 1 | $self->_start_emitter; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | sub _emitter_started { | ||||||||||||||||||||||||||||
| 193 | 1 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_emitter_started: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||
| 194 | 1 | ▶ | $self->backend->spawn( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | ( $self->ssl_opts ? (ssl_opts => $self->ssl_opts) : () ), | ||||||||||||||||||||||||||||
| 196 | ); | ||||||||||||||||||||||||||||
| 197 | 1 | $kernel->post( $self->backend->session_id => 'register' ); | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | sub stop { | ||||||||||||||||||||||||||||
| 201 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 202 | 1 | $poe_kernel->post( $self->backend->session_id => 'shutdown' ); | |||||||||||||||||||||||||||
| 203 | 1 | $self->_shutdown_emitter; | |||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | ### ircsock_* | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | sub ircsock_connector_open { | ||||||||||||||||||||||||||||
| 209 | 1 | ▶ | my (undef, $self, $conn) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||
|
Subroutine
ircsock_connector_open: called CC=4 SCAR=16.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 1 | $self->_set_conn( $conn ); | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 1 | ▶ | if ($self->process( preregister => $conn ) == EAT_ALL) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | $self->_clear_conn; | |||||||||||||||||||||||||||
| 215 | 0 | $self->emit( irc_connector_killed => $conn ); | |||||||||||||||||||||||||||
| 216 | return | ||||||||||||||||||||||||||||
| 217 | 0 | } | |||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 1 | my @pre; | |||||||||||||||||||||||||||
| 220 | 1 | ▶ | if ($self->has_pass && (my $pass = $self->pass)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->has_pass and my $pass = $self->pass
MC/DC0%0/2
$self->has_pass and my $pass = $self->pass
$self->has_pass
my $pass = $self->pass
Truth table33%1/3
A and B
A= $self->has_passB= my $pass = $self->pass
| |||||||||||||||||||||||||||||
| 221 | 0 | push @pre, ircmsg( | |||||||||||||||||||||||||||
| 222 | command => 'pass', | ||||||||||||||||||||||||||||
| 223 | params => [ | ||||||||||||||||||||||||||||
| 224 | $pass | ||||||||||||||||||||||||||||
| 225 | ], | ||||||||||||||||||||||||||||
| 226 | ) | ||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | $self->send( | ||||||||||||||||||||||||||||
| 229 | 1 | @pre, | |||||||||||||||||||||||||||
| 230 | ircmsg( | ||||||||||||||||||||||||||||
| 231 | command => 'user', | ||||||||||||||||||||||||||||
| 232 | params => [ | ||||||||||||||||||||||||||||
| 233 | $self->username, | ||||||||||||||||||||||||||||
| 234 | '*', '*', | ||||||||||||||||||||||||||||
| 235 | $self->realname | ||||||||||||||||||||||||||||
| 236 | ], | ||||||||||||||||||||||||||||
| 237 | ), | ||||||||||||||||||||||||||||
| 238 | ircmsg( | ||||||||||||||||||||||||||||
| 239 | command => 'nick', | ||||||||||||||||||||||||||||
| 240 | params => [ $self->nick ], | ||||||||||||||||||||||||||||
| 241 | ), | ||||||||||||||||||||||||||||
| 242 | ); | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 1 | $self->emit( irc_connected => $conn ); | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | sub ircsock_connector_failure { | ||||||||||||||||||||||||||||
| 248 | 0 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
ircsock_connector_failure: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 249 | #my $connector = $_[ARG0]; | ||||||||||||||||||||||||||||
| 250 | #my ($op, $errno, $errstr) = @_[ARG1 .. ARG3]; | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 0 | ▶ | $self->_clear_conn if $self->_has_conn; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | $self->emit( irc_connector_failed => @_[ARG0 .. $#_] ); | |||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 0 | ▶ | $self->timer( $self->reconnect => 'connect') if $self->reconnect; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | sub ircsock_disconnect { | ||||||||||||||||||||||||||||
| 260 | 1 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
ircsock_disconnect: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 261 | 1 | my ($conn, $str) = @_[ARG0, ARG1]; | |||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 1 | ▶ | $self->_clear_conn if $self->_has_conn; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 1 | $self->emit( irc_disconnected => $str, $conn ); | |||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | sub ircsock_input { | ||||||||||||||||||||||||||||
| 269 | 3 | ▶ | my (undef, $self, $ircev) = @_[KERNEL, OBJECT, ARG1]; | ||||||||||||||||||||||||||
|
Subroutine
ircsock_input: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 3 | ▶ | return unless $ircev->command; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | 3 | $self->emit( 'irc_'.lc($ircev->command) => $ircev) | |||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | ### Our IRC-related handlers. | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | sub N_irc_433 { | ||||||||||||||||||||||||||||
| 279 | ## Nickname in use. | ||||||||||||||||||||||||||||
| 280 | 0 | ▶ | my (undef, $self) = splice @_, 0, 2; | ||||||||||||||||||||||||||
|
Subroutine
N_irc_433: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 281 | 0 | my $ircev = ${ $_[0] }; | |||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 0 | ▶ | my $taken = $ircev->params->[1] || $self->nick; | ||||||||||||||||||||||||||
|
Condition0%0/3
$ircev->params->[1] || $self->nick
MC/DC0%0/2
$ircev->params->[1] || $self->nick
$ircev->params->[1]
$self->nick
Truth table0%0/3
A || B
A= $ircev->params->[1]B= $self->nick
| |||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 0 | $self->send( | |||||||||||||||||||||||||||
| 286 | ircmsg( | ||||||||||||||||||||||||||||
| 287 | command => 'nick', | ||||||||||||||||||||||||||||
| 288 | params => [ $taken . '_' ], | ||||||||||||||||||||||||||||
| 289 | ) | ||||||||||||||||||||||||||||
| 290 | ); | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 0 | EAT_NONE | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | sub N_irc_ping { | ||||||||||||||||||||||||||||
| 296 | 0 | ▶ | my (undef, $self) = splice @_, 0, 2; | ||||||||||||||||||||||||||
|
Subroutine
N_irc_ping: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 297 | 0 | my $ircev = ${ $_[0] }; | |||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | $self->send( | ||||||||||||||||||||||||||||
| 300 | ircmsg( | ||||||||||||||||||||||||||||
| 301 | command => 'pong', | ||||||||||||||||||||||||||||
| 302 | 0 | params => [ @{ $ircev->params } ], | |||||||||||||||||||||||||||
| 303 | ) | ||||||||||||||||||||||||||||
| 304 | ); | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | EAT_NONE | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | sub N_irc_privmsg { | ||||||||||||||||||||||||||||
| 310 | 2 | ▶ | my (undef, $self) = splice @_, 0, 2; | ||||||||||||||||||||||||||
|
Subroutine
N_irc_privmsg: called CC=5 SCAR=17.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 311 | 2 | my $ircev = ${ $_[0] }; | |||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 2 | ▶ | if (my $ctcp_ev = ctcp_extract($ircev)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | 1 | $self->emit_now( 'irc_'.$ctcp_ev->command => $ctcp_ev ); | |||||||||||||||||||||||||||
| 315 | 1 | return EAT_ALL | |||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 1 | ▶ | if ($ircev->has_tags && $ircev->get_tag('intent') eq 'ACTION') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ircev->has_tags and $ircev->get_tag("intent") eq "ACTION"
MC/DC0%0/2
$ircev->has_tags and $ircev->get_tag("intent") eq "ACTION"
$ircev->has_tags
$ircev->get_tag("intent") eq "ACTION"
Truth table33%1/3
A and B
A= $ircev->has_tagsB= $ircev->get_tag("intent") eq "ACTION"
| |||||||||||||||||||||||||||||
| 319 | 0 | $self->emit_now( irc_ctcp_action => $ircev ); | |||||||||||||||||||||||||||
| 320 | 0 | return EAT_ALL | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 1 | my $prefix = substr $ircev->params->[0], 0, 1; | |||||||||||||||||||||||||||
| 324 | ## FIXME | ||||||||||||||||||||||||||||
| 325 | ## parse isupports as we get them, attempt to find chan prefixes | ||||||||||||||||||||||||||||
| 326 | ## attrib defaulting to following: | ||||||||||||||||||||||||||||
| 327 | 1 | ▶ | if (grep {; $_ eq $prefix } ('#', '&', '+') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 328 | 1 | $self->emit_now( irc_public_msg => $ircev ) | |||||||||||||||||||||||||||
| 329 | } else { | ||||||||||||||||||||||||||||
| 330 | 0 | $self->emit_now( irc_private_msg => $ircev ) | |||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 1 | EAT_ALL | |||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | sub N_irc_notice { | ||||||||||||||||||||||||||||
| 337 | 0 | ▶ | my (undef, $self) = splice @_, 0, 2; | ||||||||||||||||||||||||||
|
Subroutine
N_irc_notice: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 338 | 0 | my $ircev = ${ $_[0] }; | |||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if (my $ctcp_ev = ctcp_extract($ircev)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 341 | 0 | $self->emit_now( 'irc_'.$ctcp_ev->command => $ctcp_ev ); | |||||||||||||||||||||||||||
| 342 | 0 | return EAT_ALL | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | EAT_NONE | ||||||||||||||||||||||||||||
| 346 | 0 | } | |||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | ### Public | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | ## Since the retval of yield() is $self, many of these can be chained: | ||||||||||||||||||||||||||||
| 353 | ## $client->connect->join(@channels)->privmsg( | ||||||||||||||||||||||||||||
| 354 | ## join(',', @channels), 'hello!' | ||||||||||||||||||||||||||||
| 355 | ## ); | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | sub connect { | ||||||||||||||||||||||||||||
| 358 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 359 | 1 | $self->yield( connect => @_ ) | |||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | sub _connect { | ||||||||||||||||||||||||||||
| 363 | 1 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_connect: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 1 | ▶ | $self->backend->create_connector( | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 366 | remoteaddr => $self->server, | ||||||||||||||||||||||||||||
| 367 | remoteport => $self->port, | ||||||||||||||||||||||||||||
| 368 | ssl => $self->ssl, | ||||||||||||||||||||||||||||
| 369 | ( | ||||||||||||||||||||||||||||
| 370 | $self->has_ipv6 ? (ipv6 => $self->ipv6) : () | ||||||||||||||||||||||||||||
| 371 | ), | ||||||||||||||||||||||||||||
| 372 | ( | ||||||||||||||||||||||||||||
| 373 | $self->has_bindaddr ? (bindaddr => $self->bindaddr) : () | ||||||||||||||||||||||||||||
| 374 | ), | ||||||||||||||||||||||||||||
| 375 | ); | ||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | sub disconnect { | ||||||||||||||||||||||||||||
| 379 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 380 | 1 | $self->yield( disconnect => @_ ) | |||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | sub _disconnect { | ||||||||||||||||||||||||||||
| 384 | 1 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_disconnect: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||
| 385 | 1 | ▶ | my $message = $_[ARG0] // 'Leaving'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$_[10] // "Leaving"
MC/DC0%0/1
$_[10] // "Leaving"
$_[10]
Truth table50%1/2
A
A= $_[10]
| |||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 1 | $self->backend->send( | |||||||||||||||||||||||||||
| 388 | ircmsg( | ||||||||||||||||||||||||||||
| 389 | command => 'quit', | ||||||||||||||||||||||||||||
| 390 | params => [ $message ], | ||||||||||||||||||||||||||||
| 391 | ), | ||||||||||||||||||||||||||||
| 392 | $self->conn->wheel_id | ||||||||||||||||||||||||||||
| 393 | ); | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 1 | $kernel->alarm('connect'); | |||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 1 | ▶ | $self->backend->disconnect( $self->conn->wheel->ID ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_has_conn and $self->conn->has_wheel
MC/DC0%0/2
$self->_has_conn and $self->conn->has_wheel
$self->_has_conn
$self->conn->has_wheel
Truth table33%1/3
A and B
A= $self->_has_connB= $self->conn->has_wheel
| |||||||||||||||||||||||||||||
| 398 | if $self->_has_conn and $self->conn->has_wheel; | ||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | sub send_raw_line { | ||||||||||||||||||||||||||||
| 402 | 0 | ▶ | my ($self, $line) = @_; | ||||||||||||||||||||||||||
|
Subroutine
send_raw_line: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 403 | 0 | ▶ | confess "Expected a raw line" unless defined $line; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 404 | 0 | $self->send( ircmsg(raw_line => $line) ); | |||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | sub send { | ||||||||||||||||||||||||||||
| 408 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
send: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 409 | 4 | $self->yield( send => @_ ) | |||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | sub _send { | ||||||||||||||||||||||||||||
| 413 | 4 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_send: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||
| 414 | 4 | for my $outev (@_[ARG0 .. $#_]) { | |||||||||||||||||||||||||||
| 415 | 5 | ▶ | if ($self->process( outgoing => $outev ) == EAT_ALL) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 416 | next | ||||||||||||||||||||||||||||
| 417 | 0 | } | |||||||||||||||||||||||||||
| 418 | 5 | $self->backend->send( $outev, $self->conn->wheel_id ) | |||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | ## Sugar, and POE-dispatchable counterparts. | ||||||||||||||||||||||||||||
| 423 | sub notice { | ||||||||||||||||||||||||||||
| 424 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
notice: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 425 | 0 | $self->yield( notice => @_ ) | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | sub _notice { | ||||||||||||||||||||||||||||
| 429 | 0 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_notice: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 430 | 0 | my ($target, @data) = @_[ARG0 .. $#_]; | |||||||||||||||||||||||||||
| 431 | 0 | $self->send( | |||||||||||||||||||||||||||
| 432 | ircmsg( | ||||||||||||||||||||||||||||
| 433 | command => 'notice', | ||||||||||||||||||||||||||||
| 434 | params => [ $target, join ' ', @data ] | ||||||||||||||||||||||||||||
| 435 | ) | ||||||||||||||||||||||||||||
| 436 | ) | ||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | sub privmsg { | ||||||||||||||||||||||||||||
| 440 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
privmsg: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 441 | 0 | $self->yield( privmsg => @_ ) | |||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | sub _privmsg { | ||||||||||||||||||||||||||||
| 445 | 0 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_privmsg: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 446 | 0 | my ($target, @data) = @_[ARG0 .. $#_]; | |||||||||||||||||||||||||||
| 447 | 0 | $self->send( | |||||||||||||||||||||||||||
| 448 | ircmsg( | ||||||||||||||||||||||||||||
| 449 | command => 'privmsg', | ||||||||||||||||||||||||||||
| 450 | params => [ $target, join ' ', @data ] | ||||||||||||||||||||||||||||
| 451 | ) | ||||||||||||||||||||||||||||
| 452 | ) | ||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | sub ctcp { | ||||||||||||||||||||||||||||
| 456 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
ctcp: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 457 | 0 | $self->yield( ctcp => @_ ) | |||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | sub _ctcp { | ||||||||||||||||||||||||||||
| 461 | 0 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_ctcp: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 462 | 0 | my ($type, $target, @data) = @_[ARG0 .. $#_]; | |||||||||||||||||||||||||||
| 463 | 0 | my $line = join ' ', uc($type), @data; | |||||||||||||||||||||||||||
| 464 | 0 | my $quoted = ctcp_quote($line); | |||||||||||||||||||||||||||
| 465 | 0 | $self->send( | |||||||||||||||||||||||||||
| 466 | ircmsg( | ||||||||||||||||||||||||||||
| 467 | command => 'privmsg', | ||||||||||||||||||||||||||||
| 468 | params => [ $target, $quoted ] | ||||||||||||||||||||||||||||
| 469 | ) | ||||||||||||||||||||||||||||
| 470 | ) | ||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | sub mode { | ||||||||||||||||||||||||||||
| 474 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
mode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 475 | 2 | $self->yield( mode => @_ ) | |||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | sub _mode { | ||||||||||||||||||||||||||||
| 479 | 3 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_mode: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 480 | 3 | my ($target, $mode) = @_[ARG0, ARG1]; | |||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | 3 | ▶ | if (blessed $mode && $mode->isa('IRC::Mode::Set')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($mode) and $mode->isa("IRC::Mode::Set")
MC/DC50%1/2
builtin::blessed($mode) and $mode->isa("IRC::Mode::Set")
builtin::blessed($mode)
$mode->isa("IRC::Mode::Set")
Truth table66%2/3
A and B
A= builtin::blessed($mode)B= $mode->isa("IRC::Mode::Set")
| |||||||||||||||||||||||||||||
| 483 | ## FIXME tests for same | ||||||||||||||||||||||||||||
| 484 | ## FIXME accept an opt to allow passing in MODES= ? | ||||||||||||||||||||||||||||
| 485 | ## don't really want to parse/store isupport here | ||||||||||||||||||||||||||||
| 486 | ## (stateful subclasses should worry about it) | ||||||||||||||||||||||||||||
| 487 | 1 | for my $set ($mode->split_mode_set(4)) { | |||||||||||||||||||||||||||
| 488 | 1 | $self->call( mode => $target, $set->mode_string ) | |||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||
| 490 | 1 | return $self | |||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | $self->send( | ||||||||||||||||||||||||||||
| 494 | 2 | ircmsg( | |||||||||||||||||||||||||||
| 495 | command => 'mode', | ||||||||||||||||||||||||||||
| 496 | params => [ $target, $mode ], | ||||||||||||||||||||||||||||
| 497 | ) | ||||||||||||||||||||||||||||
| 498 | ) | ||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | sub join { | ||||||||||||||||||||||||||||
| 502 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
join: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 503 | 0 | $self->yield( join => @_ ) | |||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | sub _join { | ||||||||||||||||||||||||||||
| 507 | 0 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_join: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 508 | 0 | my $join_to = CORE::join ',', @_[ARG0 .. $#_]; | |||||||||||||||||||||||||||
| 509 | 0 | $self->send( | |||||||||||||||||||||||||||
| 510 | ircmsg( | ||||||||||||||||||||||||||||
| 511 | command => 'join', | ||||||||||||||||||||||||||||
| 512 | params => [ $join_to ], | ||||||||||||||||||||||||||||
| 513 | ) | ||||||||||||||||||||||||||||
| 514 | ) | ||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | sub part { | ||||||||||||||||||||||||||||
| 518 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
part: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 519 | 0 | $self->yield( part => @_ ) | |||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | sub _part { | ||||||||||||||||||||||||||||
| 523 | 0 | ▶ | my (undef, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||
|
Subroutine
_part: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 524 | 0 | my ($channel, $msg) = @_[ARG0, ARG1]; | |||||||||||||||||||||||||||
| 525 | 0 | $self->send( | |||||||||||||||||||||||||||
| 526 | ircmsg( | ||||||||||||||||||||||||||||
| 527 | command => 'part', | ||||||||||||||||||||||||||||
| 528 | params => [ $channel, $msg ], | ||||||||||||||||||||||||||||
| 529 | ) | ||||||||||||||||||||||||||||
| 530 | ); | ||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 1 | 1; | |||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | =pod | ||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | =head1 NAME | ||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | POEx::IRC::Client::Lite - Minimalist POE IRC interface | ||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||
| 541 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | package MyClient; | ||||||||||||||||||||||||||||
| 544 | use POE; | ||||||||||||||||||||||||||||
| 545 | use POEx::IRC::Client::Lite; | ||||||||||||||||||||||||||||
| 546 | use IRC::Toolkit; | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | our @channels = ( '#otw', '#eris' ); | ||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||
| 550 | POE::Session->create( | ||||||||||||||||||||||||||||
| 551 | package_states => [ | ||||||||||||||||||||||||||||
| 552 | MyClient => [ qw/ | ||||||||||||||||||||||||||||
| 553 | _start | ||||||||||||||||||||||||||||
| 554 | recv_irc_001 | ||||||||||||||||||||||||||||
| 555 | recv_irc_public_msg | ||||||||||||||||||||||||||||
| 556 | recv_irc_ctcp_version | ||||||||||||||||||||||||||||
| 557 | / ], | ||||||||||||||||||||||||||||
| 558 | ], | ||||||||||||||||||||||||||||
| 559 | ); | ||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||
| 561 | sub _start { | ||||||||||||||||||||||||||||
| 562 | my ($kern, $heap) = @_[KERNEL, HEAP]; | ||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||
| 564 | $heap->{irc} = POEx::IRC::Client::Lite->new( | ||||||||||||||||||||||||||||
| 565 | event_prefix => 'recv_', | ||||||||||||||||||||||||||||
| 566 | server => "irc.perl.org", | ||||||||||||||||||||||||||||
| 567 | nick => "MyNick", | ||||||||||||||||||||||||||||
| 568 | username => "myuser", | ||||||||||||||||||||||||||||
| 569 | ); | ||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||
| 571 | $heap->{irc}->connect; | ||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||
| 574 | sub recv_irc_001 { | ||||||||||||||||||||||||||||
| 575 | my ($kern, $heap) = @_[KERNEL, HEAP]; | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | $heap->{irc}->join(@channels)->privmsg( | ||||||||||||||||||||||||||||
| 578 | join(',', @channels), "hello!" | ||||||||||||||||||||||||||||
| 579 | ); | ||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||
| 582 | sub recv_irc_public_msg { | ||||||||||||||||||||||||||||
| 583 | my ($kern, $heap) = @_[KERNEL, HEAP]; | ||||||||||||||||||||||||||||
| 584 | my $event = $_[ARG0]; | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | my ($target, $string) = @{ $event->params }; | ||||||||||||||||||||||||||||
| 587 | my $from = parse_user( $event->prefix ); | ||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||
| 589 | if (lc($string||'') eq 'hello') { | ||||||||||||||||||||||||||||
| 590 | $heap->{irc}->privmsg($target, "hello there, $from") | ||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | sub recv_irc_ctcp_version { | ||||||||||||||||||||||||||||
| 595 | my ($kern, $heap) = @_[KERNEL, HEAP]; | ||||||||||||||||||||||||||||
| 596 | my $event = $_[ARG0]; | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | my $from = parse_user( $event->prefix ); | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | $heap->{irc}->notice( $from => | ||||||||||||||||||||||||||||
| 601 | ctcp_quote("VERSION a silly Client::Lite example") | ||||||||||||||||||||||||||||
| 602 | ); | ||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||
| 605 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||
| 607 | A very thin (but pluggable / extensible) IRC client library using | ||||||||||||||||||||||||||||
| 608 | L<POEx::IRC::Backend> and L<IRC::Toolkit> on top of | ||||||||||||||||||||||||||||
| 609 | L<MooX::Role::POE::Emitter> and L<MooX::Role::Pluggable>. | ||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||
| 611 | No state is maintained; POEx::IRC::Client::Lite provides a | ||||||||||||||||||||||||||||
| 612 | minimalist interface to IRC and serves as a base class for stateful clients. | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | This is early development software pulled out of a much larger in-progress | ||||||||||||||||||||||||||||
| 615 | project. | ||||||||||||||||||||||||||||
| 616 | B<< See L<POE::Component::IRC> for a more mature POE IRC client library. >> | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | =head2 new | ||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | my $irc = POEx::IRC::Client::Lite->new( | ||||||||||||||||||||||||||||
| 621 | event_prefix => $prefix, | ||||||||||||||||||||||||||||
| 622 | server => $server, | ||||||||||||||||||||||||||||
| 623 | nick => $nickname, | ||||||||||||||||||||||||||||
| 624 | username => $username, | ||||||||||||||||||||||||||||
| 625 | ); | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | Create a new Client::Lite instance. Optional arguments are: | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | =over | ||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||
| 631 | =item bindaddr | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | Local address to bind to. | ||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||
| 635 | =item ipv6 | ||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||
| 637 | Boolean value indicating whether to prefer IPv6. | ||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||
| 639 | =item port | ||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||
| 641 | Remote port to use (defaults to 6667). | ||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||
| 643 | =item ssl | ||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||
| 645 | Boolean value indicating whether to (attempt to) connect via SSL. | ||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||
| 647 | Requires L<POE::Component::SSLify>. | ||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||
| 649 | =item ssl_opts | ||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||
| 651 | An C<ARRAY> containing SSL options passed along to L<POE::Component::SSLify> | ||||||||||||||||||||||||||||
| 652 | via L<POEx::IRC::Backend>; see L<POE::Component::SSLify> & L<Net::SSLeay>. | ||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||
| 654 | Not required for basic SSL operation; setting L</ssl> to a true value should | ||||||||||||||||||||||||||||
| 655 | work for most users. | ||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||
| 657 | =item reconnect | ||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||
| 659 | Reconnection attempt delay, in seconds. | ||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||
| 661 | B<< Automatic reconnection is only triggered when an outgoing connector fails! | ||||||||||||||||||||||||||||
| 662 | >> | ||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||
| 664 | You can trigger a reconnection in your own code by handling | ||||||||||||||||||||||||||||
| 665 | L</irc_disconnected> events. For example: | ||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||
| 667 | sub irc_disconnected { | ||||||||||||||||||||||||||||
| 668 | # Immediate reconnect; you may want to use a timer (to avoid being banned) | ||||||||||||||||||||||||||||
| 669 | # Assuming our IRC component's object lives in our session's HEAP: | ||||||||||||||||||||||||||||
| 670 | $_[HEAP]->{irc}->connect | ||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||
| 673 | =back | ||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||
| 675 | =head2 stop | ||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | $irc->stop; | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | Disconnect, stop the Emitter, and purge the plugin pipeline. | ||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||
| 681 | =head2 IRC Methods | ||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||
| 683 | IRC-related methods can be called via normal method dispatch or sent as a POE | ||||||||||||||||||||||||||||
| 684 | event: | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | ## These are equivalent: | ||||||||||||||||||||||||||||
| 687 | $irc->send( $ircevent ); | ||||||||||||||||||||||||||||
| 688 | $irc->yield( 'send', $ircevent ); | ||||||||||||||||||||||||||||
| 689 | $poe_kernel->post( $irc->session_id, 'send', $ircevent ); | ||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||
| 691 | Methods that dispatch to IRC return C<$self>, so they can be chained: | ||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||
| 693 | $irc->connect->join(@channels)->privmsg( | ||||||||||||||||||||||||||||
| 694 | join(',', @channels), | ||||||||||||||||||||||||||||
| 695 | 'hello there!' | ||||||||||||||||||||||||||||
| 696 | ); | ||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | =head3 connect | ||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||
| 700 | $irc->connect; | ||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||
| 702 | Attempt an outgoing connection. | ||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | =head3 disconnect | ||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||
| 706 | $irc->disconnect($message); | ||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | Quit IRC and shut down the wheel. | ||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||
| 710 | =head3 send | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | use IRC::Message::Object 'ircmsg'; | ||||||||||||||||||||||||||||
| 713 | $irc->send( | ||||||||||||||||||||||||||||
| 714 | ircmsg( | ||||||||||||||||||||||||||||
| 715 | command => 'oper', | ||||||||||||||||||||||||||||
| 716 | params => [ $user, $passwd ], | ||||||||||||||||||||||||||||
| 717 | ) | ||||||||||||||||||||||||||||
| 718 | ); | ||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||
| 720 | ## ... or a raw HASH: | ||||||||||||||||||||||||||||
| 721 | $irc->send( | ||||||||||||||||||||||||||||
| 722 | { | ||||||||||||||||||||||||||||
| 723 | command => 'oper', | ||||||||||||||||||||||||||||
| 724 | params => [ $user, $passwd ], | ||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||
| 726 | ) | ||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||
| 728 | ## ... or a raw line: | ||||||||||||||||||||||||||||
| 729 | $irc->send_raw_line('PRIVMSG avenj :some things'); | ||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||
| 731 | Use C<send()> to send an L<IRC::Message::Object> or a compatible | ||||||||||||||||||||||||||||
| 732 | HASH; this method will also take a list of events in either of those formats. | ||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | =head3 send_raw_line | ||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||
| 736 | Use C<send_raw_line()> to send a single raw IRC line. This is rarely a good | ||||||||||||||||||||||||||||
| 737 | idea; L<POEx::IRC::Backend> provides an IRCv3-capable filter. | ||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||
| 739 | =head3 set_nick | ||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||
| 741 | $irc->set_nick( $new_nick ); | ||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||
| 743 | Attempt to change the current nickname. | ||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||
| 745 | =head3 privmsg | ||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||
| 747 | $irc->privmsg( $target, $string ); | ||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||
| 749 | Sends a PRIVMSG to the specified target. | ||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||
| 751 | =head3 notice | ||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||
| 753 | $irc->notice( $target, $string ); | ||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||
| 755 | Sends a NOTICE to the specified target. | ||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||
| 757 | =head3 ctcp | ||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||
| 759 | $irc->ctcp( $target, $type, @params ); | ||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||
| 761 | Encodes and sends a CTCP B<request> to the target. | ||||||||||||||||||||||||||||
| 762 | (To send a CTCP B<reply>, send a L</notice> that has been quoted via | ||||||||||||||||||||||||||||
| 763 | L<IRC::Toolkit::CTCP/"ctcp_quote">.) | ||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||
| 765 | =head3 mode | ||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||
| 767 | $irc->mode( $channel, $modestring ); | ||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | Sends a MODE for the specified target. | ||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||
| 771 | Takes a channel name as a string and a mode change as either a string or an | ||||||||||||||||||||||||||||
| 772 | L<IRC::Mode::Set>. | ||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||
| 774 | =head3 join | ||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||
| 776 | $irc->join( $channel ); | ||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||
| 778 | Attempts to join the specified channel. | ||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||
| 780 | =head3 part | ||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||
| 782 | $irc->part( $channel, $message ); | ||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||
| 784 | Attempts to leave the specified channel with an optional PART message. | ||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||
| 786 | =head2 Attributes | ||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||
| 788 | =head3 conn | ||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||
| 790 | The L<POEx::IRC::Backend::Connect> instance for our connection. | ||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||
| 792 | =head3 nick | ||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||
| 794 | The nickname we were spawned with. | ||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||
| 796 | This class doesn't track nick changes; if our nick is changed later, ->nick() | ||||||||||||||||||||||||||||
| 797 | is not updated. | ||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | =head3 server | ||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||
| 801 | The server we were instructed to connect to. | ||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||
| 803 | =head1 Emitted Events | ||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | =head2 IRC events | ||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||
| 807 | All IRC events are emitted as 'irc_$cmd' e.g. 'irc_005' (ISUPPORT) or | ||||||||||||||||||||||||||||
| 808 | 'irc_mode' with a few notable exceptions, detailed below. | ||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||
| 810 | C<$_[ARG0]> is the L<IRC::Message::Object>. | ||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||
| 812 | =head2 Special events | ||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||
| 814 | =head3 irc_connected | ||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||
| 816 | Emitted when a connection has been successfully opened. | ||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||
| 818 | This does not indicate successful server registration, only that the | ||||||||||||||||||||||||||||
| 819 | connection has been opened and registration details have been sent. | ||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||
| 821 | C<$_[ARG0]> is the L<POEx::IRC::Backend::Connect> object. | ||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||
| 823 | =head3 irc_connector_failed | ||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||
| 825 | Emitted if an outgoing connection could not be established. | ||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||
| 827 | C<< @_[ARG0 .. ARG3] >> are the operation, errno, and error string passed in | ||||||||||||||||||||||||||||
| 828 | by L<POEx::IRC::Backend>; see L<POEx::IRC::Backend/ircsock_connector_failure>. | ||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||
| 830 | =head3 irc_connector_killed | ||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||
| 832 | Emitted if a connection is terminated during L</preregister>. | ||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | C<$_[ARG0]> is the L<POEx::IRC::Backend::Connect> object. | ||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||
| 836 | =head3 irc_private_message | ||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||
| 838 | Emitted for PRIVMSG-type messages not covered by L</irc_public_message>. | ||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||
| 840 | =head3 irc_public_message | ||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||
| 842 | Emitted for PRIVMSG-type messages that appear to be destined for a channel | ||||||||||||||||||||||||||||
| 843 | target. | ||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||
| 845 | =head3 irc_ctcp_TYPE | ||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||
| 847 | Emitted for incoming CTCP requests. TYPE is the request type, such as | ||||||||||||||||||||||||||||
| 848 | 'version' | ||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||
| 850 | C<$_[ARG0]> is the L<IRC::Message::Object> produced by | ||||||||||||||||||||||||||||
| 851 | L<IRC::Toolkit::CTCP/ctcp_extract>. | ||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||
| 853 | An example of sending a CTCP reply lives in L</SYNOPSIS>. | ||||||||||||||||||||||||||||
| 854 | See L<IRC::Toolkit::CTCP> for CTCP-related helpers. | ||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||
| 856 | =head3 irc_ctcpreply_TYPE | ||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||
| 858 | Emitted for incoming CTCP replies. | ||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||
| 860 | Mirrors the behavior of L</irc_ctcp_TYPE> | ||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||
| 862 | =head3 irc_disconnected | ||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||
| 864 | Emitted when an IRC connection has been disconnected at the backend. | ||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||
| 866 | C<$_[ARG0]> is the disconnect string from L<POEx::IRC::Backend>. | ||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||
| 868 | C<$_[ARG1]> is the L<POEx::IRC::Backend::Connect> that was disconnected. | ||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||
| 870 | =head1 Pluggable Events | ||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||
| 872 | These are events explicitly dispatched to plugins | ||||||||||||||||||||||||||||
| 873 | via L<MooX::Role::POE::Emitter/process>; | ||||||||||||||||||||||||||||
| 874 | see L<MooX::Role::POE::Emitter> and L<MooX::Role::Pluggable> for more on | ||||||||||||||||||||||||||||
| 875 | making use of plugins. | ||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||
| 877 | =head2 preregister | ||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||
| 879 | Dispatched to plugins when an outgoing connection has been established, | ||||||||||||||||||||||||||||
| 880 | but prior to registration. | ||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||
| 882 | The first argument is the L<POEx::IRC::Backend::Connect> object. | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | Returning EAT_ALL (see L<MooX::Role::Pluggable::Constants>) to Client::Lite | ||||||||||||||||||||||||||||
| 885 | will terminate the connection without registering. | ||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||
| 887 | =head2 outgoing | ||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||
| 889 | Dispatched to plugins prior to sending output. | ||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||
| 891 | The first argument is the item being sent. Note that no sanity checks are | ||||||||||||||||||||||||||||
| 892 | performed on the item(s) at this stage (this is done after items are passed to | ||||||||||||||||||||||||||||
| 893 | the L<POEx::IRC::Backend> instance) -- your plugin's handler could receive a | ||||||||||||||||||||||||||||
| 894 | HASH, an L<IRC::Message::Object>, a raw line, or something invalid. | ||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||
| 896 | Returning EAT_ALL will skip sending the item. | ||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||
| 898 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||
| 900 | L<POE::Component::IRC>, a fully-featured POE IRC client library | ||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||
| 902 | L<IRC::Toolkit> | ||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||
| 904 | L<POEx::IRC::Backend> | ||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||
| 906 | L<POE::Filter::IRCv3> | ||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | L<MooX::Role::POE::Emitter> | ||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||
| 910 | L<MooX::Role::Pluggable> | ||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||
| 912 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||
| 914 | Jon Portnoy <avenj@cobaltirc.org> | ||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||
| 916 | =begin Pod::Coverage | ||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||
| 918 | BUILD | ||||||||||||||||||||||||||||
| 919 | N_(?i:[A-Z0-9_])+ | ||||||||||||||||||||||||||||
| 920 | ircsock_(?i:[A-Z_])+ | ||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||
| 922 | =end Pod::Coverage | ||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||
| 924 | =cut | ||||||||||||||||||||||||||||