From f0e617fef7d1ed982185fd4b4d0e85f08fa5d916 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 20 Jul 2021 22:44:51 -0700 Subject: [PATCH] Move core packages into PBot/Core --- lib/PBot/{ => Core}/AntiFlood.pm | 6 +- lib/PBot/{ => Core}/AntiSpam.pm | 4 +- lib/PBot/{ => Core}/BanList.pm | 4 +- lib/PBot/{ => Core}/BlackList.pm | 4 +- lib/PBot/{ => Core}/Capabilities.pm | 6 +- lib/PBot/{ => Core}/ChanOps.pm | 4 +- lib/PBot/{ => Core}/Channels.pm | 4 +- lib/PBot/{ => Core}/Class.pm | 2 +- lib/PBot/{ => Core}/Commands.pm | 14 +- lib/PBot/{ => Core}/EventDispatcher.pm | 6 +- lib/PBot/{ => Core}/EventQueue.pm | 6 +- lib/PBot/{ => Core}/Factoids.pm | 8 +- lib/PBot/{ => Core}/Functions.pm | 4 +- lib/PBot/{ => Core}/IRC.pm | 14 +- lib/PBot/{ => Core}/IRC/Changes | 0 lib/PBot/{ => Core}/IRC/Connection.pm | 50 +++---- lib/PBot/{ => Core}/IRC/DCC.pm | 66 ++++----- lib/PBot/{ => Core}/IRC/Event.pm | 4 +- lib/PBot/{ => Core}/IRC/EventQueue.pm | 8 +- lib/PBot/{ => Core}/IRC/EventQueue/Entry.pm | 2 +- lib/PBot/{ => Core}/IRC/LICENSE | 0 lib/PBot/{ => Core}/IRC/README | 7 +- lib/PBot/{ => Core}/IRC/irctest | 0 lib/PBot/{ => Core}/IRCHandlers.pm | 10 +- lib/PBot/{ => Core}/IgnoreList.pm | 4 +- lib/PBot/{ => Core}/Interpreter.pm | 10 +- lib/PBot/{ => Core}/LagChecker.pm | 4 +- lib/PBot/{ => Core}/Logger.pm | 2 +- lib/PBot/{ => Core}/MessageHistory.pm | 8 +- .../{ => Core}/MessageHistory/Constants.pm | 2 +- .../MessageHistory/Storage/SQLite.pm | 6 +- lib/PBot/{ => Core}/Modules.pm | 4 +- lib/PBot/{ => Core}/NickList.pm | 4 +- lib/PBot/{ => Core}/Plugins.pm | 4 +- lib/PBot/{ => Core}/ProcessManager.pm | 6 +- lib/PBot/{ => Core}/Refresher.pm | 4 +- lib/PBot/{ => Core}/Registerable.pm | 2 +- lib/PBot/{ => Core}/Registry.pm | 4 +- lib/PBot/{ => Core}/SelectHandler.pm | 10 +- lib/PBot/{ => Core}/StdinReader.pm | 4 +- lib/PBot/{ => Core}/Updater.pm | 4 +- lib/PBot/{ => Core}/Users.pm | 4 +- lib/PBot/{ => Core}/WebPaste.pm | 4 +- lib/PBot/IRCHandlers/Channel.pm | 4 +- lib/PBot/IRCHandlers/Server.pm | 2 +- lib/PBot/PBot.pm | 130 +++++++++--------- lib/PBot/VERSION.pm | 2 +- 47 files changed, 231 insertions(+), 230 deletions(-) rename lib/PBot/{ => Core}/AntiFlood.pm (99%) rename lib/PBot/{ => Core}/AntiSpam.pm (98%) rename lib/PBot/{ => Core}/BanList.pm (99%) rename lib/PBot/{ => Core}/BlackList.pm (99%) rename lib/PBot/{ => Core}/Capabilities.pm (97%) rename lib/PBot/{ => Core}/ChanOps.pm (98%) rename lib/PBot/{ => Core}/Channels.pm (98%) rename lib/PBot/{ => Core}/Class.pm (97%) rename lib/PBot/{ => Core}/Commands.pm (94%) rename lib/PBot/{ => Core}/EventDispatcher.pm (96%) rename lib/PBot/{ => Core}/EventQueue.pm (98%) rename lib/PBot/{ => Core}/Factoids.pm (99%) rename lib/PBot/{ => Core}/Functions.pm (98%) rename lib/PBot/{ => Core}/IRC.pm (97%) rename lib/PBot/{ => Core}/IRC/Changes (100%) rename lib/PBot/{ => Core}/IRC/Connection.pm (97%) rename lib/PBot/{ => Core}/IRC/DCC.pm (92%) rename lib/PBot/{ => Core}/IRC/Event.pm (99%) rename lib/PBot/{ => Core}/IRC/EventQueue.pm (82%) rename lib/PBot/{ => Core}/IRC/EventQueue/Entry.pm (89%) rename lib/PBot/{ => Core}/IRC/LICENSE (100%) rename lib/PBot/{ => Core}/IRC/README (96%) rename lib/PBot/{ => Core}/IRC/irctest (100%) rename lib/PBot/{ => Core}/IRCHandlers.pm (89%) rename lib/PBot/{ => Core}/IgnoreList.pm (98%) rename lib/PBot/{ => Core}/Interpreter.pm (99%) rename lib/PBot/{ => Core}/LagChecker.pm (98%) rename lib/PBot/{ => Core}/Logger.pm (98%) rename lib/PBot/{ => Core}/MessageHistory.pm (99%) rename lib/PBot/{ => Core}/MessageHistory/Constants.pm (90%) rename lib/PBot/{ => Core}/MessageHistory/Storage/SQLite.pm (99%) rename lib/PBot/{ => Core}/Modules.pm (98%) rename lib/PBot/{ => Core}/NickList.pm (99%) rename lib/PBot/{ => Core}/Plugins.pm (98%) rename lib/PBot/{ => Core}/ProcessManager.pm (98%) rename lib/PBot/{ => Core}/Refresher.pm (97%) rename lib/PBot/{ => Core}/Registerable.pm (98%) rename lib/PBot/{ => Core}/Registry.pm (99%) rename lib/PBot/{ => Core}/SelectHandler.pm (88%) rename lib/PBot/{ => Core}/StdinReader.pm (97%) rename lib/PBot/{ => Core}/Updater.pm (97%) rename lib/PBot/{ => Core}/Users.pm (99%) rename lib/PBot/{ => Core}/WebPaste.pm (97%) diff --git a/lib/PBot/AntiFlood.pm b/lib/PBot/Core/AntiFlood.pm similarity index 99% rename from lib/PBot/AntiFlood.pm rename to lib/PBot/Core/AntiFlood.pm index b1536482..895e4b14 100644 --- a/lib/PBot/AntiFlood.pm +++ b/lib/PBot/Core/AntiFlood.pm @@ -9,12 +9,12 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::AntiFlood; -use parent 'PBot::Class'; +package PBot::Core::AntiFlood; +use parent 'PBot::Core::Class'; use PBot::Imports; -use PBot::MessageHistory::Constants ':all'; +use PBot::Core::MessageHistory::Constants ':all'; use Time::HiRes qw(gettimeofday tv_interval); use Time::Duration; diff --git a/lib/PBot/AntiSpam.pm b/lib/PBot/Core/AntiSpam.pm similarity index 98% rename from lib/PBot/AntiSpam.pm rename to lib/PBot/Core/AntiSpam.pm index b4e39249..86977b7a 100644 --- a/lib/PBot/AntiSpam.pm +++ b/lib/PBot/Core/AntiSpam.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::AntiSpam; -use parent 'PBot::Class'; +package PBot::Core::AntiSpam; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/BanList.pm b/lib/PBot/Core/BanList.pm similarity index 99% rename from lib/PBot/BanList.pm rename to lib/PBot/Core/BanList.pm index cfdf2ee8..80d45c53 100644 --- a/lib/PBot/BanList.pm +++ b/lib/PBot/Core/BanList.pm @@ -7,9 +7,9 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::BanList; +package PBot::Core::BanList; -use parent 'PBot::Class'; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/BlackList.pm b/lib/PBot/Core/BlackList.pm similarity index 99% rename from lib/PBot/BlackList.pm rename to lib/PBot/Core/BlackList.pm index d05547ef..9f27a5da 100644 --- a/lib/PBot/BlackList.pm +++ b/lib/PBot/Core/BlackList.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::BlackList; -use parent 'PBot::Class'; +package PBot::Core::BlackList; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Capabilities.pm b/lib/PBot/Core/Capabilities.pm similarity index 97% rename from lib/PBot/Capabilities.pm rename to lib/PBot/Core/Capabilities.pm index 82a530b4..2409632e 100644 --- a/lib/PBot/Capabilities.pm +++ b/lib/PBot/Core/Capabilities.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Capabilities; -use parent 'PBot::Class'; +package PBot::Core::Capabilities; +use parent 'PBot::Core::Class'; use PBot::Imports; @@ -44,7 +44,7 @@ sub has { $depth //= 10; # set depth to 10 if it's not defined 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; } diff --git a/lib/PBot/ChanOps.pm b/lib/PBot/Core/ChanOps.pm similarity index 98% rename from lib/PBot/ChanOps.pm rename to lib/PBot/Core/ChanOps.pm index 5399cf68..c5b6856b 100644 --- a/lib/PBot/ChanOps.pm +++ b/lib/PBot/Core/ChanOps.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::ChanOps; -use parent 'PBot::Class'; +package PBot::Core::ChanOps; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Channels.pm b/lib/PBot/Core/Channels.pm similarity index 98% rename from lib/PBot/Channels.pm rename to lib/PBot/Core/Channels.pm index 3f759bdd..fa479952 100644 --- a/lib/PBot/Channels.pm +++ b/lib/PBot/Core/Channels.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Channels; -use parent 'PBot::Class'; +package PBot::Core::Channels; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Class.pm b/lib/PBot/Core/Class.pm similarity index 97% rename from lib/PBot/Class.pm rename to lib/PBot/Core/Class.pm index 1ebb1044..0d741f0c 100644 --- a/lib/PBot/Class.pm +++ b/lib/PBot/Core/Class.pm @@ -6,7 +6,7 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Class; +package PBot::Core::Class; use PBot::Imports; diff --git a/lib/PBot/Commands.pm b/lib/PBot/Core/Commands.pm similarity index 94% rename from lib/PBot/Commands.pm rename to lib/PBot/Core/Commands.pm index e9b692fc..78050aac 100644 --- a/lib/PBot/Commands.pm +++ b/lib/PBot/Core/Commands.pm @@ -6,8 +6,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Commands; -use parent 'PBot::Class', 'PBot::Registerable'; +package PBot::Core::Commands; +use parent 'PBot::Core::Class', 'PBot::Core::Registerable'; use PBot::Imports; @@ -16,8 +16,8 @@ use PBot::Utils::LoadPackages qw/load_packages/; sub initialize { my ($self, %conf) = @_; - # PBot::Commands can register subrefs - $self->PBot::Registerable::initialize(%conf); + # PBot::Core::Commands can register subrefs + $self->PBot::Core::Registerable::initialize(%conf); # command metadata stored as a HashObject $self->{metadata} = PBot::Storage::HashObject->new(pbot => $self->{pbot}, name => 'Command metadata', filename => $conf{filename}); @@ -40,7 +40,7 @@ sub register { } # register subref - my $command = $self->PBot::Registerable::register($subref); + my $command = $self->PBot::Core::Registerable::register($subref); # update internal metadata $command->{name} = lc $name; @@ -90,8 +90,8 @@ sub get_meta { return $self->{metadata}->get_data($command, $key); } -# main entry point for PBot::Interpreter to interpret a registered bot command -# see also PBot::Factoids::interpreter() for factoid commands +# main entry point for PBot::Core::Interpreter to interpret a registered bot command +# see also PBot::Core::Factoids::interpreter() for factoid commands sub interpreter { my ($self, $context) = @_; diff --git a/lib/PBot/EventDispatcher.pm b/lib/PBot/Core/EventDispatcher.pm similarity index 96% rename from lib/PBot/EventDispatcher.pm rename to lib/PBot/Core/EventDispatcher.pm index 1d30a830..49cf1de0 100644 --- a/lib/PBot/EventDispatcher.pm +++ b/lib/PBot/Core/EventDispatcher.pm @@ -2,13 +2,13 @@ # # 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 # SPDX-License-Identifier: MIT -package PBot::EventDispatcher; -use parent 'PBot::Class'; +package PBot::Core::EventDispatcher; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/EventQueue.pm b/lib/PBot/Core/EventQueue.pm similarity index 98% rename from lib/PBot/EventQueue.pm rename to lib/PBot/Core/EventQueue.pm index ba9e3dbc..f03a5479 100644 --- a/lib/PBot/EventQueue.pm +++ b/lib/PBot/Core/EventQueue.pm @@ -3,13 +3,13 @@ # Purpose: Provides functionality to manage event subroutines which are invoked # 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 # SPDX-License-Identifier: MIT -package PBot::EventQueue; -use parent 'PBot::Class'; +package PBot::Core::EventQueue; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Factoids.pm b/lib/PBot/Core/Factoids.pm similarity index 99% rename from lib/PBot/Factoids.pm rename to lib/PBot/Core/Factoids.pm index f4d2e899..10218f50 100644 --- a/lib/PBot/Factoids.pm +++ b/lib/PBot/Core/Factoids.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Factoids; -use parent 'PBot::Class'; +package PBot::Core::Factoids; +use parent 'PBot::Core::Class'; use PBot::Imports; @@ -280,7 +280,7 @@ sub find_factoid { my $dump = Dumper \%opts; $self->{pbot}->{logger}->log("+" x 32 . "\n"); 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_factiod: from: $from, kw: $keyword, opts: $dump\n"); @@ -1079,7 +1079,7 @@ sub execute_code_factoid { 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 { my ($self, $context) = @_; my $pbot = $self->{pbot}; diff --git a/lib/PBot/Functions.pm b/lib/PBot/Core/Functions.pm similarity index 98% rename from lib/PBot/Functions.pm rename to lib/PBot/Core/Functions.pm index 34948538..3eeaa6cb 100644 --- a/lib/PBot/Functions.pm +++ b/lib/PBot/Core/Functions.pm @@ -16,8 +16,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Functions; -use parent 'PBot::Class'; +package PBot::Core::Functions; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/IRC.pm b/lib/PBot/Core/IRC.pm similarity index 97% rename from lib/PBot/IRC.pm rename to lib/PBot/Core/IRC.pm index 4c3bc38a..fb8ead26 100644 --- a/lib/PBot/IRC.pm +++ b/lib/PBot/Core/IRC.pm @@ -13,12 +13,12 @@ ##################################################################### # $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 -use PBot::IRC::Connection; # pragma_ 2011/01/21 -use PBot::IRC::EventQueue; # pragma_ 2011/01/21 +use PBot::Core::IRC::Connection; # pragma_ 2011/01/21 +use PBot::Core::IRC::EventQueue; # pragma_ 2011/01/21 use IO::Select; use Carp; @@ -45,8 +45,8 @@ sub new { '_connhash' => {}, '_error' => IO::Select->new(), '_debug' => 0, - '_schedulequeue' => new PBot::IRC::EventQueue(), # pragma_ 2011/01/21 - '_outputqueue' => new PBot::IRC::EventQueue(), # pragma_ 2011/01/21 + '_schedulequeue' => new PBot::Core::IRC::EventQueue(), # pragma_ 2011/01/21 + '_outputqueue' => new PBot::Core::IRC::EventQueue(), # pragma_ 2011/01/21 '_read' => IO::Select->new(), '_timeout' => 0, '_write' => IO::Select->new(), @@ -136,7 +136,7 @@ sub do_one_loop { # we don't want to bother waiting on input or running # scheduled events if we're just flushing the output queue # 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. if (!$self->schedulequeue->is_empty) { @@ -184,7 +184,7 @@ sub flush_output_queue { # Any args here get passed to Connection->connect(). sub newconn { 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 $conn; diff --git a/lib/PBot/IRC/Changes b/lib/PBot/Core/IRC/Changes similarity index 100% rename from lib/PBot/IRC/Changes rename to lib/PBot/Core/IRC/Changes diff --git a/lib/PBot/IRC/Connection.pm b/lib/PBot/Core/IRC/Connection.pm similarity index 97% rename from lib/PBot/IRC/Connection.pm rename to lib/PBot/Core/IRC/Connection.pm index e368a7bf..51243805 100644 --- a/lib/PBot/IRC/Connection.pm +++ b/lib/PBot/Core/IRC/Connection.pm @@ -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 utf8; -use PBot::IRC::Event; # pragma_ 2011/21/01 -use PBot::IRC::DCC; # pragma_ 2011/21/01 +use PBot::Core::IRC::Event; # pragma_ 2011/21/01 +use PBot::Core::IRC::DCC; # pragma_ 2011/21/01 use IO::Socket; use IO::Socket::INET; use Symbol; @@ -155,7 +155,7 @@ sub _add_generic_handler { foreach $ev (ref $event eq "ARRAY" ? @{$event} : $event) { # Translate numerics to names 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) { carp "Unknown event type in $real_name: $ev"; return; @@ -194,7 +194,7 @@ sub add_handler { # Hooks every event we know about... sub add_default_handler { 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'); } return 1; @@ -459,7 +459,7 @@ sub disconnect { $self->parent->removeconn($self); $self->socket(undef); $self->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( "disconnect", # pragma_ 2011/21/01 $self->server, '', @@ -503,7 +503,7 @@ sub handler { if (ref $event) { $ev = $event->type; } elsif (defined $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 { croak "Not enough arguments to handler()"; } @@ -727,7 +727,7 @@ sub new_chat { ($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(). @@ -764,7 +764,7 @@ sub new_get { 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 $name, $handle, $offset ); @@ -784,7 +784,7 @@ sub new_send { if (ref($_[0]) eq "ARRAY") { ($nick, $filename, $blocksize) = @{$_[0]}; } 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. @@ -888,7 +888,7 @@ sub parse { # Like the RFC says: "respond as quickly as possible..." if ($line =~ /^PING/) { $ev = ( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( "ping", # pragma_ 2011/21/01 $self->server, $self->nick, @@ -899,7 +899,7 @@ sub parse { # Had to move this up front to avoid a particularly pernicious bug. } elsif ($line =~ /^NOTICE/) { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( "snotice", # pragma_ 2011/21/01 $self->server, '', @@ -908,7 +908,7 @@ sub parse { ); } elsif ($line =~ /^AUTHENTICATE \+$/) { # IRCv3 SASL pragma- June 11, 2021 - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( 'authenticate', $self->server, $self->nick, @@ -1006,7 +1006,7 @@ sub parse { or $type eq "cap") # IRCv3 client capabilities pragma- { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( $type, # pragma_ 2011/21/01 $from, shift(@stuff), @@ -1015,7 +1015,7 @@ sub parse { ); } 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 $from, $from, @@ -1024,7 +1024,7 @@ sub parse { ); } elsif ($type eq "kick") { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( $type, # pragma_ 2011/21/01 $from, $stuff[1], @@ -1033,7 +1033,7 @@ sub parse { ); } elsif ($type eq "kill") { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( $type, # pragma_ 2011/21/01 $from, '', @@ -1041,7 +1041,7 @@ sub parse { $line ); # Ahh, what the hell. } elsif ($type eq "wallops") { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( $type, # pragma_ 2011/21/01 $from, '', @@ -1049,7 +1049,7 @@ sub parse { $line ); } elsif ($type eq "pong") { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( $type, # pragma_ 2011/21/01 $from, '', @@ -1070,7 +1070,7 @@ sub parse { $ev = $self->parse_num($line); } elsif ($line =~ /^:(\w+) MODE \1 /) { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( 'umode', # pragma_ 2011/21/01 $self->server, $self->nick, @@ -1086,7 +1086,7 @@ sub parse { \b/x # Some other crap, whatever... ) { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( 'snotice', # pragma_ 2011/21/01 $self->server, '', @@ -1100,7 +1100,7 @@ sub parse { $self->disconnect('error', ($line =~ /(.*)/)); } else { - $ev = PBot::IRC::Event->new( + $ev = PBot::Core::IRC::Event->new( "error", # pragma_ 2011/21/01 $self->server, '', @@ -1157,14 +1157,14 @@ sub parse_ctcp { $one =~ s/^$ctype //i; # strip the CTCP type off the args $self->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( $handler, $from, $stuff, # pragma_ 2011/21/01 $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; } return 1; @@ -1197,7 +1197,7 @@ sub parse_num { $from = substr $from, 1 if $from =~ /^:/; - return PBot::IRC::Event->new( + return PBot::Core::IRC::Event->new( $type, # pragma_ 2011/21/01 $from, '', diff --git a/lib/PBot/IRC/DCC.pm b/lib/PBot/Core/IRC/DCC.pm similarity index 92% rename from lib/PBot/IRC/DCC.pm rename to lib/PBot/Core/IRC/DCC.pm index 0a8b5985..9a2e9103 100644 --- a/lib/PBot/IRC/DCC.pm +++ b/lib/PBot/Core/IRC/DCC.pm @@ -13,7 +13,7 @@ ##################################################################### # $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; @@ -34,7 +34,7 @@ use utf8; # archon: you offered to shower with a random guy? # 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 Socket; # need inet_ntoa... @@ -96,7 +96,7 @@ sub _getline { warn "recv() received 0 bytes in _getline, closing connection.\n" if $self->{_debug}; $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -114,7 +114,7 @@ sub _getline { warn "recv() returned undef, socket error in _getline()\n" if $self->{_debug}; $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -136,7 +136,7 @@ sub DESTROY { if ($self->{_socket}->opened) { $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -160,13 +160,13 @@ sub peer { return ($_[0]->{_nick}, "DCC " . $_[0]->{_type}); } # archon: yeah, but with is much more amusing # 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 Carp; 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 { @@ -177,7 +177,7 @@ sub new { my ($sock, $fh); # 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; $fh = defined $handle ? $handle : IO::File->new(">$filename"); @@ -201,7 +201,7 @@ sub new { if (defined $sock) { $container->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_open', # pragma_ 2011/21/01 $nick, $sock, @@ -258,7 +258,7 @@ sub parse { close $self->{_fh}; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -277,7 +277,7 @@ sub parse { close $self->{_fh}; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -297,7 +297,7 @@ sub parse { close $self->{_fh}; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -309,7 +309,7 @@ sub parse { } $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_update', # pragma_ 2011/21/01 $self->{_nick}, $self, @@ -328,7 +328,7 @@ sub close { $self->{_fh}->close; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -350,8 +350,8 @@ sub close { # archon: waka chica waka chica # Connection handling SENDs -package PBot::IRC::DCC::SEND; # pragma_ 2011/21/01 -@PBot::IRC::DCC::SEND::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 +package PBot::Core::IRC::DCC::SEND; # pragma_ 2011/21/01 +@PBot::Core::IRC::DCC::SEND::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 use IO::File; use IO::Socket; @@ -417,7 +417,7 @@ sub new { 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) { carp "Error in accept: $!"; @@ -453,7 +453,7 @@ sub parse { $self->{_fh}->close; $self->{_parent}->parent->removefh($sock); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -477,7 +477,7 @@ sub parse { $self->{_fh}->close; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -498,7 +498,7 @@ sub parse { $self->{_fh}->close; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -515,7 +515,7 @@ sub parse { $self->{_fh}->close; $self->{_parent}->parent->removeconn($self); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -529,7 +529,7 @@ sub parse { $self->{_bout} += length($buf); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_update', # pragma_ 2011/21/01 $self->{_nick}, $self, @@ -551,8 +551,8 @@ sub parse { # archon: she gets you drunk and he takes your wallet! # handles CHAT connections -package PBot::IRC::DCC::CHAT; # pragma_ 2011/21/01 -@PBot::IRC::DCC::CHAT::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 +package PBot::Core::IRC::DCC::CHAT; # pragma_ 2011/21/01 +@PBot::Core::IRC::DCC::CHAT::ISA = qw(Net::IRC::DCC::Connection); # pragma_ 2011/21/01 use IO::Socket; use Carp; @@ -598,7 +598,7 @@ sub new { 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) { carp "Error in DCC CHAT connect: $!"; @@ -606,7 +606,7 @@ sub new { } } 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; $sock = new IO::Socket::INET( @@ -616,7 +616,7 @@ sub new { if (defined $sock) { $container->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_open', # pragma_ 2011/21/01 $nick, $sock, @@ -674,7 +674,7 @@ sub parse { $self->{_bout} += length($line); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'chat', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -684,7 +684,7 @@ sub parse { ); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_update', # pragma_ 2011/21/01 $self->{_nick}, $self, @@ -717,9 +717,9 @@ sub privmsg { # \merlyn: good topic # 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 Socket; # we use a lot of Socket functions in parse() use strict; @@ -763,7 +763,7 @@ sub parse { $self->{_parent}->{_fh}->close; $self->{_parent}->{_parent}->parent->removefh($sock); $self->{_parent}->handler( - PBot::IRC::Event->new( + PBot::Core::IRC::Event->new( 'dcc_close', # pragma_ 2011/21/01 $self->{_nick}, $self->{_socket}, @@ -779,7 +779,7 @@ sub parse { $self->{_parent}->{_parent}->parent->removeconn($self); $self->{_parent}->{_parent}->handler( - PBot::IRC::Event-> # pragma_ 2011/21/01 + PBot::Core::IRC::Event-> # pragma_ 2011/21/01 new( 'dcc_open', $self->{_parent}->{_nick}, diff --git a/lib/PBot/IRC/Event.pm b/lib/PBot/Core/IRC/Event.pm similarity index 99% rename from lib/PBot/IRC/Event.pm rename to lib/PBot/Core/IRC/Event.pm index af6bf171..12e7f52b 100644 --- a/lib/PBot/IRC/Event.pm +++ b/lib/PBot/Core/IRC/Event.pm @@ -22,7 +22,7 @@ # Well, welcome to the real world, guys, where code needs to be # 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 utf8; @@ -191,7 +191,7 @@ sub userhost { # Simple sub for translating server numerics to their appropriate names. # Takes one arg: the number to be translated. 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; return (exists $_names{$ev} ? $_names{$ev} : undef); diff --git a/lib/PBot/IRC/EventQueue.pm b/lib/PBot/Core/IRC/EventQueue.pm similarity index 82% rename from lib/PBot/IRC/EventQueue.pm rename to lib/PBot/Core/IRC/EventQueue.pm index 63b8d17a..a7d1dafe 100644 --- a/lib/PBot/IRC/EventQueue.pm +++ b/lib/PBot/Core/IRC/EventQueue.pm @@ -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 utf8; -use PBot::IRC::EventQueue::Entry; # pragma_ 2011/21/01 +use PBot::Core::IRC::EventQueue::Entry; # pragma_ 2011/21/01 use strict; @@ -27,7 +27,7 @@ sub enqueue { my $time = 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; return $entry->id; } @@ -45,7 +45,7 @@ sub dequeue { $result = $self->queue->{$event}; delete $self->queue->{$event}; } 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) . "!"; $result = $self->queue->{$event->id}; diff --git a/lib/PBot/IRC/EventQueue/Entry.pm b/lib/PBot/Core/IRC/EventQueue/Entry.pm similarity index 89% rename from lib/PBot/IRC/EventQueue/Entry.pm rename to lib/PBot/Core/IRC/EventQueue/Entry.pm index 0e055cc2..0055ddc2 100644 --- a/lib/PBot/IRC/EventQueue/Entry.pm +++ b/lib/PBot/Core/IRC/EventQueue/Entry.pm @@ -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; diff --git a/lib/PBot/IRC/LICENSE b/lib/PBot/Core/IRC/LICENSE similarity index 100% rename from lib/PBot/IRC/LICENSE rename to lib/PBot/Core/IRC/LICENSE diff --git a/lib/PBot/IRC/README b/lib/PBot/Core/IRC/README similarity index 96% rename from lib/PBot/IRC/README rename to lib/PBot/Core/IRC/README index dbb9aa35..c824b704 100644 --- a/lib/PBot/IRC/README +++ b/lib/PBot/Core/IRC/README @@ -5,7 +5,7 @@ Table of Contents ------------------------ 0. Deprecation notice -0.1. Forked by pragma- for PBot ++- 0.1. Forked by pragma- for PBot 1. Introduction 2. Availability 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 ------------------------ + 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 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, -including support for the IRCv3 specification. +and it has been continually updated with bugfixes and improvements, including +support for the IRCv3 specification. 1. Introduction ------------------------ diff --git a/lib/PBot/IRC/irctest b/lib/PBot/Core/IRC/irctest similarity index 100% rename from lib/PBot/IRC/irctest rename to lib/PBot/Core/IRC/irctest diff --git a/lib/PBot/IRCHandlers.pm b/lib/PBot/Core/IRCHandlers.pm similarity index 89% rename from lib/PBot/IRCHandlers.pm rename to lib/PBot/Core/IRCHandlers.pm index 4772faad..6d09c4ff 100644 --- a/lib/PBot/IRCHandlers.pm +++ b/lib/PBot/Core/IRCHandlers.pm @@ -1,13 +1,13 @@ # 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. # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::IRCHandlers; -use parent 'PBot::Class'; +package PBot::Core::IRCHandlers; +use parent 'PBot::Core::Class'; use PBot::Imports; @@ -22,7 +22,7 @@ sub initialize { $self->register_handlers(%conf); } -# registers handlers with a PBot::IRC connection +# registers handlers with a PBot::Core::IRC connection sub add_handlers { my ($self) = @_; @@ -61,7 +61,7 @@ sub register_handlers { } # 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 { my ($self, $conn, $event) = @_; diff --git a/lib/PBot/IgnoreList.pm b/lib/PBot/Core/IgnoreList.pm similarity index 98% rename from lib/PBot/IgnoreList.pm rename to lib/PBot/Core/IgnoreList.pm index f86b25ae..0c5e9901 100644 --- a/lib/PBot/IgnoreList.pm +++ b/lib/PBot/Core/IgnoreList.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::IgnoreList; -use parent 'PBot::Class'; +package PBot::Core::IgnoreList; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Interpreter.pm b/lib/PBot/Core/Interpreter.pm similarity index 99% rename from lib/PBot/Interpreter.pm rename to lib/PBot/Core/Interpreter.pm index c77dd8cb..2bfc40a1 100644 --- a/lib/PBot/Interpreter.pm +++ b/lib/PBot/Core/Interpreter.pm @@ -9,12 +9,12 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Interpreter; -use parent 'PBot::Class', 'PBot::Registerable'; +package PBot::Core::Interpreter; +use parent 'PBot::Core::Class', 'PBot::Core::Registerable'; use PBot::Imports; -use PBot::MessageHistory::Constants ':all'; +use PBot::Core::MessageHistory::Constants ':all'; use Time::HiRes qw/gettimeofday/; use Time::Duration; @@ -27,9 +27,9 @@ use PBot::Utils::ValidateString; sub initialize { 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() - $self->PBot::Registerable::initialize(%conf); + $self->PBot::Core::Registerable::initialize(%conf); # registry entry for maximum recursion depth $self->{pbot}->{registry}->add_default('text', 'interpreter', 'max_recursion', 10); diff --git a/lib/PBot/LagChecker.pm b/lib/PBot/Core/LagChecker.pm similarity index 98% rename from lib/PBot/LagChecker.pm rename to lib/PBot/Core/LagChecker.pm index e9bf9d30..08bf8631 100644 --- a/lib/PBot/LagChecker.pm +++ b/lib/PBot/Core/LagChecker.pm @@ -6,8 +6,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::LagChecker; -use parent 'PBot::Class'; +package PBot::Core::LagChecker; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Logger.pm b/lib/PBot/Core/Logger.pm similarity index 98% rename from lib/PBot/Logger.pm rename to lib/PBot/Core/Logger.pm index 672d9c38..c2e9b48c 100644 --- a/lib/PBot/Logger.pm +++ b/lib/PBot/Core/Logger.pm @@ -5,7 +5,7 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Logger; +package PBot::Core::Logger; use PBot::Imports; diff --git a/lib/PBot/MessageHistory.pm b/lib/PBot/Core/MessageHistory.pm similarity index 99% rename from lib/PBot/MessageHistory.pm rename to lib/PBot/Core/MessageHistory.pm index ec0f38a0..a05bbdaf 100644 --- a/lib/PBot/MessageHistory.pm +++ b/lib/PBot/Core/MessageHistory.pm @@ -9,8 +9,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::MessageHistory; -use parent 'PBot::Class'; +package PBot::Core::MessageHistory; +use parent 'PBot::Core::Class'; use PBot::Imports; @@ -18,13 +18,13 @@ use Getopt::Long qw(GetOptionsFromArray); use Time::HiRes qw(time tv_interval); use Time::Duration; -use PBot::MessageHistory::Storage::SQLite; +use PBot::Core::MessageHistory::Storage::SQLite; sub initialize { my ($self, %conf) = @_; $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}, filename => $self->{filename} ); diff --git a/lib/PBot/MessageHistory/Constants.pm b/lib/PBot/Core/MessageHistory/Constants.pm similarity index 90% rename from lib/PBot/MessageHistory/Constants.pm rename to lib/PBot/Core/MessageHistory/Constants.pm index f1eed4ad..4fa8f136 100644 --- a/lib/PBot/MessageHistory/Constants.pm +++ b/lib/PBot/Core/MessageHistory/Constants.pm @@ -2,7 +2,7 @@ # # Purpose: Constants related to message history. -package PBot::MessageHistory::Constants; +package PBot::Core::MessageHistory::Constants; use Exporter qw/import/; diff --git a/lib/PBot/MessageHistory/Storage/SQLite.pm b/lib/PBot/Core/MessageHistory/Storage/SQLite.pm similarity index 99% rename from lib/PBot/MessageHistory/Storage/SQLite.pm rename to lib/PBot/Core/MessageHistory/Storage/SQLite.pm index c468cd59..90845180 100644 --- a/lib/PBot/MessageHistory/Storage/SQLite.pm +++ b/lib/PBot/Core/MessageHistory/Storage/SQLite.pm @@ -9,12 +9,12 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::MessageHistory::Storage::SQLite; -use parent 'PBot::Class'; +package PBot::Core::MessageHistory::Storage::SQLite; +use parent 'PBot::Core::Class'; use PBot::Imports; -use PBot::MessageHistory::Constants ':all'; +use PBot::Core::MessageHistory::Constants ':all'; use PBot::Utils::SQLiteLogger; use PBot::Utils::SQLiteLoggerLayer; diff --git a/lib/PBot/Modules.pm b/lib/PBot/Core/Modules.pm similarity index 98% rename from lib/PBot/Modules.pm rename to lib/PBot/Core/Modules.pm index ddc1bc0f..4e25d1cf 100644 --- a/lib/PBot/Modules.pm +++ b/lib/PBot/Core/Modules.pm @@ -9,8 +9,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Modules; -use parent 'PBot::Class'; +package PBot::Core::Modules; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/NickList.pm b/lib/PBot/Core/NickList.pm similarity index 99% rename from lib/PBot/NickList.pm rename to lib/PBot/Core/NickList.pm index 877c96d0..a6aa0598 100644 --- a/lib/PBot/NickList.pm +++ b/lib/PBot/Core/NickList.pm @@ -7,8 +7,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::NickList; -use parent 'PBot::Class'; +package PBot::Core::NickList; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Plugins.pm b/lib/PBot/Core/Plugins.pm similarity index 98% rename from lib/PBot/Plugins.pm rename to lib/PBot/Core/Plugins.pm index 03ff6964..a0d5c71d 100644 --- a/lib/PBot/Plugins.pm +++ b/lib/PBot/Core/Plugins.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Plugins; -use parent 'PBot::Class'; +package PBot::Core::Plugins; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/ProcessManager.pm b/lib/PBot/Core/ProcessManager.pm similarity index 98% rename from lib/PBot/ProcessManager.pm rename to lib/PBot/Core/ProcessManager.pm index b974556a..75d73470 100644 --- a/lib/PBot/ProcessManager.pm +++ b/lib/PBot/Core/ProcessManager.pm @@ -6,8 +6,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::ProcessManager; -use parent 'PBot::Class'; +package PBot::Core::ProcessManager; +use parent 'PBot::Core::Class'; use PBot::Imports; @@ -236,7 +236,7 @@ sub execute_process { # don't quit the IRC client when the child dies no warnings; - *PBot::IRC::Connection::DESTROY = sub { return; }; + *PBot::Core::IRC::Connection::DESTROY = sub { return; }; use warnings; # remove atexit handlers diff --git a/lib/PBot/Refresher.pm b/lib/PBot/Core/Refresher.pm similarity index 97% rename from lib/PBot/Refresher.pm rename to lib/PBot/Core/Refresher.pm index a70af672..862c62a1 100644 --- a/lib/PBot/Refresher.pm +++ b/lib/PBot/Core/Refresher.pm @@ -7,8 +7,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Refresher; -use parent 'PBot::Class'; +package PBot::Core::Refresher; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Registerable.pm b/lib/PBot/Core/Registerable.pm similarity index 98% rename from lib/PBot/Registerable.pm rename to lib/PBot/Core/Registerable.pm index cd080fdc..62ccc3c2 100644 --- a/lib/PBot/Registerable.pm +++ b/lib/PBot/Core/Registerable.pm @@ -5,7 +5,7 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Registerable; +package PBot::Core::Registerable; use PBot::Imports; diff --git a/lib/PBot/Registry.pm b/lib/PBot/Core/Registry.pm similarity index 99% rename from lib/PBot/Registry.pm rename to lib/PBot/Core/Registry.pm index 405746ce..0c184e66 100644 --- a/lib/PBot/Registry.pm +++ b/lib/PBot/Core/Registry.pm @@ -6,8 +6,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Registry; -use parent 'PBot::Class'; +package PBot::Core::Registry; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/SelectHandler.pm b/lib/PBot/Core/SelectHandler.pm similarity index 88% rename from lib/PBot/SelectHandler.pm rename to lib/PBot/Core/SelectHandler.pm index 3d27257d..b90c92d8 100644 --- a/lib/PBot/SelectHandler.pm +++ b/lib/PBot/Core/SelectHandler.pm @@ -1,13 +1,13 @@ # 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. # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::SelectHandler; -use parent 'PBot::Class'; +package PBot::Core::SelectHandler; +use parent 'PBot::Core::Class'; use PBot::Imports; @@ -18,7 +18,7 @@ sub initialize { sub add_reader { 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'); # create read buffer for this handle @@ -28,7 +28,7 @@ sub add_reader { sub remove_reader { 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); # delete this handle's read buffer diff --git a/lib/PBot/StdinReader.pm b/lib/PBot/Core/StdinReader.pm similarity index 97% rename from lib/PBot/StdinReader.pm rename to lib/PBot/Core/StdinReader.pm index c3a810ba..ace9ccba 100644 --- a/lib/PBot/StdinReader.pm +++ b/lib/PBot/Core/StdinReader.pm @@ -11,8 +11,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::StdinReader; -use parent 'PBot::Class'; +package PBot::Core::StdinReader; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Updater.pm b/lib/PBot/Core/Updater.pm similarity index 97% rename from lib/PBot/Updater.pm rename to lib/PBot/Core/Updater.pm index d0f74b00..24bf67f2 100644 --- a/lib/PBot/Updater.pm +++ b/lib/PBot/Core/Updater.pm @@ -9,8 +9,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Updater; -use parent 'PBot::Class'; +package PBot::Core::Updater; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/Users.pm b/lib/PBot/Core/Users.pm similarity index 99% rename from lib/PBot/Users.pm rename to lib/PBot/Core/Users.pm index c357846d..1efbb9a8 100644 --- a/lib/PBot/Users.pm +++ b/lib/PBot/Core/Users.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::Users; -use parent 'PBot::Class'; +package PBot::Core::Users; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/WebPaste.pm b/lib/PBot/Core/WebPaste.pm similarity index 97% rename from lib/PBot/WebPaste.pm rename to lib/PBot/Core/WebPaste.pm index 24fbd3f2..e3f12f2b 100644 --- a/lib/PBot/WebPaste.pm +++ b/lib/PBot/Core/WebPaste.pm @@ -5,8 +5,8 @@ # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT -package PBot::WebPaste; -use parent 'PBot::Class'; +package PBot::Core::WebPaste; +use parent 'PBot::Core::Class'; use PBot::Imports; diff --git a/lib/PBot/IRCHandlers/Channel.pm b/lib/PBot/IRCHandlers/Channel.pm index 7fd32a2e..575987c3 100644 --- a/lib/PBot/IRCHandlers/Channel.pm +++ b/lib/PBot/IRCHandlers/Channel.pm @@ -6,11 +6,11 @@ # SPDX-License-Identifier: MIT package PBot::IRCHandlers::Channel; -use parent 'PBot::Class'; +use parent 'PBot::Core::Class'; use PBot::Imports; -use PBot::MessageHistory::Constants ':all'; +use PBot::Core::MessageHistory::Constants ':all'; use Time::HiRes qw/time/; use Data::Dumper; diff --git a/lib/PBot/IRCHandlers/Server.pm b/lib/PBot/IRCHandlers/Server.pm index 62a042af..e1101754 100644 --- a/lib/PBot/IRCHandlers/Server.pm +++ b/lib/PBot/IRCHandlers/Server.pm @@ -9,7 +9,7 @@ package PBot::IRCHandlers::Server; use PBot::Imports; -use PBot::MessageHistory::Constants ':all'; +use PBot::Core::MessageHistory::Constants ':all'; use Time::HiRes qw/time/; diff --git a/lib/PBot/PBot.pm b/lib/PBot/PBot.pm index e505ad47..659a8eaa 100644 --- a/lib/PBot/PBot.pm +++ b/lib/PBot/PBot.pm @@ -9,9 +9,9 @@ # classes instead of something like Moo or Object::Pad, though this may # change eventually. # -# PBot has forked the Net::IRC package internally as PBot::IRC. It contains -# numerous bugfixes and supports various new features such as IRCv3 client -# capability negotiation and SASL user authentication. +# PBot has forked the Net::IRC package internally as PBot::Core::IRC. It +# contains numerous bugfixes and supports various new features such as IRCv3 +# client capability negotiation and SASL user authentication. # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT @@ -19,43 +19,43 @@ package PBot::PBot; use PBot::Imports; +use PBot::VERSION; use Carp (); -use PBot::Logger; -use PBot::VERSION; -use PBot::AntiFlood; -use PBot::AntiSpam; -use PBot::BanList; -use PBot::BlackList; -use PBot::Capabilities; -use PBot::Commands; -use PBot::Channels; -use PBot::ChanOps; -use PBot::EventDispatcher; -use PBot::EventQueue; -use PBot::Factoids; -use PBot::Functions; -use PBot::IgnoreList; -use PBot::Interpreter; -use PBot::IRC; -use PBot::IRCHandlers; -use PBot::LagChecker; -use PBot::MessageHistory; -use PBot::Modules; -use PBot::NickList; -use PBot::Plugins; -use PBot::ProcessManager; -use PBot::Registry; -use PBot::Refresher; -use PBot::SelectHandler; -use PBot::StdinReader; +use PBot::Core::Logger; +use PBot::Core::AntiFlood; +use PBot::Core::AntiSpam; +use PBot::Core::BanList; +use PBot::Core::BlackList; +use PBot::Core::Capabilities; +use PBot::Core::Commands; +use PBot::Core::Channels; +use PBot::Core::ChanOps; +use PBot::Core::EventDispatcher; +use PBot::Core::EventQueue; +use PBot::Core::Factoids; +use PBot::Core::Functions; +use PBot::Core::IgnoreList; +use PBot::Core::Interpreter; +use PBot::Core::IRC; +use PBot::Core::IRCHandlers; +use PBot::Core::LagChecker; +use PBot::Core::MessageHistory; +use PBot::Core::Modules; +use PBot::Core::NickList; +use PBot::Core::Plugins; +use PBot::Core::ProcessManager; +use PBot::Core::Registry; +use PBot::Core::Refresher; +use PBot::Core::SelectHandler; +use PBot::Core::StdinReader; +use PBot::Core::Updater; +use PBot::Core::Users; +use PBot::Core::WebPaste; use PBot::Storage::HashObject; use PBot::Storage::DualIndexHashObject; use PBot::Storage::DualIndexSQLiteObject; -use PBot::Updater; -use PBot::Users; use PBot::Utils::ParseDate; -use PBot::WebPaste; use Encode; use File::Basename; @@ -125,13 +125,13 @@ sub initialize { } # 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 $self->register_signal_handlers; # 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 $self->{logger}->log("Args: @ARGV\n") if @ARGV; @@ -142,7 +142,7 @@ sub initialize { $self->{logger}->log("update_dir: $conf{update_dir}\n"); # 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 # --- this must happen before any data files are opened! --- @@ -152,17 +152,17 @@ sub initialize { } # 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 - $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 $self->{version} = PBot::VERSION->new(pbot => $self, %conf); $self->{logger}->log($self->{version}->version . "\n"); # 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 if (not length $self->{registry}->get_value('irc', 'botnick')) { @@ -171,34 +171,34 @@ sub initialize { } # 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 - $self->{event_queue} = PBot::EventQueue->new(pbot => $self, name => 'PBot event queue', %conf); - $self->{event_dispatcher} = PBot::EventDispatcher->new(pbot => $self, %conf); - $self->{users} = PBot::Users->new(pbot => $self, filename => "$conf{data_dir}/users", %conf); - $self->{antiflood} = PBot::AntiFlood->new(pbot => $self, %conf); - $self->{antispam} = PBot::AntiSpam->new(pbot => $self, %conf); - $self->{banlist} = PBot::BanList->new(pbot => $self, %conf); - $self->{blacklist} = PBot::BlackList->new(pbot => $self, filename => "$conf{data_dir}/blacklist", %conf); - $self->{channels} = PBot::Channels->new(pbot => $self, filename => "$conf{data_dir}/channels", %conf); - $self->{chanops} = PBot::ChanOps->new(pbot => $self, %conf); - $self->{factoids} = PBot::Factoids->new(pbot => $self, filename => "$conf{data_dir}/factoids.sqlite3", %conf); - $self->{functions} = PBot::Functions->new(pbot => $self, %conf); - $self->{refresher} = PBot::Refresher->new(pbot => $self); - $self->{ignorelist} = PBot::IgnoreList->new(pbot => $self, filename => "$conf{data_dir}/ignorelist", %conf); - $self->{irchandlers} = PBot::IRCHandlers->new(pbot => $self, %conf); - $self->{interpreter} = PBot::Interpreter->new(pbot => $self, %conf); - $self->{lagchecker} = PBot::LagChecker->new(pbot => $self, %conf); - $self->{messagehistory} = PBot::MessageHistory->new(pbot => $self, filename => "$conf{data_dir}/message_history.sqlite3", %conf); - $self->{modules} = PBot::Modules->new(pbot => $self, %conf); - $self->{nicklist} = PBot::NickList->new(pbot => $self, %conf); + $self->{event_queue} = PBot::Core::EventQueue->new(pbot => $self, name => 'PBot event queue', %conf); + $self->{event_dispatcher} = PBot::Core::EventDispatcher->new(pbot => $self, %conf); + $self->{users} = PBot::Core::Users->new(pbot => $self, filename => "$conf{data_dir}/users", %conf); + $self->{antiflood} = PBot::Core::AntiFlood->new(pbot => $self, %conf); + $self->{antispam} = PBot::Core::AntiSpam->new(pbot => $self, %conf); + $self->{banlist} = PBot::Core::BanList->new(pbot => $self, %conf); + $self->{blacklist} = PBot::Core::BlackList->new(pbot => $self, filename => "$conf{data_dir}/blacklist", %conf); + $self->{channels} = PBot::Core::Channels->new(pbot => $self, filename => "$conf{data_dir}/channels", %conf); + $self->{chanops} = PBot::Core::ChanOps->new(pbot => $self, %conf); + $self->{factoids} = PBot::Core::Factoids->new(pbot => $self, filename => "$conf{data_dir}/factoids.sqlite3", %conf); + $self->{functions} = PBot::Core::Functions->new(pbot => $self, %conf); + $self->{refresher} = PBot::Core::Refresher->new(pbot => $self); + $self->{ignorelist} = PBot::Core::IgnoreList->new(pbot => $self, filename => "$conf{data_dir}/ignorelist", %conf); + $self->{irchandlers} = PBot::Core::IRCHandlers->new(pbot => $self, %conf); + $self->{interpreter} = PBot::Core::Interpreter->new(pbot => $self, %conf); + $self->{lagchecker} = PBot::Core::LagChecker->new(pbot => $self, %conf); + $self->{messagehistory} = PBot::Core::MessageHistory->new(pbot => $self, filename => "$conf{data_dir}/message_history.sqlite3", %conf); + $self->{modules} = PBot::Core::Modules->new(pbot => $self, %conf); + $self->{nicklist} = PBot::Core::NickList->new(pbot => $self, %conf); $self->{parsedate} = PBot::Utils::ParseDate->new(pbot => $self, %conf); - $self->{plugins} = PBot::Plugins->new(pbot => $self, %conf); - $self->{process_manager} = PBot::ProcessManager->new(pbot => $self, %conf); - $self->{select_handler} = PBot::SelectHandler->new(pbot => $self, %conf); - $self->{stdin_reader} = PBot::StdinReader->new(pbot => $self, %conf); - $self->{webpaste} = PBot::WebPaste->new(pbot => $self, %conf); + $self->{plugins} = PBot::Core::Plugins->new(pbot => $self, %conf); + $self->{process_manager} = PBot::Core::ProcessManager->new(pbot => $self, %conf); + $self->{select_handler} = PBot::Core::SelectHandler->new(pbot => $self, %conf); + $self->{stdin_reader} = PBot::Core::StdinReader->new(pbot => $self, %conf); + $self->{webpaste} = PBot::Core::WebPaste->new(pbot => $self, %conf); # register commands in Commands directory $self->{commands}->register_commands; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index b63b78b0..0b9a1f77 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -7,7 +7,7 @@ # SPDX-License-Identifier: MIT package PBot::VERSION; -use parent 'PBot::Class'; +use parent 'PBot::Core::Class'; use PBot::Imports;