1
mirror of git://git.acid.vegas/archive.git synced 2024-11-15 12:46:41 +00:00
archive/bots/blackhole/honeypot/.irssi/scripts/autorun/rejoin.pl

31 lines
979 B
Perl
Raw Normal View History

2023-09-12 19:47:16 +00:00
use Irssi;
use Irssi::Irc;
use strict;
my $delay = 1;
my $acttag = 0;
my @tags;
sub rejoin {
my ( $data ) = @_;
my ( $tag, $servtag, $channel, $pass ) = split( / +/, $data );
my $server = Irssi::server_find_tag( $servtag );
$server->send_raw( "JOIN $channel $pass" ) if ( $server );
Irssi::timeout_remove( $tags[$tag] );
}
sub event_rejoin_kick {
my ( $server, $data ) = @_;
my ( $channel, $nick ) = split( / +/, $data );
return if ( $server->{ nick } ne $nick );
my $chanrec = $server->channel_find( $channel );
my $password = $chanrec->{ key } if ( $chanrec );
my $rejoinchan = $chanrec->{ name } if ( $chanrec );
my $servtag = $server->{ tag };
Irssi::print "Rejoining $rejoinchan in $delay seconds.";
$tags[$acttag] = Irssi::timeout_add( $delay * 1000, "rejoin", "$acttag $servtag $rejoinchan $password" );
$acttag++;
$acttag = 0 if ( $acttag > 60 );
}
Irssi::signal_add('event kick', 'event_rejoin_kick');