/usr/share/irssi/scripts/quitrand.pl is in irssi-scripts 20160301.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # If quit message isn't given, quit with a random message
# read from ~/.irssi/irssi.quit
use Irssi;
use Irssi::Irc;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "1.00";
%IRSSI = (
authors => 'Fernando J. Pereda',
contact => 'ferdy@ferdyx.org',
name => 'quitrand',
description => 'Random quit messages - based on quitmsg (Timo Sirainen)',
license => 'GPLv2',
);
my $quitfile = glob "~/.irssi/irssi.quit";
sub cmd_quit {
my ($data, $server, $channel) = @_;
open(f,"<",$quitfile);
my @contenido = <f>;
close(f);
my $numlines = 0;
foreach my $nada (@contenido) {
$numlines++;
}
my $line = int(rand($numlines))+1;
my $quitmsg = "[IRSSI] ".$contenido[$line];
chop($quitmsg);
print($quitmsg);
foreach my $sv (Irssi::servers()) {
foreach my $item ($sv->channels()) {
$item->command("PART ".$item->{name}." $quitmsg");
}
}
foreach my $svr (Irssi::servers()) {
$svr->command("DISCONNECT ".$svr->{tag}." $quitmsg");
}
}
Irssi::command_bind('quit', 'cmd_quit');
|