From 8c862af5a181a601e871cff8244d164da743a8f7 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sat, 22 Jun 2019 23:04:09 +1200 Subject: Evict auto-joining of channels to module --- Plugin/Autojoin.pm | 23 +++++++++++++++++++++++ Plugin/Log.pm | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Plugin/Autojoin.pm (limited to 'Plugin') diff --git a/Plugin/Autojoin.pm b/Plugin/Autojoin.pm new file mode 100644 index 0000000..0620ecd --- /dev/null +++ b/Plugin/Autojoin.pm @@ -0,0 +1,23 @@ +package Plugin::Autojoin; + +use strict; +use warnings; + +my $config; + +sub configure { + my $self = shift; + shift; # cmdref + shift; # run_command + $config = shift; + shift; # root config + + return $self; +} + +sub on_001 { + my ($self, $logger, $server, $message, $irc) = @_; + $irc->yield(join => $_) for @{$config->{channels}}; + return; +} +1; diff --git a/Plugin/Log.pm b/Plugin/Log.pm index 1d69e51..135cd85 100644 --- a/Plugin/Log.pm +++ b/Plugin/Log.pm @@ -14,6 +14,7 @@ my %t = ( nick => color("cyan"), info => color("yellow"), kick => color("red"), + host => color("magenta"), channel => color("blue"), message => color("reset"), misc => color("bright_black"), @@ -33,7 +34,7 @@ sub configure { # FIXME Not triggered yet sub on_001 { my ($self, $logger, $server, $message, $irc) = @_; - $logger->("$t{info}Connected to ${host}$server$t{info} --- \"$t{message}$message$t{info}\"$t{reset}"); + $logger->("$t{info}Connected to $t{host}$server$t{info} --- \"$t{message}$message$t{info}\"$t{reset}"); } sub on_message { -- cgit v1.1