3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-07 20:49:31 +01:00

Move core packages into PBot/Core

This commit is contained in:
Pragmatic Software 2021-07-20 22:44:51 -07:00
parent 799424fcfa
commit f0e617fef7
47 changed files with 231 additions and 230 deletions

View File

@ -9,12 +9,12 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::AntiFlood; package PBot::Core::AntiFlood;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
use PBot::MessageHistory::Constants ':all'; use PBot::Core::MessageHistory::Constants ':all';
use Time::HiRes qw(gettimeofday tv_interval); use Time::HiRes qw(gettimeofday tv_interval);
use Time::Duration; use Time::Duration;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::AntiSpam; package PBot::Core::AntiSpam;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -7,9 +7,9 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::BanList; package PBot::Core::BanList;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::BlackList; package PBot::Core::BlackList;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Capabilities; package PBot::Core::Capabilities;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
@ -44,7 +44,7 @@ sub has {
$depth //= 10; # set depth to 10 if it's not defined $depth //= 10; # set depth to 10 if it's not defined
if (--$depth <= 0) { if (--$depth <= 0) {
$self->{pbot}->{logger}->log("Max recursion reached for PBot::Capabilities->has($cap, $subcap)\n"); $self->{pbot}->{logger}->log("Max recursion reached for PBot::Core::Capabilities->has($cap, $subcap)\n");
return 0; return 0;
} }

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::ChanOps; package PBot::Core::ChanOps;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Channels; package PBot::Core::Channels;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -6,7 +6,7 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Class; package PBot::Core::Class;
use PBot::Imports; use PBot::Imports;

View File

@ -6,8 +6,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Commands; package PBot::Core::Commands;
use parent 'PBot::Class', 'PBot::Registerable'; use parent 'PBot::Core::Class', 'PBot::Core::Registerable';
use PBot::Imports; use PBot::Imports;
@ -16,8 +16,8 @@ use PBot::Utils::LoadPackages qw/load_packages/;
sub initialize { sub initialize {
my ($self, %conf) = @_; my ($self, %conf) = @_;
# PBot::Commands can register subrefs # PBot::Core::Commands can register subrefs
$self->PBot::Registerable::initialize(%conf); $self->PBot::Core::Registerable::initialize(%conf);
# command metadata stored as a HashObject # command metadata stored as a HashObject
$self->{metadata} = PBot::Storage::HashObject->new(pbot => $self->{pbot}, name => 'Command metadata', filename => $conf{filename}); $self->{metadata} = PBot::Storage::HashObject->new(pbot => $self->{pbot}, name => 'Command metadata', filename => $conf{filename});
@ -40,7 +40,7 @@ sub register {
} }
# register subref # register subref
my $command = $self->PBot::Registerable::register($subref); my $command = $self->PBot::Core::Registerable::register($subref);
# update internal metadata # update internal metadata
$command->{name} = lc $name; $command->{name} = lc $name;
@ -90,8 +90,8 @@ sub get_meta {
return $self->{metadata}->get_data($command, $key); return $self->{metadata}->get_data($command, $key);
} }
# main entry point for PBot::Interpreter to interpret a registered bot command # main entry point for PBot::Core::Interpreter to interpret a registered bot command
# see also PBot::Factoids::interpreter() for factoid commands # see also PBot::Core::Factoids::interpreter() for factoid commands
sub interpreter { sub interpreter {
my ($self, $context) = @_; my ($self, $context) = @_;

View File

@ -2,13 +2,13 @@
# #
# Purpose: Registers event handlers and dispatches events to them. # Purpose: Registers event handlers and dispatches events to them.
# #
# Note: PBot::EventDispatcher has no relation to PBot::EventQueue. # Note: PBot::Core::EventDispatcher has no relation to PBot::Core::EventQueue.
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::EventDispatcher; package PBot::Core::EventDispatcher;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -3,13 +3,13 @@
# Purpose: Provides functionality to manage event subroutines which are invoked # Purpose: Provides functionality to manage event subroutines which are invoked
# at a future time, optionally recurring. # at a future time, optionally recurring.
# #
# Note: PBot::EventQueue has no relation to PBot::EventDispatcher. # Note: PBot::Core::EventQueue has no relation to PBot::Core::EventDispatcher.
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::EventQueue; package PBot::Core::EventQueue;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Factoids; package PBot::Core::Factoids;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
@ -280,7 +280,7 @@ sub find_factoid {
my $dump = Dumper \%opts; my $dump = Dumper \%opts;
$self->{pbot}->{logger}->log("+" x 32 . "\n"); $self->{pbot}->{logger}->log("+" x 32 . "\n");
use Devel::StackTrace; use Devel::StackTrace;
my $trace = Devel::StackTrace->new(indent => 1, ignore_class => ['PBot::PBot', 'PBot::IRC']); my $trace = Devel::StackTrace->new(indent => 1, ignore_class => ['PBot::PBot', 'PBot::Core::IRC']);
$self->{pbot}->{logger}->log("find_factoid stacktrace: " . $trace->as_string() . "\n"); $self->{pbot}->{logger}->log("find_factoid stacktrace: " . $trace->as_string() . "\n");
$self->{pbot}->{logger}->log("find_factiod: from: $from, kw: $keyword, opts: $dump\n"); $self->{pbot}->{logger}->log("find_factiod: from: $from, kw: $keyword, opts: $dump\n");
@ -1079,7 +1079,7 @@ sub execute_code_factoid {
return $self->execute_code_factoid_using_vm(@args); return $self->execute_code_factoid_using_vm(@args);
} }
# main entry point for PBot::Interpreter to interpret a factoid command # main entry point for PBot::Core::Interpreter to interpret a factoid command
sub interpreter { sub interpreter {
my ($self, $context) = @_; my ($self, $context) = @_;
my $pbot = $self->{pbot}; my $pbot = $self->{pbot};

View File

@ -16,8 +16,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Functions; package PBot::Core::Functions;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -13,12 +13,12 @@
##################################################################### #####################################################################
# $Id: IRC.pm,v 1.10 2004/04/30 18:02:51 jmuhlich Exp $ # $Id: IRC.pm,v 1.10 2004/04/30 18:02:51 jmuhlich Exp $
package PBot::IRC; # pragma_ 2011/01/21 package PBot::Core::IRC; # pragma_ 2011/01/21
BEGIN { require 5.004; } # needs IO::* and $coderef->(@args) syntax BEGIN { require 5.004; } # needs IO::* and $coderef->(@args) syntax
use PBot::IRC::Connection; # pragma_ 2011/01/21 use PBot::Core::IRC::Connection; # pragma_ 2011/01/21
use PBot::IRC::EventQueue; # pragma_ 2011/01/21 use PBot::Core::IRC::EventQueue; # pragma_ 2011/01/21
use IO::Select; use IO::Select;
use Carp; use Carp;
@ -45,8 +45,8 @@ sub new {
'_connhash' => {}, '_connhash' => {},
'_error' => IO::Select->new(), '_error' => IO::Select->new(),
'_debug' => 0, '_debug' => 0,
'_schedulequeue' => new PBot::IRC::EventQueue(), # pragma_ 2011/01/21 '_schedulequeue' => new PBot::Core::IRC::EventQueue(), # pragma_ 2011/01/21
'_outputqueue' => new PBot::IRC::EventQueue(), # pragma_ 2011/01/21 '_outputqueue' => new PBot::Core::IRC::EventQueue(), # pragma_ 2011/01/21
'_read' => IO::Select->new(), '_read' => IO::Select->new(),
'_timeout' => 0, '_timeout' => 0,
'_write' => IO::Select->new(), '_write' => IO::Select->new(),
@ -136,7 +136,7 @@ sub do_one_loop {
# we don't want to bother waiting on input or running # we don't want to bother waiting on input or running
# scheduled events if we're just flushing the output queue # scheduled events if we're just flushing the output queue
# so we bail out here # so we bail out here
return if $caller eq 'PBot::IRC::flush_output_queue'; # pragma_ 2011/01/21 return if $caller eq 'PBot::Core::IRC::flush_output_queue'; # pragma_ 2011/01/21
# Check the queue for scheduled events to run. # Check the queue for scheduled events to run.
if (!$self->schedulequeue->is_empty) { if (!$self->schedulequeue->is_empty) {
@ -184,7 +184,7 @@ sub flush_output_queue {
# Any args here get passed to Connection->connect(). # Any args here get passed to Connection->connect().
sub newconn { sub newconn {
my $self = shift; my $self = shift;
my $conn = PBot::IRC::Connection->new($self, @_); # pragma_ 2011/01/21 my $conn = PBot::Core::IRC::Connection->new($self, @_); # pragma_ 2011/01/21
return if $conn->error; return if $conn->error;
return $conn; return $conn;

View File

@ -13,13 +13,13 @@
# # # #
##################################################################### #####################################################################
package PBot::IRC::Connection; # pragma_ 2011/21/01 package PBot::Core::IRC::Connection; # pragma_ 2011/21/01
use feature 'unicode_strings'; use feature 'unicode_strings';
use utf8; use utf8;
use PBot::IRC::Event; # pragma_ 2011/21/01 use PBot::Core::IRC::Event; # pragma_ 2011/21/01
use PBot::IRC::DCC; # pragma_ 2011/21/01 use PBot::Core::IRC::DCC; # pragma_ 2011/21/01
use IO::Socket; use IO::Socket;
use IO::Socket::INET; use IO::Socket::INET;
use Symbol; use Symbol;
@ -155,7 +155,7 @@ sub _add_generic_handler {
foreach $ev (ref $event eq "ARRAY" ? @{$event} : $event) { foreach $ev (ref $event eq "ARRAY" ? @{$event} : $event) {
# Translate numerics to names # Translate numerics to names
if ($ev =~ /^\d/) { if ($ev =~ /^\d/) {
$ev = PBot::IRC::Event->trans($ev); # pragma_ 2011/21/01 $ev = PBot::Core::IRC::Event->trans($ev); # pragma_ 2011/21/01
unless ($ev) { unless ($ev) {
carp "Unknown event type in $real_name: $ev"; carp "Unknown event type in $real_name: $ev";
return; return;
@ -194,7 +194,7 @@ sub add_handler {
# Hooks every event we know about... # Hooks every event we know about...
sub add_default_handler { sub add_default_handler {
my ($self, $ref, $rp) = @_; my ($self, $ref, $rp) = @_;
foreach my $eventtype (keys(%PBot::IRC::Event::_names)) { # pragma_ 2011/21/01 foreach my $eventtype (keys(%PBot::Core::IRC::Event::_names)) { # pragma_ 2011/21/01
$self->_add_generic_handler($eventtype, $ref, $rp, $self->{_handler}, 'add_default_handler'); $self->_add_generic_handler($eventtype, $ref, $rp, $self->{_handler}, 'add_default_handler');
} }
return 1; return 1;
@ -459,7 +459,7 @@ sub disconnect {
$self->parent->removeconn($self); $self->parent->removeconn($self);
$self->socket(undef); $self->socket(undef);
$self->handler( $self->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
"disconnect", # pragma_ 2011/21/01 "disconnect", # pragma_ 2011/21/01
$self->server, $self->server,
'', '',
@ -503,7 +503,7 @@ sub handler {
if (ref $event) { $ev = $event->type; } if (ref $event) { $ev = $event->type; }
elsif (defined $event) { elsif (defined $event) {
$ev = $event; $ev = $event;
$event = PBot::IRC::Event->new($event, '', '', ''); # pragma_ 2011/21/01 $event = PBot::Core::IRC::Event->new($event, '', '', ''); # pragma_ 2011/21/01
} else { } else {
croak "Not enough arguments to handler()"; croak "Not enough arguments to handler()";
} }
@ -727,7 +727,7 @@ sub new_chat {
($init, $nick, $address, $port) = @_; ($init, $nick, $address, $port) = @_;
} }
PBot::IRC::DCC::CHAT->new($self, $init, $nick, $address, $port); # pragma_ 2011/21/01 PBot::Core::IRC::DCC::CHAT->new($self, $init, $nick, $address, $port); # pragma_ 2011/21/01
} }
# Creates and returns a DCC GET object, analogous to IRC.pm's newconn(). # Creates and returns a DCC GET object, analogous to IRC.pm's newconn().
@ -764,7 +764,7 @@ sub new_get {
return; # is this behavior OK? return; # is this behavior OK?
} }
my $dcc = PBot::IRC::DCC::GET->new( my $dcc = PBot::Core::IRC::DCC::GET->new(
$self, $nick, $address, $port, $size, # pragma_ 2011/21/01 $self, $nick, $address, $port, $size, # pragma_ 2011/21/01
$name, $handle, $offset $name, $handle, $offset
); );
@ -784,7 +784,7 @@ sub new_send {
if (ref($_[0]) eq "ARRAY") { ($nick, $filename, $blocksize) = @{$_[0]}; } if (ref($_[0]) eq "ARRAY") { ($nick, $filename, $blocksize) = @{$_[0]}; }
else { ($nick, $filename, $blocksize) = @_; } else { ($nick, $filename, $blocksize) = @_; }
PBot::IRC::DCC::SEND->new($self, $nick, $filename, $blocksize); # pragma_ 2011/21/01 PBot::Core::IRC::DCC::SEND->new($self, $nick, $filename, $blocksize); # pragma_ 2011/21/01
} }
# Selects nick for this object or returns currently set nick. # Selects nick for this object or returns currently set nick.
@ -888,7 +888,7 @@ sub parse {
# Like the RFC says: "respond as quickly as possible..." # Like the RFC says: "respond as quickly as possible..."
if ($line =~ /^PING/) { if ($line =~ /^PING/) {
$ev = ( $ev = (
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
"ping", # pragma_ 2011/21/01 "ping", # pragma_ 2011/21/01
$self->server, $self->server,
$self->nick, $self->nick,
@ -899,7 +899,7 @@ sub parse {
# Had to move this up front to avoid a particularly pernicious bug. # Had to move this up front to avoid a particularly pernicious bug.
} elsif ($line =~ /^NOTICE/) { } elsif ($line =~ /^NOTICE/) {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
"snotice", # pragma_ 2011/21/01 "snotice", # pragma_ 2011/21/01
$self->server, $self->server,
'', '',
@ -908,7 +908,7 @@ sub parse {
); );
} elsif ($line =~ /^AUTHENTICATE \+$/) { # IRCv3 SASL pragma- June 11, 2021 } elsif ($line =~ /^AUTHENTICATE \+$/) { # IRCv3 SASL pragma- June 11, 2021
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
'authenticate', 'authenticate',
$self->server, $self->server,
$self->nick, $self->nick,
@ -1006,7 +1006,7 @@ sub parse {
or $type eq "cap") # IRCv3 client capabilities pragma- or $type eq "cap") # IRCv3 client capabilities pragma-
{ {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
shift(@stuff), shift(@stuff),
@ -1015,7 +1015,7 @@ sub parse {
); );
} elsif ($type eq "quit" or $type eq "nick" or $type eq "account") { } elsif ($type eq "quit" or $type eq "nick" or $type eq "account") {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
$from, $from,
@ -1024,7 +1024,7 @@ sub parse {
); );
} elsif ($type eq "kick") { } elsif ($type eq "kick") {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
$stuff[1], $stuff[1],
@ -1033,7 +1033,7 @@ sub parse {
); );
} elsif ($type eq "kill") { } elsif ($type eq "kill") {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
'', '',
@ -1041,7 +1041,7 @@ sub parse {
$line $line
); # Ahh, what the hell. ); # Ahh, what the hell.
} elsif ($type eq "wallops") { } elsif ($type eq "wallops") {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
'', '',
@ -1049,7 +1049,7 @@ sub parse {
$line $line
); );
} elsif ($type eq "pong") { } elsif ($type eq "pong") {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
'', '',
@ -1070,7 +1070,7 @@ sub parse {
$ev = $self->parse_num($line); $ev = $self->parse_num($line);
} elsif ($line =~ /^:(\w+) MODE \1 /) { } elsif ($line =~ /^:(\w+) MODE \1 /) {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
'umode', # pragma_ 2011/21/01 'umode', # pragma_ 2011/21/01
$self->server, $self->server,
$self->nick, $self->nick,
@ -1086,7 +1086,7 @@ sub parse {
\b/x # Some other crap, whatever... \b/x # Some other crap, whatever...
) )
{ {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
'snotice', # pragma_ 2011/21/01 'snotice', # pragma_ 2011/21/01
$self->server, $self->server,
'', '',
@ -1100,7 +1100,7 @@ sub parse {
$self->disconnect('error', ($line =~ /(.*)/)); $self->disconnect('error', ($line =~ /(.*)/));
} else { } else {
$ev = PBot::IRC::Event->new( $ev = PBot::Core::IRC::Event->new(
"error", # pragma_ 2011/21/01 "error", # pragma_ 2011/21/01
$self->server, $self->server,
'', '',
@ -1157,14 +1157,14 @@ sub parse_ctcp {
$one =~ s/^$ctype //i; # strip the CTCP type off the args $one =~ s/^$ctype //i; # strip the CTCP type off the args
$self->handler( $self->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
$handler, $from, $stuff, # pragma_ 2011/21/01 $handler, $from, $stuff, # pragma_ 2011/21/01
$handler, $one $handler, $one
) )
); );
} }
$self->handler(PBot::IRC::Event->new($type, $from, $stuff, $type, $two)) # pragma_ 2011/21/01 $self->handler(PBot::Core::IRC::Event->new($type, $from, $stuff, $type, $two)) # pragma_ 2011/21/01
if $two; if $two;
} }
return 1; return 1;
@ -1197,7 +1197,7 @@ sub parse_num {
$from = substr $from, 1 if $from =~ /^:/; $from = substr $from, 1 if $from =~ /^:/;
return PBot::IRC::Event->new( return PBot::Core::IRC::Event->new(
$type, # pragma_ 2011/21/01 $type, # pragma_ 2011/21/01
$from, $from,
'', '',

View File

@ -13,7 +13,7 @@
##################################################################### #####################################################################
# $Id: DCC.pm,v 1.1.1.1 2002/11/14 17:32:15 jmuhlich Exp $ # $Id: DCC.pm,v 1.1.1.1 2002/11/14 17:32:15 jmuhlich Exp $
package PBot::IRC::DCC; # pragma_ 2011/21/01 package PBot::Core::IRC::DCC; # pragma_ 2011/21/01
use strict; use strict;
@ -34,7 +34,7 @@ use utf8;
# archon: you offered to shower with a random guy? # archon: you offered to shower with a random guy?
# Methods that can be shared between the various DCC classes. # Methods that can be shared between the various DCC classes.
package PBot::IRC::DCC::Connection; # pragma_ 2011/21/01 package PBot::Core::IRC::DCC::Connection; # pragma_ 2011/21/01
use Carp; use Carp;
use Socket; # need inet_ntoa... use Socket; # need inet_ntoa...
@ -96,7 +96,7 @@ sub _getline {
warn "recv() received 0 bytes in _getline, closing connection.\n" if $self->{_debug}; warn "recv() received 0 bytes in _getline, closing connection.\n" if $self->{_debug};
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -114,7 +114,7 @@ sub _getline {
warn "recv() returned undef, socket error in _getline()\n" if $self->{_debug}; warn "recv() returned undef, socket error in _getline()\n" if $self->{_debug};
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -136,7 +136,7 @@ sub DESTROY {
if ($self->{_socket}->opened) { if ($self->{_socket}->opened) {
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -160,13 +160,13 @@ sub peer { return ($_[0]->{_nick}, "DCC " . $_[0]->{_type}); }
# archon: yeah, but with is much more amusing # archon: yeah, but with is much more amusing
# Connection handling GETs # Connection handling GETs
package PBot::IRC::DCC::GET; # pragma_ 2011/21/01 package PBot::Core::IRC::DCC::GET; # pragma_ 2011/21/01
use IO::Socket; use IO::Socket;
use Carp; use Carp;
use strict; use strict;
@PBot::IRC::DCC::GET::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 @PBot::Core::IRC::DCC::GET::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01
sub new { sub new {
@ -177,7 +177,7 @@ sub new {
my ($sock, $fh); my ($sock, $fh);
# get the address into a dotted quad # get the address into a dotted quad
$address = &PBot::IRC::DCC::Connection::fixaddr($address); # pragma_ 2011/21/01 $address = &PBot::Core::IRC::DCC::Connection::fixaddr($address); # pragma_ 2011/21/01
return if $port < 1024 or not defined $address or $size < 1; return if $port < 1024 or not defined $address or $size < 1;
$fh = defined $handle ? $handle : IO::File->new(">$filename"); $fh = defined $handle ? $handle : IO::File->new(">$filename");
@ -201,7 +201,7 @@ sub new {
if (defined $sock) { if (defined $sock) {
$container->handler( $container->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_open', # pragma_ 2011/21/01 'dcc_open', # pragma_ 2011/21/01
$nick, $nick,
$sock, $sock,
@ -258,7 +258,7 @@ sub parse {
close $self->{_fh}; close $self->{_fh};
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -277,7 +277,7 @@ sub parse {
close $self->{_fh}; close $self->{_fh};
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -297,7 +297,7 @@ sub parse {
close $self->{_fh}; close $self->{_fh};
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -309,7 +309,7 @@ sub parse {
} }
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_update', # pragma_ 2011/21/01 'dcc_update', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self, $self,
@ -328,7 +328,7 @@ sub close {
$self->{_fh}->close; $self->{_fh}->close;
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -350,8 +350,8 @@ sub close {
# archon: waka chica waka chica # archon: waka chica waka chica
# Connection handling SENDs # Connection handling SENDs
package PBot::IRC::DCC::SEND; # pragma_ 2011/21/01 package PBot::Core::IRC::DCC::SEND; # pragma_ 2011/21/01
@PBot::IRC::DCC::SEND::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 @PBot::Core::IRC::DCC::SEND::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01
use IO::File; use IO::File;
use IO::Socket; use IO::Socket;
@ -417,7 +417,7 @@ sub new {
bless $self, $class; bless $self, $class;
$sock = PBot::IRC::DCC::Accept->new($sock, $self); # pragma_ 2011/21/01 $sock = PBot::Core::IRC::DCC::Accept->new($sock, $self); # pragma_ 2011/21/01
unless (defined $sock) { unless (defined $sock) {
carp "Error in accept: $!"; carp "Error in accept: $!";
@ -453,7 +453,7 @@ sub parse {
$self->{_fh}->close; $self->{_fh}->close;
$self->{_parent}->parent->removefh($sock); $self->{_parent}->parent->removefh($sock);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -477,7 +477,7 @@ sub parse {
$self->{_fh}->close; $self->{_fh}->close;
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -498,7 +498,7 @@ sub parse {
$self->{_fh}->close; $self->{_fh}->close;
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -515,7 +515,7 @@ sub parse {
$self->{_fh}->close; $self->{_fh}->close;
$self->{_parent}->parent->removeconn($self); $self->{_parent}->parent->removeconn($self);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -529,7 +529,7 @@ sub parse {
$self->{_bout} += length($buf); $self->{_bout} += length($buf);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_update', # pragma_ 2011/21/01 'dcc_update', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self, $self,
@ -551,8 +551,8 @@ sub parse {
# archon: she gets you drunk and he takes your wallet! # archon: she gets you drunk and he takes your wallet!
# handles CHAT connections # handles CHAT connections
package PBot::IRC::DCC::CHAT; # pragma_ 2011/21/01 package PBot::Core::IRC::DCC::CHAT; # pragma_ 2011/21/01
@PBot::IRC::DCC::CHAT::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 @PBot::Core::IRC::DCC::CHAT::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01
use IO::Socket; use IO::Socket;
use Carp; use Carp;
@ -598,7 +598,7 @@ sub new {
bless $self, $class; bless $self, $class;
$sock = PBot::IRC::DCC::Accept->new($sock, $self); # pragma_ 2011/21/01 $sock = PBot::Core::IRC::DCC::Accept->new($sock, $self); # pragma_ 2011/21/01
unless (defined $sock) { unless (defined $sock) {
carp "Error in DCC CHAT connect: $!"; carp "Error in DCC CHAT connect: $!";
@ -606,7 +606,7 @@ sub new {
} }
} else { # we're connecting } else { # we're connecting
$address = &PBot::IRC::DCC::Connection::fixaddr($address); # pragma_ 2011/21/01 $address = &PBot::Core::IRC::DCC::Connection::fixaddr($address); # pragma_ 2011/21/01
return if $port < 1024 or not defined $address; return if $port < 1024 or not defined $address;
$sock = new IO::Socket::INET( $sock = new IO::Socket::INET(
@ -616,7 +616,7 @@ sub new {
if (defined $sock) { if (defined $sock) {
$container->handler( $container->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_open', # pragma_ 2011/21/01 'dcc_open', # pragma_ 2011/21/01
$nick, $nick,
$sock, $sock,
@ -674,7 +674,7 @@ sub parse {
$self->{_bout} += length($line); $self->{_bout} += length($line);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'chat', # pragma_ 2011/21/01 'chat', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -684,7 +684,7 @@ sub parse {
); );
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_update', # pragma_ 2011/21/01 'dcc_update', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self, $self,
@ -717,9 +717,9 @@ sub privmsg {
# \merlyn: good topic # \merlyn: good topic
# Sockets waiting for accept() use this to shoehorn into the select loop. # Sockets waiting for accept() use this to shoehorn into the select loop.
package PBot::IRC::DCC::Accept; # pragma_ 2011/21/01 package PBot::Core::IRC::DCC::Accept; # pragma_ 2011/21/01
@PBot::IRC::DCC::Accept::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 @PBot::Core::IRC::DCC::Accept::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01
use Carp; use Carp;
use Socket; # we use a lot of Socket functions in parse() use Socket; # we use a lot of Socket functions in parse()
use strict; use strict;
@ -763,7 +763,7 @@ sub parse {
$self->{_parent}->{_fh}->close; $self->{_parent}->{_fh}->close;
$self->{_parent}->{_parent}->parent->removefh($sock); $self->{_parent}->{_parent}->parent->removefh($sock);
$self->{_parent}->handler( $self->{_parent}->handler(
PBot::IRC::Event->new( PBot::Core::IRC::Event->new(
'dcc_close', # pragma_ 2011/21/01 'dcc_close', # pragma_ 2011/21/01
$self->{_nick}, $self->{_nick},
$self->{_socket}, $self->{_socket},
@ -779,7 +779,7 @@ sub parse {
$self->{_parent}->{_parent}->parent->removeconn($self); $self->{_parent}->{_parent}->parent->removeconn($self);
$self->{_parent}->{_parent}->handler( $self->{_parent}->{_parent}->handler(
PBot::IRC::Event-> # pragma_ 2011/21/01 PBot::Core::IRC::Event-> # pragma_ 2011/21/01
new( new(
'dcc_open', 'dcc_open',
$self->{_parent}->{_nick}, $self->{_parent}->{_nick},

View File

@ -22,7 +22,7 @@
# Well, welcome to the real world, guys, where code needs to be # Well, welcome to the real world, guys, where code needs to be
# maintainable and sane. # maintainable and sane.
package PBot::IRC::Event; # pragma_ 2011/21/01 package PBot::Core::IRC::Event; # pragma_ 2011/21/01
use feature 'unicode_strings'; use feature 'unicode_strings';
use utf8; use utf8;
@ -191,7 +191,7 @@ sub userhost {
# Simple sub for translating server numerics to their appropriate names. # Simple sub for translating server numerics to their appropriate names.
# Takes one arg: the number to be translated. # Takes one arg: the number to be translated.
sub trans { sub trans {
shift if (ref($_[0]) || $_[0]) =~ /^PBot::IRC/; # pragma_ 2011/21/01 shift if (ref($_[0]) || $_[0]) =~ /^PBot::Core::IRC/; # pragma_ 2011/21/01
my $ev = shift; my $ev = shift;
return (exists $_names{$ev} ? $_names{$ev} : undef); return (exists $_names{$ev} ? $_names{$ev} : undef);

View File

@ -1,9 +1,9 @@
package PBot::IRC::EventQueue; # pragma_ 2011/21/01 package PBot::Core::IRC::EventQueue; # pragma_ 2011/21/01
use feature 'unicode_strings'; use feature 'unicode_strings';
use utf8; use utf8;
use PBot::IRC::EventQueue::Entry; # pragma_ 2011/21/01 use PBot::Core::IRC::EventQueue::Entry; # pragma_ 2011/21/01
use strict; use strict;
@ -27,7 +27,7 @@ sub enqueue {
my $time = shift; my $time = shift;
my $content = shift; my $content = shift;
my $entry = new PBot::IRC::EventQueue::Entry($time, $content); # pragma_ 2011/21/01 my $entry = new PBot::Core::IRC::EventQueue::Entry($time, $content); # pragma_ 2011/21/01
$self->queue->{$entry->id} = $entry; $self->queue->{$entry->id} = $entry;
return $entry->id; return $entry->id;
} }
@ -45,7 +45,7 @@ sub dequeue {
$result = $self->queue->{$event}; $result = $self->queue->{$event};
delete $self->queue->{$event}; delete $self->queue->{$event};
} else { # we got passed an actual event object } else { # we got passed an actual event object
ref($event) eq 'PBot::IRC::EventQueue::Entry' # pragma_ 2011/21/01 ref($event) eq 'PBot::Core::IRC::EventQueue::Entry' # pragma_ 2011/21/01
or die "Cannot delete event type of " . ref($event) . "!"; or die "Cannot delete event type of " . ref($event) . "!";
$result = $self->queue->{$event->id}; $result = $self->queue->{$event->id};

View File

@ -1,4 +1,4 @@
package PBot::IRC::EventQueue::Entry; # pragma_ 2011/21/01 package PBot::Core::IRC::EventQueue::Entry; # pragma_ 2011/21/01
use strict; use strict;

View File

@ -5,7 +5,7 @@ Table of Contents
------------------------ ------------------------
0. Deprecation notice 0. Deprecation notice
0.1. Forked by pragma- for PBot +- 0.1. Forked by pragma- for PBot
1. Introduction 1. Introduction
2. Availability 2. Availability
3. Prerequisites 3. Prerequisites
@ -28,11 +28,12 @@ only serves to warn current and new users about the status of this distribution.
0.1. Forked by pragma- for PBot 0.1. Forked by pragma- for PBot
------------------------ ------------------------
This module has been forked as part of PBot. It has been added privately to This module has been forked as part of PBot. It has been added privately to
PBot's repository because I do not have CPAN access, nor am I sure if CPAN would PBot's repository because I do not have CPAN access, nor am I sure if CPAN would
appreciate my contributions. As such, this version of Net::IRC is now PBot::IRC appreciate my contributions. As such, this version of Net::IRC is now PBot::IRC
and it has been continually updated and improved with bugfixes and improvements, and it has been continually updated with bugfixes and improvements, including
including support for the IRCv3 specification. support for the IRCv3 specification.
1. Introduction 1. Introduction
------------------------ ------------------------

View File

@ -1,13 +1,13 @@
# File: IRCHandlers.pm # File: IRCHandlers.pm
# #
# Purpose: Pipes the PBot::IRC default handler through PBot::EventDispatcher, # Purpose: Pipes the PBot::Core::IRC default handler through PBot::Core::EventDispatcher,
# and loads all the packages in the IRCHandlers directory. # and loads all the packages in the IRCHandlers directory.
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::IRCHandlers; package PBot::Core::IRCHandlers;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
@ -22,7 +22,7 @@ sub initialize {
$self->register_handlers(%conf); $self->register_handlers(%conf);
} }
# registers handlers with a PBot::IRC connection # registers handlers with a PBot::Core::IRC connection
sub add_handlers { sub add_handlers {
my ($self) = @_; my ($self) = @_;
@ -61,7 +61,7 @@ sub register_handlers {
} }
# this default handler prepends 'irc.' to the event-type and then dispatches # this default handler prepends 'irc.' to the event-type and then dispatches
# the event to the rest of PBot via PBot::EventDispatcher. # the event to the rest of PBot via PBot::Core::EventDispatcher.
sub default_handler { sub default_handler {
my ($self, $conn, $event) = @_; my ($self, $conn, $event) = @_;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::IgnoreList; package PBot::Core::IgnoreList;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -9,12 +9,12 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Interpreter; package PBot::Core::Interpreter;
use parent 'PBot::Class', 'PBot::Registerable'; use parent 'PBot::Core::Class', 'PBot::Core::Registerable';
use PBot::Imports; use PBot::Imports;
use PBot::MessageHistory::Constants ':all'; use PBot::Core::MessageHistory::Constants ':all';
use Time::HiRes qw/gettimeofday/; use Time::HiRes qw/gettimeofday/;
use Time::Duration; use Time::Duration;
@ -27,9 +27,9 @@ use PBot::Utils::ValidateString;
sub initialize { sub initialize {
my ($self, %conf) = @_; my ($self, %conf) = @_;
# PBot::Interpreter can register multiple interpreter subrefs. # PBot::Core::Interpreter can register multiple interpreter subrefs.
# See also: Commands::interpreter() and Factoids::interpreter() # See also: Commands::interpreter() and Factoids::interpreter()
$self->PBot::Registerable::initialize(%conf); $self->PBot::Core::Registerable::initialize(%conf);
# registry entry for maximum recursion depth # registry entry for maximum recursion depth
$self->{pbot}->{registry}->add_default('text', 'interpreter', 'max_recursion', 10); $self->{pbot}->{registry}->add_default('text', 'interpreter', 'max_recursion', 10);

View File

@ -6,8 +6,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::LagChecker; package PBot::Core::LagChecker;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,7 +5,7 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Logger; package PBot::Core::Logger;
use PBot::Imports; use PBot::Imports;

View File

@ -9,8 +9,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::MessageHistory; package PBot::Core::MessageHistory;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
@ -18,13 +18,13 @@ use Getopt::Long qw(GetOptionsFromArray);
use Time::HiRes qw(time tv_interval); use Time::HiRes qw(time tv_interval);
use Time::Duration; use Time::Duration;
use PBot::MessageHistory::Storage::SQLite; use PBot::Core::MessageHistory::Storage::SQLite;
sub initialize { sub initialize {
my ($self, %conf) = @_; my ($self, %conf) = @_;
$self->{filename} = $conf{filename} // $self->{pbot}->{registry}->get_value('general', 'data_dir') . '/message_history.sqlite3'; $self->{filename} = $conf{filename} // $self->{pbot}->{registry}->get_value('general', 'data_dir') . '/message_history.sqlite3';
$self->{database} = PBot::MessageHistory::Storage::SQLite->new( $self->{database} = PBot::Core::MessageHistory::Storage::SQLite->new(
pbot => $self->{pbot}, pbot => $self->{pbot},
filename => $self->{filename} filename => $self->{filename}
); );

View File

@ -2,7 +2,7 @@
# #
# Purpose: Constants related to message history. # Purpose: Constants related to message history.
package PBot::MessageHistory::Constants; package PBot::Core::MessageHistory::Constants;
use Exporter qw/import/; use Exporter qw/import/;

View File

@ -9,12 +9,12 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::MessageHistory::Storage::SQLite; package PBot::Core::MessageHistory::Storage::SQLite;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
use PBot::MessageHistory::Constants ':all'; use PBot::Core::MessageHistory::Constants ':all';
use PBot::Utils::SQLiteLogger; use PBot::Utils::SQLiteLogger;
use PBot::Utils::SQLiteLoggerLayer; use PBot::Utils::SQLiteLoggerLayer;

View File

@ -9,8 +9,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Modules; package PBot::Core::Modules;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -7,8 +7,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::NickList; package PBot::Core::NickList;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Plugins; package PBot::Core::Plugins;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -6,8 +6,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::ProcessManager; package PBot::Core::ProcessManager;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
@ -236,7 +236,7 @@ sub execute_process {
# don't quit the IRC client when the child dies # don't quit the IRC client when the child dies
no warnings; no warnings;
*PBot::IRC::Connection::DESTROY = sub { return; }; *PBot::Core::IRC::Connection::DESTROY = sub { return; };
use warnings; use warnings;
# remove atexit handlers # remove atexit handlers

View File

@ -7,8 +7,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Refresher; package PBot::Core::Refresher;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,7 +5,7 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Registerable; package PBot::Core::Registerable;
use PBot::Imports; use PBot::Imports;

View File

@ -6,8 +6,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Registry; package PBot::Core::Registry;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -1,13 +1,13 @@
# File: SelectHandler.pm # File: SelectHandler.pm
# #
# Purpose: Adds/removes file handles to/from PBot::IRC's select loop # Purpose: Adds/removes file handles to/from PBot::Core::IRC's select loop
# and contains handlers for select events. # and contains handlers for select events.
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::SelectHandler; package PBot::Core::SelectHandler;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
@ -18,7 +18,7 @@ sub initialize {
sub add_reader { sub add_reader {
my ($self, $handle, $subref) = @_; my ($self, $handle, $subref) = @_;
# add file handle to PBot::IRC's select loop # add file handle to PBot::Core::IRC's select loop
$self->{pbot}->{irc}->addfh($handle, sub { $self->on_select_read($handle, $subref) }, 'r'); $self->{pbot}->{irc}->addfh($handle, sub { $self->on_select_read($handle, $subref) }, 'r');
# create read buffer for this handle # create read buffer for this handle
@ -28,7 +28,7 @@ sub add_reader {
sub remove_reader { sub remove_reader {
my ($self, $handle) = @_; my ($self, $handle) = @_;
# remove file handle from PBot::IRC's select loop # remove file handle from PBot::Core::IRC's select loop
$self->{pbot}->{irc}->removefh($handle); $self->{pbot}->{irc}->removefh($handle);
# delete this handle's read buffer # delete this handle's read buffer

View File

@ -11,8 +11,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::StdinReader; package PBot::Core::StdinReader;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -9,8 +9,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Updater; package PBot::Core::Updater;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::Users; package PBot::Core::Users;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -5,8 +5,8 @@
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::WebPaste; package PBot::Core::WebPaste;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;

View File

@ -6,11 +6,11 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::IRCHandlers::Channel; package PBot::IRCHandlers::Channel;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;
use PBot::MessageHistory::Constants ':all'; use PBot::Core::MessageHistory::Constants ':all';
use Time::HiRes qw/time/; use Time::HiRes qw/time/;
use Data::Dumper; use Data::Dumper;

View File

@ -9,7 +9,7 @@ package PBot::IRCHandlers::Server;
use PBot::Imports; use PBot::Imports;
use PBot::MessageHistory::Constants ':all'; use PBot::Core::MessageHistory::Constants ':all';
use Time::HiRes qw/time/; use Time::HiRes qw/time/;

View File

@ -9,9 +9,9 @@
# classes instead of something like Moo or Object::Pad, though this may # classes instead of something like Moo or Object::Pad, though this may
# change eventually. # change eventually.
# #
# PBot has forked the Net::IRC package internally as PBot::IRC. It contains # PBot has forked the Net::IRC package internally as PBot::Core::IRC. It
# numerous bugfixes and supports various new features such as IRCv3 client # contains numerous bugfixes and supports various new features such as IRCv3
# capability negotiation and SASL user authentication. # client capability negotiation and SASL user authentication.
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com> # SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
@ -19,43 +19,43 @@
package PBot::PBot; package PBot::PBot;
use PBot::Imports; use PBot::Imports;
use PBot::VERSION;
use Carp (); use Carp ();
use PBot::Logger; use PBot::Core::Logger;
use PBot::VERSION; use PBot::Core::AntiFlood;
use PBot::AntiFlood; use PBot::Core::AntiSpam;
use PBot::AntiSpam; use PBot::Core::BanList;
use PBot::BanList; use PBot::Core::BlackList;
use PBot::BlackList; use PBot::Core::Capabilities;
use PBot::Capabilities; use PBot::Core::Commands;
use PBot::Commands; use PBot::Core::Channels;
use PBot::Channels; use PBot::Core::ChanOps;
use PBot::ChanOps; use PBot::Core::EventDispatcher;
use PBot::EventDispatcher; use PBot::Core::EventQueue;
use PBot::EventQueue; use PBot::Core::Factoids;
use PBot::Factoids; use PBot::Core::Functions;
use PBot::Functions; use PBot::Core::IgnoreList;
use PBot::IgnoreList; use PBot::Core::Interpreter;
use PBot::Interpreter; use PBot::Core::IRC;
use PBot::IRC; use PBot::Core::IRCHandlers;
use PBot::IRCHandlers; use PBot::Core::LagChecker;
use PBot::LagChecker; use PBot::Core::MessageHistory;
use PBot::MessageHistory; use PBot::Core::Modules;
use PBot::Modules; use PBot::Core::NickList;
use PBot::NickList; use PBot::Core::Plugins;
use PBot::Plugins; use PBot::Core::ProcessManager;
use PBot::ProcessManager; use PBot::Core::Registry;
use PBot::Registry; use PBot::Core::Refresher;
use PBot::Refresher; use PBot::Core::SelectHandler;
use PBot::SelectHandler; use PBot::Core::StdinReader;
use PBot::StdinReader; use PBot::Core::Updater;
use PBot::Core::Users;
use PBot::Core::WebPaste;
use PBot::Storage::HashObject; use PBot::Storage::HashObject;
use PBot::Storage::DualIndexHashObject; use PBot::Storage::DualIndexHashObject;
use PBot::Storage::DualIndexSQLiteObject; use PBot::Storage::DualIndexSQLiteObject;
use PBot::Updater;
use PBot::Users;
use PBot::Utils::ParseDate; use PBot::Utils::ParseDate;
use PBot::WebPaste;
use Encode; use Encode;
use File::Basename; use File::Basename;
@ -125,13 +125,13 @@ sub initialize {
} }
# let modules register atexit subroutines # let modules register atexit subroutines
$self->{atexit} = PBot::Registerable->new(pbot => $self, %conf); $self->{atexit} = PBot::Core::Registerable->new(pbot => $self, %conf);
# register default signal handlers # register default signal handlers
$self->register_signal_handlers; $self->register_signal_handlers;
# prepare and open logger # prepare and open logger
$self->{logger} = PBot::Logger->new(pbot => $self, filename => "$conf{data_dir}/log/log", %conf); $self->{logger} = PBot::Core::Logger->new(pbot => $self, filename => "$conf{data_dir}/log/log", %conf);
# log command-line arguments # log command-line arguments
$self->{logger}->log("Args: @ARGV\n") if @ARGV; $self->{logger}->log("Args: @ARGV\n") if @ARGV;
@ -142,7 +142,7 @@ sub initialize {
$self->{logger}->log("update_dir: $conf{update_dir}\n"); $self->{logger}->log("update_dir: $conf{update_dir}\n");
# prepare the updater # prepare the updater
$self->{updater} = PBot::Updater->new(pbot => $self, data_dir => $conf{data_dir}, update_dir => $conf{update_dir}); $self->{updater} = PBot::Core::Updater->new(pbot => $self, data_dir => $conf{data_dir}, update_dir => $conf{update_dir});
# update any data files to new locations/formats # update any data files to new locations/formats
# --- this must happen before any data files are opened! --- # --- this must happen before any data files are opened! ---
@ -152,17 +152,17 @@ sub initialize {
} }
# create capabilities so commands can add new capabilities # create capabilities so commands can add new capabilities
$self->{capabilities} = PBot::Capabilities->new(pbot => $self, filename => "$conf{data_dir}/capabilities", %conf); $self->{capabilities} = PBot::Core::Capabilities->new(pbot => $self, filename => "$conf{data_dir}/capabilities", %conf);
# create commands so the modules can register new commands # create commands so the modules can register new commands
$self->{commands} = PBot::Commands->new(pbot => $self, filename => "$conf{data_dir}/commands", %conf); $self->{commands} = PBot::Core::Commands->new(pbot => $self, filename => "$conf{data_dir}/commands", %conf);
# prepare the version information and `version` command # prepare the version information and `version` command
$self->{version} = PBot::VERSION->new(pbot => $self, %conf); $self->{version} = PBot::VERSION->new(pbot => $self, %conf);
$self->{logger}->log($self->{version}->version . "\n"); $self->{logger}->log($self->{version}->version . "\n");
# prepare registry # prepare registry
$self->{registry} = PBot::Registry->new(pbot => $self, filename => "$conf{data_dir}/registry", %conf); $self->{registry} = PBot::Core::Registry->new(pbot => $self, filename => "$conf{data_dir}/registry", %conf);
# ensure user has attempted to configure the bot # ensure user has attempted to configure the bot
if (not length $self->{registry}->get_value('irc', 'botnick')) { if (not length $self->{registry}->get_value('irc', 'botnick')) {
@ -171,34 +171,34 @@ sub initialize {
} }
# prepare the IRC engine # prepare the IRC engine
$self->{irc} = PBot::IRC->new(pbot => $self); $self->{irc} = PBot::Core::IRC->new(pbot => $self);
# prepare remaining core PBot modules -- do not change this order # prepare remaining core PBot modules -- do not change this order
$self->{event_queue} = PBot::EventQueue->new(pbot => $self, name => 'PBot event queue', %conf); $self->{event_queue} = PBot::Core::EventQueue->new(pbot => $self, name => 'PBot event queue', %conf);
$self->{event_dispatcher} = PBot::EventDispatcher->new(pbot => $self, %conf); $self->{event_dispatcher} = PBot::Core::EventDispatcher->new(pbot => $self, %conf);
$self->{users} = PBot::Users->new(pbot => $self, filename => "$conf{data_dir}/users", %conf); $self->{users} = PBot::Core::Users->new(pbot => $self, filename => "$conf{data_dir}/users", %conf);
$self->{antiflood} = PBot::AntiFlood->new(pbot => $self, %conf); $self->{antiflood} = PBot::Core::AntiFlood->new(pbot => $self, %conf);
$self->{antispam} = PBot::AntiSpam->new(pbot => $self, %conf); $self->{antispam} = PBot::Core::AntiSpam->new(pbot => $self, %conf);
$self->{banlist} = PBot::BanList->new(pbot => $self, %conf); $self->{banlist} = PBot::Core::BanList->new(pbot => $self, %conf);
$self->{blacklist} = PBot::BlackList->new(pbot => $self, filename => "$conf{data_dir}/blacklist", %conf); $self->{blacklist} = PBot::Core::BlackList->new(pbot => $self, filename => "$conf{data_dir}/blacklist", %conf);
$self->{channels} = PBot::Channels->new(pbot => $self, filename => "$conf{data_dir}/channels", %conf); $self->{channels} = PBot::Core::Channels->new(pbot => $self, filename => "$conf{data_dir}/channels", %conf);
$self->{chanops} = PBot::ChanOps->new(pbot => $self, %conf); $self->{chanops} = PBot::Core::ChanOps->new(pbot => $self, %conf);
$self->{factoids} = PBot::Factoids->new(pbot => $self, filename => "$conf{data_dir}/factoids.sqlite3", %conf); $self->{factoids} = PBot::Core::Factoids->new(pbot => $self, filename => "$conf{data_dir}/factoids.sqlite3", %conf);
$self->{functions} = PBot::Functions->new(pbot => $self, %conf); $self->{functions} = PBot::Core::Functions->new(pbot => $self, %conf);
$self->{refresher} = PBot::Refresher->new(pbot => $self); $self->{refresher} = PBot::Core::Refresher->new(pbot => $self);
$self->{ignorelist} = PBot::IgnoreList->new(pbot => $self, filename => "$conf{data_dir}/ignorelist", %conf); $self->{ignorelist} = PBot::Core::IgnoreList->new(pbot => $self, filename => "$conf{data_dir}/ignorelist", %conf);
$self->{irchandlers} = PBot::IRCHandlers->new(pbot => $self, %conf); $self->{irchandlers} = PBot::Core::IRCHandlers->new(pbot => $self, %conf);
$self->{interpreter} = PBot::Interpreter->new(pbot => $self, %conf); $self->{interpreter} = PBot::Core::Interpreter->new(pbot => $self, %conf);
$self->{lagchecker} = PBot::LagChecker->new(pbot => $self, %conf); $self->{lagchecker} = PBot::Core::LagChecker->new(pbot => $self, %conf);
$self->{messagehistory} = PBot::MessageHistory->new(pbot => $self, filename => "$conf{data_dir}/message_history.sqlite3", %conf); $self->{messagehistory} = PBot::Core::MessageHistory->new(pbot => $self, filename => "$conf{data_dir}/message_history.sqlite3", %conf);
$self->{modules} = PBot::Modules->new(pbot => $self, %conf); $self->{modules} = PBot::Core::Modules->new(pbot => $self, %conf);
$self->{nicklist} = PBot::NickList->new(pbot => $self, %conf); $self->{nicklist} = PBot::Core::NickList->new(pbot => $self, %conf);
$self->{parsedate} = PBot::Utils::ParseDate->new(pbot => $self, %conf); $self->{parsedate} = PBot::Utils::ParseDate->new(pbot => $self, %conf);
$self->{plugins} = PBot::Plugins->new(pbot => $self, %conf); $self->{plugins} = PBot::Core::Plugins->new(pbot => $self, %conf);
$self->{process_manager} = PBot::ProcessManager->new(pbot => $self, %conf); $self->{process_manager} = PBot::Core::ProcessManager->new(pbot => $self, %conf);
$self->{select_handler} = PBot::SelectHandler->new(pbot => $self, %conf); $self->{select_handler} = PBot::Core::SelectHandler->new(pbot => $self, %conf);
$self->{stdin_reader} = PBot::StdinReader->new(pbot => $self, %conf); $self->{stdin_reader} = PBot::Core::StdinReader->new(pbot => $self, %conf);
$self->{webpaste} = PBot::WebPaste->new(pbot => $self, %conf); $self->{webpaste} = PBot::Core::WebPaste->new(pbot => $self, %conf);
# register commands in Commands directory # register commands in Commands directory
$self->{commands}->register_commands; $self->{commands}->register_commands;

View File

@ -7,7 +7,7 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
package PBot::VERSION; package PBot::VERSION;
use parent 'PBot::Class'; use parent 'PBot::Core::Class';
use PBot::Imports; use PBot::Imports;