mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-22 11:59:43 +01:00
Move core packages into PBot/Core
This commit is contained in:
parent
799424fcfa
commit
f0e617fef7
@ -9,12 +9,12 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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;
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::AntiSpam;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::AntiSpam;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -7,9 +7,9 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::BanList;
|
||||
package PBot::Core::BanList;
|
||||
|
||||
use parent 'PBot::Class';
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::BlackList;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::BlackList;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::ChanOps;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::ChanOps;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Channels;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Channels;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -6,7 +6,7 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Class;
|
||||
package PBot::Core::Class;
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -6,8 +6,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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) = @_;
|
||||
|
@ -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 <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::EventDispatcher;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::EventDispatcher;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -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 <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::EventQueue;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::EventQueue;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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};
|
@ -16,8 +16,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Functions;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Functions;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -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;
|
@ -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,
|
||||
'',
|
@ -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},
|
@ -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);
|
@ -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};
|
@ -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;
|
||||
|
@ -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
|
||||
------------------------
|
@ -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 <pragma78@gmail.com>
|
||||
# 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) = @_;
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::IgnoreList;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::IgnoreList;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -9,12 +9,12 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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);
|
@ -6,8 +6,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::LagChecker;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::LagChecker;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,7 +5,7 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Logger;
|
||||
package PBot::Core::Logger;
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -9,8 +9,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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}
|
||||
);
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Purpose: Constants related to message history.
|
||||
|
||||
package PBot::MessageHistory::Constants;
|
||||
package PBot::Core::MessageHistory::Constants;
|
||||
|
||||
use Exporter qw/import/;
|
||||
|
@ -9,12 +9,12 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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;
|
@ -9,8 +9,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Modules;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Modules;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -7,8 +7,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::NickList;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::NickList;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Plugins;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Plugins;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -6,8 +6,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# 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
|
@ -7,8 +7,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Refresher;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Refresher;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,7 +5,7 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Registerable;
|
||||
package PBot::Core::Registerable;
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -6,8 +6,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Registry;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Registry;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -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 <pragma78@gmail.com>
|
||||
# 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
|
@ -11,8 +11,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::StdinReader;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::StdinReader;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -9,8 +9,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Updater;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Updater;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::Users;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::Users;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -5,8 +5,8 @@
|
||||
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::WebPaste;
|
||||
use parent 'PBot::Class';
|
||||
package PBot::Core::WebPaste;
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
@ -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;
|
||||
|
@ -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/;
|
||||
|
||||
|
130
lib/PBot/PBot.pm
130
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 <pragma78@gmail.com>
|
||||
# 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;
|
||||
|
@ -7,7 +7,7 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
package PBot::VERSION;
|
||||
use parent 'PBot::Class';
|
||||
use parent 'PBot::Core::Class';
|
||||
|
||||
use PBot::Imports;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user