Skip to content

Commit

Permalink
added a new script dont_reconnect.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
terminaldweller committed May 7, 2024
1 parent 08e2b21 commit d0984c4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions scripts/dont_reconnect.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use Irssi;
use strict;
use warnings;

# feature nobody asked for in 25 years except Chex who thinks this should be a core feature
our $VERSION = "1.0.0";
our %IRSSI = (
authors => 'terminaldweller',
contact => 'https://terminaldweller.com',
name => 'dont_reconnect',
description => 'runs rmreconn after servers in the list disconnect',
license => 'GPL3 or newer',
url => 'https://github.com/irssi/scripts.irssi.org',
);

# dont_reconnect_list = "server1 server2 server3"
Irssi::settings_add_str('misc', 'dont_reconnect_list', '');

sub run_rm_reconn {
my $server_rec = @_;
my $recon_list = Irssi::settings_get_str('dont_reconnect_list');
my @list = split(/ /, $recon_list);

my $current_server_name = Irssi::server_name($server_rec);

foreach my $server_name (@list) {
if ($server_name eq $current_server_name) {
Irssi::command("rmreconn");
return;
}
}
}

Irssi::signal_add('server disconnect', 'run_rm_reconn');

0 comments on commit d0984c4

Please sign in to comment.