diff --git a/etc/bb3.conf b/etc/bb3.conf
index 4c908cc..e51b846 100644
--- a/etc/bb3.conf
+++ b/etc/bb3.conf
@@ -25,6 +25,10 @@ http_plugin_port 1092
hostname erxz.com:10081
alias_url = http://erxz.com/bb3pb
+
+
+ enabled yes
+
# Change this to be bot specific?
@@ -75,7 +79,7 @@ http_plugin_port 1092
root_mask p3m/member/simcop2387
-
+
channel \#freenode-perl-cabal
channel \#perl-help
diff --git a/lib/Bot/BB3/PluginManager.pm b/lib/Bot/BB3/PluginManager.pm
index c872f9d..c6a068b 100644
--- a/lib/Bot/BB3/PluginManager.pm
+++ b/lib/Bot/BB3/PluginManager.pm
@@ -41,7 +41,7 @@ sub new {
sub yield {
my ( $self, $event, @args ) = @_;
- warn "YIELD CALLED: $event\n";
+ # warn "YIELD CALLED: $event\n";
return POE::Kernel->post( $self->{session}, $event, @args );
}
@@ -49,7 +49,7 @@ sub yield {
sub call {
my ( $self, $event, @args ) = @_;
- warn "CALL CALLED: $event\n";
+ # warn "CALL CALLED: $event\n";
return POE::Kernel->call( $self->{session}, $event, @args );
}
@@ -478,7 +478,7 @@ sub handle_said_queue {
return unless $queue and @$queue;
while( defined( my $said = shift @$queue ) ) {
- warn "Queuing $said\n";
+ # warn "Queuing $said\n";
for( @$children ) {
warn "Checking ", $_->{wheel}->PID, ": $_->{queue}";
@@ -601,10 +601,10 @@ sub child_output {
my( $self, $kernel, $output, $child_id ) = @_[OBJECT,KERNEL,ARG0,ARG1];
my( $said, $text ) = @$output;
- warn "Got some child output! $text\n";
+ # warn "Got some child output! $text\n";
my $child = $self->{children}->{$child_id};
- warn "Deleting child queue: $child_id, $child->{queue}";
+ # warn "Deleting child queue: $child_id, $child->{queue}";
$child->{queue} = undef;
$self->yield('handle_said_queue');
@@ -639,7 +639,7 @@ sub child_err {
return unless $err_output =~ /\S/;
- warn "\n\tChild $child_id: $err_output\n";
+ # warn "\n\tChild $child_id: $err_output\n";
}
sub child_fail {
diff --git a/lib/Bot/BB3/Roles/Evalpastebin.pm b/lib/Bot/BB3/Roles/Evalpastebin.pm
new file mode 100644
index 0000000..b08d466
--- /dev/null
+++ b/lib/Bot/BB3/Roles/Evalpastebin.pm
@@ -0,0 +1,68 @@
+package Bot::BB3::Roles::Evalpastebin;
+
+use POE;
+use POE::Component::Server::TCP;
+use strict;
+use Data::Dumper;
+use JSON::MaybeXS;
+
+sub new {
+ my( $class, $conf, $pm ) = @_;
+
+ my $self = bless { conf => $conf, pm => $pm }, $class;
+
+ $self->{session} = POE::Session->create(
+ object_states => [
+ $self => [ qw/_start receive_paste/ ]
+ ]
+ );
+
+ return $self;
+}
+
+sub _start {
+ my( $self, $kernel ) = @_[OBJECT,KERNEL];
+ my $conf = $self->{conf};
+
+ # TODO setup TCP server.
+ $self->{server} = POE::Component::Server::TCP->new(
+ Port => 1784,
+ Address =>'127.0.0.1',
+ ClientFilter => "POE::Filter::Line",
+ ClientInput => \&receive_paste,
+ );
+
+ $kernel->alias_set( "evalpastebin_role" );
+ $kernel->sig("DIE" => 'sig_DIE' );
+}
+
+sub receive_paste {
+ my ($kernel, $line) = @_[KERNEL, ARG0];
+
+ chomp $line;
+
+ if ($line eq 'GET_CHANNELS') {
+ my $channel_list = $kernel->call("Bot::BB3::Roles::IRC", "channel_list");
+ $_[HEAP]{client}->put(encode_json($channel_list));
+ } else {
+ my ($alert_channel, $link, $who, $summary) = split(/\x1E/, $line);
+
+ if( $alert_channel !~ /^\s*---/ ) { # Ignore things like "---irc.freenode, skip server names
+ my($server,$nick,$channel) = split /:/,$alert_channel,3;
+
+ $_[KERNEL]->post( "Bot::BB3::Roles::IRC",
+ external_message =>
+ $server,
+ $nick,
+ $channel,
+ "$who pasted a new file at $link - $summary"
+ );
+ }
+ }
+}
+
+sub sig_DIE {
+ # Do nothing, we're ignoring fatal errors from our child, poco-server-simplehttp. I think we don't need to respawn them.
+}
+
+1;