2001-10-19 13:28:34 -04:00
|
|
|
# If quit message isn't given, quit with a random message
|
|
|
|
# read from ~/.irssi/irssi.quit
|
2000-03-02 13:09:13 -05:00
|
|
|
|
|
|
|
use Irssi;
|
2000-10-18 16:50:12 -04:00
|
|
|
use Irssi::Irc;
|
2001-07-16 16:22:45 -04:00
|
|
|
use strict;
|
2002-03-10 16:28:38 -05:00
|
|
|
use vars qw($VERSION %IRSSI);
|
|
|
|
|
2021-09-22 06:33:10 -04:00
|
|
|
$VERSION = "1.01";
|
2002-03-10 16:28:38 -05:00
|
|
|
%IRSSI = (
|
|
|
|
authors => 'Timo Sirainen',
|
|
|
|
name => 'quitmsg',
|
|
|
|
description => 'Random quit messages',
|
|
|
|
license => 'Public Domain',
|
2021-09-22 06:33:10 -04:00
|
|
|
changed => 'Mon Jul 22 20:00 EET 2020'
|
2002-03-10 16:28:38 -05:00
|
|
|
);
|
2000-03-02 13:09:13 -05:00
|
|
|
|
2021-09-22 06:33:10 -04:00
|
|
|
my $quitfile = Irssi::get_irssi_dir() . "/irssi.quit";
|
2000-03-02 13:09:13 -05:00
|
|
|
|
|
|
|
sub cmd_quit {
|
|
|
|
my ($data, $server, $channel) = @_;
|
2001-10-20 17:38:40 -04:00
|
|
|
return if ($data ne "");
|
2021-09-22 06:33:10 -04:00
|
|
|
|
|
|
|
open (my $fh, "<", $quitfile) || return;
|
|
|
|
my @lines = <$fh>;
|
2000-03-02 13:09:13 -05:00
|
|
|
|
2021-09-22 06:33:10 -04:00
|
|
|
my $quitmsg = $lines[int(rand(@lines))];
|
|
|
|
chomp($quitmsg);
|
|
|
|
close($fh);
|
2000-03-02 13:09:13 -05:00
|
|
|
|
2001-07-16 16:22:45 -04:00
|
|
|
foreach my $server (Irssi::servers) {
|
2015-06-12 13:40:15 -04:00
|
|
|
$server->command("/disconnect ".$server->{tag}." $quitmsg");
|
2000-03-02 13:09:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-13 13:19:59 -05:00
|
|
|
Irssi::command_bind('quit', 'cmd_quit');
|