diff options
author | David Phillips <david@sighup.nz> | 2019-07-02 21:43:14 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2019-07-02 21:57:56 +1200 |
commit | 4d2c0d8317590b014536956691546e7d651dc87d (patch) | |
tree | 1f9bb0ca19a606a291f89bb00f9c04c9fb25afbf | |
parent | ccdf9e726d4d0a507607123decfc932c99a6a525 (diff) | |
download | idalius-4d2c0d8317590b014536956691546e7d651dc87d.tar.xz |
Rejoin: Fix join-on-invitation
-rw-r--r-- | Plugin/Autojoin.pm | 16 | ||||
-rw-r--r-- | Plugin/Rejoin.pm | 34 |
2 files changed, 16 insertions, 34 deletions
diff --git a/Plugin/Autojoin.pm b/Plugin/Autojoin.pm index 4288c42..01c4a87 100644 --- a/Plugin/Autojoin.pm +++ b/Plugin/Autojoin.pm @@ -20,4 +20,20 @@ sub on_001_welcome { $irc->yield(join => $_) for @{$config->{channels}}; return; } + +sub on_kick { + my ($self, $logger, $kicker, $where, $kickee, $why, $irc) = @_; + if ($kickee eq $irc->nick_name) { + $logger->("I was kicked from $where. Rejoining now..."); + $irc->yield(join => $where); + } + return; +} + +sub on_invite { + my ($self, $logger, $who, $where, $irc) = @_; + + $irc->yield(join => $where) if (grep {$_ eq $where} @{$config->{channels}}); + return; +} 1; diff --git a/Plugin/Rejoin.pm b/Plugin/Rejoin.pm deleted file mode 100644 index 127f5bc..0000000 --- a/Plugin/Rejoin.pm +++ /dev/null @@ -1,34 +0,0 @@ -package Plugin::Rejoin; - -use strict; -use warnings; - -my $config; -my $root_config; - -sub configure { - my $self = shift; - shift; # cmdref - shift; # run_command - $config = shift; - $root_config = shift; - - return $self; -} - -sub on_kick { - my ($self, $logger, $kicker, $where, $kickee, $why, $irc) = @_; - if ($kickee eq $irc->nick_name) { - $logger->("I was kicked from $where. Rejoining now..."); - $irc->yield(join => $where); - } - return; -} - -sub on_invite { - my ($self, $logger, $who, $where, $irc) = @_; - - $irc->yield(join => $where) if (grep {$_ eq $where} @{$root_config->{channels}}); - return; -} -1; |