mirror of
https://github.com/irssi/irssi.git
synced 2026-08-08 19:30:15 +02:00
run syncdocs.sh and syncscripts.sh
This commit is contained in:
parent
db705278d2
commit
6a83eddf84
6 changed files with 102 additions and 78 deletions
|
|
@ -6,36 +6,27 @@ use Irssi::Irc;
|
|||
use strict;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = "1.00";
|
||||
$VERSION = "1.01";
|
||||
%IRSSI = (
|
||||
authors => 'Timo Sirainen',
|
||||
name => 'quitmsg',
|
||||
description => 'Random quit messages',
|
||||
license => 'Public Domain',
|
||||
changed => 'Sun Mar 10 23:18 EET 2002'
|
||||
changed => 'Mon Jul 22 20:00 EET 2020'
|
||||
);
|
||||
|
||||
my $quitfile = glob "~/.irssi/irssi.quit";
|
||||
my $quitfile = Irssi::get_irssi_dir() . "/irssi.quit";
|
||||
|
||||
sub cmd_quit {
|
||||
my ($data, $server, $channel) = @_;
|
||||
return if ($data ne "");
|
||||
|
||||
open (my $fh, "<", $quitfile) || return;
|
||||
my @lines = <$fh>;
|
||||
|
||||
open (f, "<", $quitfile) || return;
|
||||
my $lines = 0; while(<f>) { $lines++; };
|
||||
|
||||
my $line = int(rand($lines))+1;
|
||||
|
||||
my $quitmsg;
|
||||
seek(f, 0, 0); $. = 0;
|
||||
while(<f>) {
|
||||
next if ($. != $line);
|
||||
|
||||
chomp;
|
||||
$quitmsg = $_;
|
||||
last;
|
||||
}
|
||||
close(f);
|
||||
my $quitmsg = $lines[int(rand(@lines))];
|
||||
chomp($quitmsg);
|
||||
close($fh);
|
||||
|
||||
foreach my $server (Irssi::servers) {
|
||||
$server->command("/disconnect ".$server->{tag}." $quitmsg");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue