1 # ho_killreconnect.pl
 2 # $Id: ho_killreconnect.pl,v 1.6 2004/08/15 08:53:05 jvunder REL_0_3 $
 3 #
 4 # Reconnects if you're killed by an oper.
 5 #
 6 # Part of the Hybrid Oper Script Collection.
 7 
 8 use strict;
 9 use vars qw($VERSION %IRSSI $SCRIPT_NAME);
10 
11 use Irssi;
12 use HOSC::again;
13 use HOSC::again 'HOSC::Base';
14 use HOSC::again 'HOSC::Tools';
15 
16 $SCRIPT_NAME = 'Killreconnect';
17 ($VERSION) = '$Revision: 1.6 $' =~ / (\d+\.\d+) /;
18 %IRSSI = (
19     authors     => 'Garion',
20     contact     => 'garion@irssi.org',
21     name        => 'ho_killreconnect',
22     description => 'Reconnects if you are killed by an oper.',
23     license     => 'Public Domain',
24     url         => 'http://www.garion.org/irssi/hosc/',
25     changed     => '04 April 2004 12:34:38',
26 );
27 
28 ho_print_init_begin();
29 
30 Irssi::signal_add('event kill', 
31     sub {
32         my ($server, $reason, $nick, $address) = @_;
33         $reason =~ s/^[^:]+://;
34         ho_print_warning('[' . $server->{tag} . '] ' . 
35             "You were killed by $nick [$address] $reason. Reconnecting."); 
36         Irssi::signal_stop(); 
37     }
38 );
39 
40 ho_print("Enabled auto-reconnect when killed by an oper.");
41 ho_print_init_end();
42 
43 # Yes, that's all. Explanation:
44 # <cras> garion: you could probably do that more easily by preventing
45 #        irssi from seeing the kill signal
46 # <cras> garion: signal_add('event kill', sub { Irssi::signal_stop(); });
47 # <cras> garion: to prevent irssi from setting server->no_reconnect = TRUE


syntax highlighted by Code2HTML, v. 0.9.1