1
# automatically rejoin to channel after kicked
3
# /SET autorejoin_channels #channel1 #channel2 ...
5
# NOTE: I personally don't like this feature, in most channels I'm in it
6
# will just result as ban. You've probably misunderstood the idea of /KICK
7
# if you kick/get kicked all the time "just for fun" ...
12
use vars qw($VERSION %IRSSI);
16
authors => 'Timo Sirainen',
18
description => 'Automatically rejoin to channel after kicked',
19
license => 'Public Domain',
20
changed => 'Sun Mar 10 23:18 EET 2002'
24
my ($server, $channel) = @_;
26
# check if channel has password
27
my $chanrec = $server->channel_find($channel);
28
my $password = $chanrec->{key} if ($chanrec);
30
# We have to use send_raw() because the channel record still
31
# exists and irssi won't even try to join to it with command()
32
$server->send_raw("JOIN $channel $password");
35
sub event_rejoin_kick {
36
my ($server, $data) = @_;
37
my ($channel, $nick) = split(/ +/, $data);
39
return if ($server->{nick} ne $nick);
41
# check if we want to autorejoin this channel
42
my @chans = split(/[ ,]+/, Irssi::settings_get_str('autorejoin_channels'));
43
foreach my $chan (@chans) {
44
if (lc($chan) eq lc($channel)) {
45
channel_rejoin($server, $channel);
51
Irssi::settings_add_str('misc', 'autorejoin_channels', '');
52
Irssi::signal_add('event kick', 'event_rejoin_kick');