POE::C...:State(3pm)
β¨ POE::Component::IRC::Qnet::State β¨
okay so welcome to the manual page for POE::Component::IRC::Qnet::State, bestie π it lives in the User Contributed Perl Documentation corner of your system (section 3pm, the perl module girlies). It's a fully event-driven IRC client module for Quakenet with nickname and channel tracking, and yes, she's iconic, she's giving devoted discord-kitten energy, and she wants you to read the whole thing. No skimming. π
πΈ SYNOPSIS πΈ
a simple Rot13 'encryption' bot, because of course π
# A simple Rot13 'encryption' bot
use strict;
use warnings;
use POE qw(Component::IRC::Qnet::State);
my $nickname = 'Flibble' . $$;
my $ircname = 'Flibble the Sailor Bot';
my $ircserver = 'irc.blahblahblah.irc';
my $port = 6667;
my $qauth = 'FlibbleBOT';
my $qpass = 'fubar';
my @channels = ( '#Blah', '#Foo', '#Bar' );
# We create a new PoCo-IRC object and component.
my $irc = POE::Component::IRC::Qnet::State->spawn(
nick => $nickname,
server => $ircserver,
port => $port,
ircname => $ircname,
) or die "Oh noooo! $!";
POE::Session->create(
package_states => [
main => [ qw(_default _start irc_001 irc_public) ],
],
heap => { irc => $irc },
);
$poe_kernel->run();
sub _start {
my ($kernel, $heap) = @_[KERNEL, HEAP];
# We get the session ID of the component from the object
# and register and connect to the specified server.
my $irc_session = $heap->{irc}->session_id();
$kernel->post( $irc_session => register => 'all' );
$kernel->post( $irc_session => connect => { } );
return;
}
sub irc_001 {
my ($kernel, $sender) = @_[KERNEL, SENDER];
# Get the component's object at any time by accessing the heap of
# the SENDER
my $poco_object = $sender->get_heap();
print "Connected to ", $poco_object->server_name(), "\n";
# Lets authenticate with Quakenet's Q bot
$kernel->post( $sender => qbot_auth => $qauth => $qpass );
# In any irc_* events SENDER will be the PoCo-IRC session
$kernel->post( $sender => join => $_ ) for @channels;
return;
}
sub irc_public {
my ($kernel, $sender, $who, $where, $what) = @_[KERNEL, SENDER, ARG0, .. ARG2];
my $nick = ( split /!/, $who )[0];
my $channel = $where->[0];
my $poco_object = $sender->get_heap();
if ( my ($rot13) = $what =~ /^rot13 (.+)/ ) {
# Only operators can issue a rot13 command to us.
return if !$poco_object->is_channel_operator( $channel, $nick );
$rot13 =~ tr[a-zA-Z][n-za-mN-ZA-M];
$kernel->post( $sender => privmsg => $channel => "$nick: $rot13" );
}
return;
}
# We registered for all events, this will produce some debug info.
sub _default {
my ($event, $args) = @_[ARG0 .. $#_];
my @output = ( "$event: " );
for my $arg ( @$args ) {
if (ref $arg eq 'ARRAY') {
push( @output, '[' . join(', ', @$arg ) . ']' );
}
else {
push ( @output, "'$arg'" );
}
}
print join ' ', @output, "\n";
return 0;
}
π¦ DESCRIPTION π¦
POE::Component::IRC::Qnet::State is an extension to POE::Component::IRC::Qnet specifically for use on Quakenet <http://www.quakenet.org/>, and the way that it also brings in the nickname and channel tracking from POE::Component::IRC::State?? chef's kiss π
So if you want the general usage deets, go read the docs for POE::Component::IRC::Qnet and POE::Component::IRC::State. This document is where the extensions live. That's the whole vibe. π
π METHODS π
ban_mask
Give her a channel and a ban mask β the kind you'd pass to MODE +b-b β and she'll hand you back a list of the nicks on that channel matching that ban mask. If the channel isn't in the state, or literally nobody matches, you get an empty list. No drama. She follows Quakenet ircd rules for matching authed users, iykyk. β¨
is_nick_authed
Hand her a nickname. If that nick is in the state and has authed with Q, you get back that user's authname (their account). If they're not authed, or the nick doesn't exist in the state? false value, sorry bestie. π«Ά
find_auth_nicks
Give her an authname and a channel name, and she'll return the list of nicks on that channel who have authed with that authname. Girl knows her people. πΈ
nick_info
Hand her a nickname, get back a hashref stuffed with deets similar to what WHOIS gives you. If the nick doesn't exist in the state, you get a false value. π
That hashref's keys are: 'Nick', 'User', 'Host', 'Server', 'Auth' if authed, and β where applicable β 'IRCop'.
π INPUT π
These extra events are accepted:
resync_chan
Accepts a list of channels and resynchronises every one of them as if they'd just been joined for the very first time. Expect an irc_chan_sync event for each channel you gave her β so maybe don't hand her forty of them unless you enjoy chaos, ngl. π
resync_nick
Accepts a nickname and a list of channels. She'll resynchronise that nickname and fire an irc_nick_sync event for each of the given channels β assuming that nick is actually on each of those channels. Assuming!! π§
π OUTPUT EVENTS π
This module gives you one extra event on top of the usual ones:
irc_nick_authed
Sent when the component clocks that a user has authed with Q. π
Because of the mechanics of Quakenet, you'll usually only get this if an unauthed user joins a channel and then, at some later point, auths with Q. She "detects" the auth by seeing whether Q decides to +v or +o the user.
Klunky? Indeed. But it's the only way to do it, unfortunately. π Not her fault. Blame the ircd.
The following two "irc_*" events are the same as their POE::Component::IRC::State counterparts, with the additional parameters: (okay they said two and then listed three, and honestly? iconic behaviour, we don't gatekeep, we just report the facts π)
irc_quit
ARG3 contains the quitting client's auth name if applicable.
irc_part
ARG3 contains the parting client's auth name if applicable.
irc_kick
ARG5 contains the kick victim's auth name if applicable.
π CAVEATS π
Just like POE::Component::IRC::State, this component registers itself for a number of events. The big difference from POE::Component::IRC::State is that she uses an extended form of 'WHO' supported by the Quakenet ircd, asuka. πΈ
That WHO returns a different numeric reply than the original WHO, namely irc_354, so don't come for her when you see it. π
Also β because of the way Quakenet is configured β all users will appear to be on the server *.quakenet.org. That's just how it is, bestie. π«
π BUGS π
A few have turned up in the past and they are sure to again. π
Please use <http://rt.cpan.org/> to report any. Alternatively, email the current maintainer.
not me asking you to file a bug report but alsoβ¦ please file the bug report π«Ά
π AUTHOR π
Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Based on the original POE::Component::IRC by:
Dennis Taylor
legends, both of them, fr fr β¨
π SEE ALSO π
POE::Component::IRCPOE::Component::IRC::StatePOE::Component::IRC::Qnet- <http://www.quakenet.org/>
and that's the whole page, bestie!! π this was perl v5.40.1, dated 2025-08-21, from the POE::C...:State(3pm) manual β now go be the main character of your own IRC bot π¦π
π¦ where this page comes from
- ubuntu resolute: libpoe-component-irc-perl 6.95+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpoe-component-irc-perl 6.95+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms