diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/autostuff.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/autostuff.pl')
| -rw-r--r-- | scripts/autostuff.pl | 39 | 
1 files changed, 39 insertions, 0 deletions
| diff --git a/scripts/autostuff.pl b/scripts/autostuff.pl new file mode 100644 index 0000000..7b197c0 --- /dev/null +++ b/scripts/autostuff.pl @@ -0,0 +1,39 @@ +use strict; +use vars qw($VERSION %IRSSI); + +$VERSION = '0.02'; +%IRSSI = ( +    authors     => 'Juerd', +    contact	=> '#####@juerd.nl', +    name        => 'autostuff', +    description	=> 'Save current servers, channels and windows for autoconnect and autojoin', +    license	=> 'Public Domain', +    url		=> 'http://juerd.nl/site.plp/irssi', +    changed	=> '2010-03-24 14:35', +); + +use Irssi qw(command_bind servers channels windows command); + +command_bind autostuff => sub { +    my ($data, $server, $window) = @_; +    for (servers) { +        my $chatnet = $_->{chatnet} || $_->{tag}; +        command "/network add $chatnet"; +        command "/server add -auto -network $chatnet $_->{address} $_->{port} $_->{password}"; +    } +    for (channels) { +        my $chatnet = $_->{server}->{chatnet} || $_->{server}->{tag}; +        command "/channel add -auto $_->{name} $chatnet $_->{key}"; +    } +    command "/layout save"; +    command "/save"; +}; + +command_bind "window clean" => sub { +    for (sort { $b->{refnum} <=> $a->{refnum} } windows) { +        next if $_->{active}; +        next if $_->{immortal}; +        next if $_->{name}; +        command "/window close $_->{refnum}"; +    } +}; | 
