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" ...
13 my ($server, $channel) = @_;
15 # check if channel has password
16 my $chanrec = $server->channel_find($channel);
17 my $password = $chanrec->{key} if ($chanrec);
19 # We have to use send_raw() because the channel record still
20 # exists and irssi won't even try to join to it with command()
21 $server->send_raw("JOIN $channel $password");
24 sub event_rejoin_kick {
25 my ($server, $data) = @_;
26 my ($channel, $nick) = split(/ +/, $data);
28 return if ($server->{nick} ne $nick);
30 # check if we want to autorejoin this channel
31 my @chans = split(/ ,/, Irssi::settings_get_str('autorejoin_channels'));
32 foreach my $chan (@chans) {
33 if (lc($chan) eq lc($channel)) {
34 channel_rejoin($server, $channel);
40 Irssi::settings_add_str('misc', 'autorejoin_channels', '');
41 Irssi::signal_add('event kick', 'event_rejoin_kick');