# ... That's about it, enjoy!
#
-
+use strict;
use Irssi;
use DBI;
use vars qw($VERSION %IRSSI);
# chomp( @user = <LIST> );
# close LIST;
-$d = ('database');
-$u = ('user');
-$p = ('password');
+my $d = ('database');
+my $u = ('user');
+my $p = ('password');
sub event_privmsg {
my ($nickname) = $text =~ /^~search (.*)/;
- $dbh = DBI->connect("DBI:mysql:$d","$u","$p")
+ my $dbh = DBI->connect("DBI:mysql:$d","$u","$p")
or die "Couldn't connect to database: " . DBI->errstr;
- $sth = $dbh->prepare("SELECT * FROM 13th where nickname like \"\%$nickname\%\";")
- or die "Cant prepare $statement: $dbh->errstr\n";
- $rv = $sth->execute
+ my $sth = $dbh->prepare("SELECT * FROM 13th where nickname like \"\%$nickname\%\";")
+ or die "Cant prepare statement: $dbh->errstr\n";
+ my $rv = $sth->execute
or die "cant execute the query: $sth->errstr\n";
if ($rv >= 1) {
my @row;
while ( @row = $sth->fetchrow_array( ) ) {
- $n = "$row[0]\n";
- $e = "$row[1]\n";
- $b = "$row[2]\n";
+ my $n = "$row[0]\n";
+ my $e = "$row[1]\n";
+ my $b = "$row[2]\n";
$server->command ( "msg $nick Nickname : $n" );
$server->command ( "msg $nick Email : $e" );
$server->command ( "msg $nick Birthday : $b" );
# guys are calling their software when it's in a buggy and
# not-so-very-usefull stage of development :P
#
+use strict;
use Irssi;
use LWP::Simple;
use vars qw($VERSION %IRSSI);
-$translate =0;
+my $translate =0;
$VERSION = "0.2";
%IRSSI = (
);
sub income {
-my ($server, $data, $nick, $mask, $target) = @_;
- $eng = $data;
- if($translate=1) {
+ my ($server, $data, $nick, $mask, $target) = @_;
+ my $eng = $data;
+ if($translate) {
$eng =~ s/ /+/ig;
chop($eng);
Irssi::command("/echo [$nick] $eng");
- $result = get("http://ets.freetranslation.com:5081/?Sequence=core&Mode=txt&template=TextResults2.htm&Language=English/Norwegian&SrcText=$eng");
+ my $result = get("http://ets.freetranslation.com:5081/?Sequence=core&Mode=txt&template=TextResults2.htm&Language=English/Norwegian&SrcText=$eng");
Irssi::command("/echo [$nick] $result");
}
}
sub trans {
-
- if($translate =0) { $translate=1; } else { $translate =0; }
+ Irssi::print $translate;
+ $translate = 1 - $translate;
}
Irssi::signal_add("message public", "income");
# $Id: exec-clean.pl,v 1.6 2002/07/04 13:18:02 jylefort Exp $
+use strict;
use Irssi 20020121.2020 ();
+use vars qw($VERSION %IRSSI);
$VERSION = "1.01";
%IRSSI = (
authors => 'Jean-Yves Lefort',
#
# * kill the process using a better method (TERM -> sleep -> KILL etc)
-use strict;
use Irssi::UI;
sub window_destroyed {
sub init {
# verifying if settings file exists
- if (!(open xa_settings, "<$xa_confile")) {
+ if (!(open xa_settings, q{<}, $xa_confile)) {
putlog("No config file: /xahelp for help");
return 0;
};
# Adding the keyword and the reason in the config file
# may create double entries...
my($kw, $reason) = @_;
- if(!(open xa_settings, ">>$xa_confile")) {
+ if(!(open xa_settings, q{>>}, $xa_confile)) {
&putlog("Unable to open file $xa_confile");
}
print xa_settings "$kw:$reason\n";
sub xa_save {
# save the temp infos (might correct the double entries)
my ($data,$server,$channel) = @_;
- if(!(open xa_settings, ">$xa_confile")) {
+ if(!(open xa_settings, q{>}, $xa_confile)) {
&putlog("Unable to create file $xa_confile");
}
print xa_settings "bnick:$infos{'bnick'}\n";
if (-e $file) {
local *F;
- open(F, "<$file");
+ open(F, "<", $file);
local $/ = "\n";
while (<F>) {
my ($file) = @_;
local *F;
- open(F, ">$file") or die "Could not load the fake ctcpreply list for writing";
+ open(F, ">", $file) or die "Could not load the fake ctcpreply list for writing";
for (my $n = 0; $n < @fakectcp; ++$n) {
print(F join("\t", $fakectcp[$n]->{item}, $fakectcp[$n]->{reply}) . "\n");
+use strict;
+use vars qw($VERSION %IRSSI);
my $help = <<EOF;
Usage: (all on one line)
url => "http://irssi.dgl.cx/"
);
-use strict;
-
Irssi::command_bind('file', sub {
my $data = shift;
}
# or do borrowed from one of juerd's scripts (needs 5.6 though)
- open(FILE, "<$data") or do {
+ open(FILE, "<", $data) or do {
print "Error opening '$data': $!";
return;
};
# /FIND - display people who are in more than one channel with you
# (it's ugly code)
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$win->set_name($IRSSI{name}); # Select the window
$win->print($debugmessage,MSGLEVEL_CLIENTCRAP);
my $debugtid = localtime(time);
- open (LOGFILE,">> $logfile");
- print LOGFILE "$debugtid: $debugmessage\n";
- close (LOGFILE);
+ open (LOGFILE,">>", $logfile);
+ print LOGFILE "$debugtid: $debugmessage\n";
+ close (LOGFILE);
}
}
sub admin_reload {
if ( -r Irssi::settings_get_str('findbot_summaryfile') ) {
- open (FINDFILE,Irssi::settings_get_str('findbot_summaryfile')); # Open the file
+ open (FINDFILE, "<", Irssi::settings_get_str('findbot_summaryfile')); # Open the file
@bigarray = <FINDFILE>; # Load it whole into memory :)
close (FINDFILE);
debugprint(10,"[ADMIN] Summary file has been reloaded into memory.");
check_vital_configuration(); # Run a subroutine to check all variables before starting
if ( -r Irssi::settings_get_str('findbot_summaryfile') ) {
- open (FINDFILE,Irssi::settings_get_str('findbot_summaryfile')); # Open the file
+ open (FINDFILE, "<", Irssi::settings_get_str('findbot_summaryfile')); # Open the file
@bigarray = <FINDFILE>; # Load it whole into memory :)
close (FINDFILE);
} else {
my ($txt, $mlvl) = @_;
my $lvl = Irssi::settings_get_int('fleech_verbose_level');
if ($dbglog) {
- if (not open (DBGLOG, ">> $dbglog")) {
+ if (not open (DBGLOG, ">>", $dbglog)) {
$dbglog = "";
} else {
# print_dbg("fleech.pl $VERSION loaded");
local(*FILE);
%friends = ();
- open FILE, "< $file";
+ open FILE, "<", $file;
while (<FILE>) {
($mask,$net,$channel,$flags) = split;
for (split //, $flags) {
return if $auto && !Irssi::settings_get_bool('friends_autosave');
- open FILE, "> $file";
+ open FILE, ">", $file;
for my $mask (keys %friends) {
$count++;
for my $net (keys %{$friends{$mask}}) {
$all_handles = {};
local *F;
- open(F, "<$friendfile") or return -1;
+ open(F, "<", $friendfile) or return -1;
local $/ = "\n";
while (<F>) {
my ($handle, $hosts, $globflags, $chanstr, $password, $comment);
# be sane
my $old_umask = umask(077);
- if (!defined open(F, ">$tmpfile")) {
+ if (!defined open(F, ">", $tmpfile)) {
Irssi::print("Couldn't open $tmpfile for writing");
return 0;
}
if ($motdfile_modified < $lm) {
$motdfile_modified = $lm;
@motd = ();
- open(FILE, $f);
+ open(FILE, "<", $f);
while(<FILE>) {
chomp;
s/\t/ /g;
return;
}
- unless (open (RFILE, $filepath)) {
+ unless (open (RFILE, "<", $filepath)) {
send_user_msg($server_tag, $irc_nick, "Couldn't open file: " .
"'$fs_prefs{clr_hi}$ufile$fs_prefs{clr_txt}'!");
print_msg("Could not open file $filepath");
{
my $f = $conffile;
$f =~ s/\$IRSSI/Irssi::get_irssi_dir()/e or $f =~ s/~/$ENV{"HOME"}/;
- if (!open(FILE, ">$f")) {
+ if (!open(FILE, ">", $f)) {
print_msg("Unable to open $f for writing!");
return 1;
}
###############################################################################
sub load_distro {
my $file = $_[0];
- if (!open(FILE, "<$file")) {
+ if (!open(FILE, "<", $file)) {
print_msg("Unable to open $file for reading!");
return 0;
}
my $f = $fs_prefs{distro_file};
$f =~ s/\$IRSSI/Irssi::get_irssi_dir()/e or $f =~ s/~/$ENV{"HOME"}/;
- if (!open(FILE, ">$f")) {
+ if (!open(FILE, ">", $f)) {
print_msg("Unable to open $f for writing!");
return 1;
}
my $f = $conffile;
$f =~ s/\$IRSSI/Irssi::get_irssi_dir()/e or $f =~ s/~/$ENV{"HOME"}/;
- if (!open(FILE, "<$f")) {
+ if (!open(FILE, "<", $f)) {
print_msg("Unable to open $f for reading!");
return 1;
}
my $f = $fs_prefs{queuefile};
$f =~ s/\$IRSSI/Irssi::get_irssi_dir()/e or $f =~ s/~/$ENV{"HOME"}/;
- if (!open(FILE, ">$f")) {
+ if (!open(FILE, ">", $f)) {
print_msg("Unable to open $f for writing!");
return 1;
}
my $f = $fs_prefs{queuefile};
$f =~ s/\$IRSSI/Irssi::get_irssi_dir()/e or $f =~ s/~/$ENV{"HOME"}/;
- if (!open(FILE, "<$f")) {
+ if (!open(FILE, "<", $f)) {
print_msg("Unable to open $f for reading!");
return 1;
}
{
my $f = $fs_prefs{log_name};
$f =~ s/\$IRSSI/Irssi::get_irssi_dir()/e or $f =~ s/~/$ENV{"HOME"}/;
- if (!$logfp && $fs_prefs{log_name} && open(LOGFP, ">>$f")) {
+ if (!$logfp && $fs_prefs{log_name} && open(LOGFP, ">>", $f)) {
$logfp = \*LOGFP;
select((select($logfp), $|++)[0]);
}
sub savegetop {
local *fp;
- open (fp, ">$getopfile") or die "Couldn't open $getopfile for writing";
+ open (fp, ">", $getopfile) or die "Couldn't open $getopfile for writing";
for my $ircnet (keys %getop) {
for my $chan (keys %{$getop{$ircnet}}) {
return unless (-e $getopfile);
local *fp;
- open (fp, "<$getopfile") or die "Couldn't open $getopfile for reading";
+ open (fp, "<", $getopfile) or die "Couldn't open $getopfile for reading";
local $/ = "\n";
while (<fp>) {
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$cmd = join(' ',@args);
# check if the regexp is valid
- eval("'' =~ /$match/");
+ eval { qr/$match/ };
if($@) { # there was an error
chomp $@;
Irssi::print($@,MSGLEVEL_CLIENTERROR);
# window (can be toggled) and to put up a timestamp.
#
+use strict;
use Irssi;
use POSIX;
use vars qw($VERSION %IRSSI);
($dest->{level} & ($opt)) &&
($dest->{level} & MSGLEVEL_NOHILIGHT) == 0
) {
- $window = Irssi::window_find_name('hilight');
+ my $window = Irssi::window_find_name('hilight');
if ($dest->{level} & MSGLEVEL_PUBLIC) {
$text = $dest->{target}.": ".$text;
}
}
-$window = Irssi::window_find_name('hilight');
+my $window = Irssi::window_find_name('hilight');
Irssi::print("Create a window named 'hilight'") if (!$window);
Irssi::settings_add_bool('hilightwin','hilightwin_showprivmsg',1);
# $Id: hitcount.pl,v 1.3.2.2 2002/03/05 18:19:28 shrike Exp shrike $
+use strict;
use vars qw($VERSION %IRSSI);
my @rev = split(/ /, "$Revision: 1.3.2.2 $n");
$VERSION = "1.3";
# Add ignore regexp, to prevent f.ex. css-files from increasing counter
use Irssi::TextUI;
-use strict;
# Debug level - higher levels print out more crap
my $debug_level = 0;
($total_hitcount, $my_hitcount) = (0);
# Go through the access log and count matches to the given regexp
- if(open STUFF, "$filename")
+ if(open STUFF, "<", $filename)
{
while (<STUFF>)
{
# CopyLeft Riku Voipio 2001
# half-life bot script
+use strict;
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);
);
-$qdir="/home/nchip/qstat/";
+my $qdir="/home/nchip/qstat/";
sub cmd_hl {
my ($server, $data, $nick, $mask, $target) =@_;
if ($data=~/^!hl/){
- @foo=split(/\s+/,$data);
- $len=@foo;
+ my @foo=split(/\s+/,$data);
+ my $len=@foo;
if ($len==1){
$foo[1]="turpasauna.taikatech.com";
}
#fixme, haxxor protection
- $word=$foo[1];
+ my $word=$foo[1];
$_=$word;
$word=~s/[^a-zA-ZäöÄÖ0-9\.]/ /g;
- open(DAT, "$qdir"."qstat -hls ".$word."|");
- $count=0;
- foreach $line (<DAT>)
+ open(DAT, "-|", $qdir."qstat -hls $word");
+ my $count=0;
+ foreach my $line (<DAT>)
{
if ($count==1)
{
Irssi::signal_add_last('message public', 'cmd_hl');
Irssi::print("Half-life info bot by nchip loaded.");
-
-
#
##
-
+use strict;
use Socket;
use Sys::Hostname;
use IO::Handle;
sub run_bot {
my $server = Irssi::active_server();
+ my $msg;
- ($hispaddr = recv(S, $msg, 1000, 0)) or print "$!\n";
- ($port, $hisiaddr) = sockaddr_in($hispaddr);
- $host = inet_ntoa($hisiaddr);
+ (my $hispaddr = recv(S, $msg, 1000, 0)) or print "$!\n";
+ my ($port, $hisiaddr) = sockaddr_in($hispaddr);
+ my $host = inet_ntoa($hisiaddr);
$msg =~ s/\n.$//s;
$msg =~ s/\n..$//s;
# Received challenge rcon reply..
elsif ($msg =~ /^ÿÿÿÿchallenge rcon (\d+)$/ && $rcon_msg) {
$challenge = $1;
- $data = "ÿÿÿÿrcon $challenge $rcon_pass $rcon_msg";
+ my $data = "ÿÿÿÿrcon $challenge $rcon_pass $rcon_msg";
defined(send(S, $data, 0, $serv_paddr)) or
$server->command("/notice $channel Error sending rcon: $!");
}
# Multiline rcon responses
if ($msg =~ /\n/s) {
- @rows = split /\n/, $msg;
- foreach $row (@rows) {
+ my @rows = split /\n/, $msg;
+ foreach my $row (@rows) {
# We don't want to see these
if ($row =~ /^[\t \n]*$/ ||
$row =~ /^[ADMIN] Load/ ||
#########[ MAIN ]###########
# Open the logfile.
-open LOG, ">>$logfile" or die "Cannot open logfile!\n";
+open LOG, ">>", $logfile or die "Cannot open logfile!\n";
LOG->autoflush(1);
# Start listening the socket for udp messages.
# $Id: hostname.pl,v 1.8 2002/07/04 13:18:02 jylefort Exp $
+use strict;
use Irssi 20020121.2020 ();
+use vars qw($VERSION %IRSSI);
$VERSION = "1.01";
%IRSSI = (
authors => 'Jean-Yves Lefort',
#
# 2002-02-01 initial release
-use strict;
use Socket;
use Socket6;
sub get_addresses {
Irssi::print("Resolving IP addresses...");
%addresses = ();
- open(IFCONFIG, "ifconfig|");
+ open(IFCONFIG, "-|", "ifconfig");
while (<IFCONFIG>) {
$addresses{$2} = resolve($2)
if (/(inet addr:|inet6 addr: |inet |inet6 )([0-9a-f.:]*)/
sub cleanup {
my ($file) = Irssi::get_irssi_dir."/iMPD.conf";
- open CONF, "> $file";
+ open CONF, ">", $file;
for my $net (sort keys %SAVE_VARS) {
print CONF "$net\t$SAVE_VARS{$net}\n";
close CONF;
sub load_settings {
my ($file) = Irssi::get_irssi_dir."/iMPD.conf";
- open CONF, "< $file";
+ open CONF, "<", $file;
while (<CONF>) {
my($net,$val) = split;
if ($net && $val) {
my ($nick, $msg, $tgt) = @_ ;
$tgt ||= "->" ;
my ($lfile) = glob Irssi::settings_get_str("ignore_log");
- if (open(LF, ">>$lfile")) {
+ if (open(LF, ">>", $lfile)) {
my $ts = strftime("%D %H:%M", localtime()) ;
print LF "[$ts] $tgt $nick $msg\n" ;
close LF ;
#!/usr/bin/perl -w
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.6";
# - http://penguin-breeder.org/irssi/
#<scriptinfo>
+use strict;
use vars qw($VERSION %IRSSI);
use Irssi 20020120;
return;
}
- $enc = Irssi::settings_get_str("join18n_encoding");
+ my $enc = Irssi::settings_get_str("join18n_encoding");
$enc = $1 if $data =~ /^\s*-enc\s+(\S+)/;
$data =~ s/^\s*-enc\s+(\S+)//;
- $converter = Text::Iconv->new("UTF-8", $enc);
+ my $converter = Text::Iconv->new("UTF-8", $enc);
if (!$converter) {
Irssi::print("Invalid encoding specified: $enc");
return;
}
- $name = $channel->{name};
+ my $name = $channel->{name};
- $enc = Irssi::settings_get_str("join18n_encoding");
+ my $enc = Irssi::settings_get_str("join18n_encoding");
$enc = $1 if $data =~ /^\s*-enc\s+(\S+)/;
$data =~ s/^\s*-enc\s+(\S+)//;
- $converter = Text::Iconv->new("UTF-8", $enc);
+ my $converter = Text::Iconv->new("UTF-8", $enc);
if (!$converter) {
Irssi::print("Invalid encoding specified: $enc");
return;
}
- $name = $channel->{name};
+ my $name = $channel->{name};
- $enc = Irssi::settings_get_str("join18n_encoding");
+ my $enc = Irssi::settings_get_str("join18n_encoding");
$enc = $1 if $data =~ /^\s*-enc\s+(\S+)/;
$data =~ s/^\s*-enc\s+(\S+)//;
- $converter = Text::Iconv->new("UTF-8", $enc);
+ my $converter = Text::Iconv->new("UTF-8", $enc);
if (!$converter) {
Irssi::print("Invalid encoding specified: $enc");
#
#Irssi script to complement chess backend server
#
+use strict;
use Irssi;
use Irssi::Irc;
use IO::Socket;
license => "GNU GPL",
url => "none as yet",
);
+my $gameRunning=0;
sub processColors
{
#
sub processMsgFromServer
{
- ($server, $msg, $nick)=@_;
- $delimiter="<:=:>";
+ my ($server, $msg, $nick)=@_;
+ my $delimiter="<:=:>";
$_=$msg;
#determine the type of message from the number of delimiters
- $numDelims=(@list=/$delimiter/g);
+ my $numDelims=(my @list=/$delimiter/g);
if ($numDelims==0)
{
my @msg1List=split(/\n/, $msg1);
my $msg1ListSize=@msg1List;
- for ($j=0; $j<$msg1ListSize; $j++)
+ for (my $j=0; $j<$msg1ListSize; $j++)
{
$server->command("eval msg $user1 \\cb$msg1List[$j]\\co");
}
my @msg2List=split(/\n/, $msg2);
my $msg2ListSize=@msg2List;
- for ($j=0; $j<$msg2ListSize; $j++)
+ for (my $j=0; $j<$msg2ListSize; $j++)
{
$server->command("eval msg $user2 \\cb$msg2List[$j]\\co");
}
sub processMsgFromClient
{
- ($server, $msg, $nick)=@_;
+ my ($server, $msg, $nick)=@_;
#Irssi::print("msg from client:\n$msg\n");
$msg=lc($msg);
{
my($server, $msg, $nick, $address)=@_;
- $msgToSend=processMsgFromClient($server, $msg, $nick);
+ my $msgToSend=processMsgFromClient($server, $msg, $nick);
if ($msgToSend !~ /^INVALID$/)
{
Irssi::print("Sending message now");
send(SOCKET,$msgToSend,0);
Irssi::print("Waiting for message from server\n");
+ my $buffer;
recv(SOCKET,$buffer,32678,0); #read a max of 32k.
processMsgFromServer($server, $buffer, $nick);
}
BEGIN
{
- $PORT=1234;
+ my $PORT=1234;
Irssi::print("connecting to server\n");
- $tcpProtocolNumber = getprotobyname('tcp') || 6;
+ my $tcpProtocolNumber = getprotobyname('tcp') || 6;
socket(SOCKET, PF_INET(), SOCK_STREAM(), $tcpProtocolNumber)
or die("socket: $!");
- $internetPackedAddress = pack('S na4 x8', AF_INET(), $PORT, 127.0.0.1);
+ my $internetPackedAddress = pack('S na4 x8', AF_INET(), $PORT, 127.0.0.1);
connect(SOCKET, $internetPackedAddress) or die("connect: $!");
Irssi::print("Game is now running");
# for irssi 0.7.99 by Timo Sirainen
# Greatly modified by Erkki Seppälä to build dictionary of said words
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
if (exists $typoWords{$word}) {
my $correctWord = $correctWordsByIndex{$typoWords{$word}->[0]}->[0];
- @$complist = (@complist, $correctWord);
+ @$complist = (@$complist, $correctWord);
}
+ my $n;
my %m = map { ($_ => $n++); } @$complist;
@$complist = ();
+ my %m2;
foreach my $key (sort keys %m) {
$m2{$m{$key}}=$key;
}
# version 1.13
# for irssi 0.8.0 by Timo Sirainen
+use strict;
use Symbol;
use vars qw($VERSION %IRSSI);
$VERSION = "1.13";
description => "Show IRC gallery (http://irc-galleria.net, finnish only) information on /WHOIS or /GALLERY",
license => "Public Domain",
url => "http://irssi.org/",
- changed => "2002-03-04T22:47+0100"\r
+ changed => "2002-03-04T22:47+0100"
);
# print the gallery information - assumes the file is in cache directory
sub print_gallery {
+ my %print_notfound;
my $nick = shift;
my $found = 0;
$. = "\n";
my $f = gensym;
- if (!open($f, "$cache_path/$nick")) {
+ if (!open($f, "<", "$cache_path/$nick")) {
Irssi::print("Couldn't open file $cache_path/$nick: $!", MSGLEVEL_CLIENTERROR);
return;
}
$gallery_nicks_time = time();
my $f = gensym;
- if (!open($f, $filename)) {
+ if (!open($f, "<", $filename)) {
Irssi::print("Couldn't open file $filename: $!", MSGLEVEL_CLIENTERROR);
return;
}
if (-d $cache_path) {
unlink(<$cache_path/*>);
} else {
- mkdir($cache_path, 0700) || die "Can't create cache directory $cache_dir";
+ mkdir($cache_path, 0700) || die "Can't create cache directory $cache_path";
}
# we need the nick list, get it once per hour
# Kiitokset statusbar ideasta Whiz:ille.. kiitos pällistä ideasta pälliin skriptaan jne.
# Kiitoksia ei heru Whizille kylläkään toimimattomista regexpeistä... joutu ihan itse opetteleen keletanatu.
+use strict;
use LWP::UserAgent;
use HTTP::Cookies;
use Irssi;
# - use strict;
#################################################################################
-#use strict;
+use strict;
use Irssi;
use Irssi::TextUI;
use vars qw($VERSION %IRSSI);
changed => 'Fri Oct 31 12:22:08 CET 2003',
);
-
+# TODO get rid of all those globals. This script needs some serious rework.
+my (@all, @artist, @title, @album, @year, @name, @status, @comment, @mode, @format, @bitrate, @samplerate, @length, @next, @tot);
+my ($name, $infofile, $status, $artist, $title, $year, $album, $comment, $format, $bitrate, $mode, $samplerate, $length, $next, $min, $sec, $secs, $prefix, $barprefix, $tot);
sub get_info {
my $infofile = Irssi::settings_get_str('blaster_infos_path');
- open (FILE, $infofile); # open and read file with infos
- @all = <FILE>;
+ open (FILE, "<", $infofile); # open and read file with infos
+ my @all = <FILE>;
close (FILE);
@artist = grep (/^artist/, @all); # get the lines with tag infos
sub get_allinfo {
- my $infofile = Irssi::settings_get_str('blaster_infos_path');
- open (FILE, $infofile);
+ $infofile = Irssi::settings_get_str('blaster_infos_path');
+ open (FILE, "<", $infofile);
@all = <FILE>;
close (FILE);
sub get_status {
- my $infofile = Irssi::settings_get_str('blaster_infos_path');
- open (FILE, $infofile);
+ $infofile = Irssi::settings_get_str('blaster_infos_path');
+ open (FILE, "<", $infofile);
@all = <FILE>;
close (FILE);
sub noinfo_error {
- my $infofile = Irssi::settings_get_str('blaster_infos_path');
+ $infofile = Irssi::settings_get_str('blaster_infos_path');
# print help if the info file is not valid
Irssi::print(
"%9IrssiBlaster:%_ \"$infofile\" is not a valid info file. %9Make sure%_ %Rmp3blaster -f $infofile%n %9is running!!!%_\n".
# Script now runs for several days without any
# problems. Added documentation.
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.3";
changed => "Thu Jun 17 12:49:55 CEST 2004",
);
+my $timer;
+
sub incoming_call() # triggered by a timer; use of input_add
{ # caused crash
- while ($message = <ISDNLOG>)
+ while (my $message = <ISDNLOG>)
{
chomp($message);
if ($message =~ / Call to tei .* RING/) # just incoming calls
sub isdn_unload() # for a clean unload
{
- close $ISDNLOG;
+ close ISDNLOG;
Irssi::timeout_remove($timer);
}
#!/usr/bin/perl
+use strict;
use Irssi;
use Irssi::Irc;
+use vars qw($VERSION %IRSSI);
$VERSION = "0.0.1";
%IRSSI = (
# hostname, but array counts from 0 so element's count is number of dots
my $is_friend = 0;
- foreach $exclude (@excludes)
+ foreach my $exclude (@excludes)
{
$is_friend = 1 if ($hostname =~ $exclude);
}
local(*CONF);
%keepnick = ();
- open CONF, "< $file";
+ open CONF, "<", $file;
while (<CONF>) {
my($net,$nick) = split;
if ($net && $nick) {
return if $auto && !Irssi::settings_get_bool('keepnick_autosave');
- open CONF, "> $file";
+ open CONF, ">", $file;
for my $net (sort keys %keepnick) {
print CONF "$net\t$keepnick{$net}\n";
$count++;
# Anyway, this should be fixed. And now it closes stalled gets as well.
#
+use strict;
+use vars qw($VERSION %IRSSI);
+
$VERSION = "1.1";
%IRSSI = (
authors => "Piotr 'Cvbge' Krukowiecki",
sub pd {
return if (not $debug);
- $dcc = @_[0];
+ my $dcc = @_[0];
Irssi::print("SDC '$dcc->{type}' from '$dcc->{nick}' on '$dcc->{servertag}' arg '$dcc->{arg}'");
Irssi::print("SDC created '$dcc->{created}' addr '$dcc->{addr}' port '$dcc->{port}'");
Irssi::print("SDC starttime '$dcc->{starttime}' transfd '$dcc->{transfd}'");
# There's a pretty good explanation of (ircnet) ircd's server kills in
# http://www.irc.org/tech_docs/ircnet/kills.html
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
my @printargs = ();
if ($killmsg =~ /([^ ]*) != (.*)/) {
# 1 != 2
- my $server1 = $1, $server2 = $2;
+ my $server1 = $1, my $server2 = $2;
$server1 =~ s/([^\[]*)\[([^\]]*)\]/\1/;
$msg .= "$2 != $server2";
} elsif ($killmsg =~ /([^ ]*) <- (.*)/) {
# 1 <- 2
- my $server1 = $1, $server2 = $2;
+ my $server1 = $1, my $server2 = $2;
if ($server1 =~ /^\(/) {
# (addr1)server1 <- (add2)server2
$msg = $killmsg;
}
- @list = $server->nicks_get_same($nick);
+ my @list = $server->nicks_get_same($nick);
while (@list) {
- $channel = $list[0];
+ my $channel = $list[0];
shift @list;
# skip nick record
shift @list;
# vim: set expandtab:
+use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "5.8";
%IRSSI = (
Irssi::settings_get_bool("lastfm_debug");
};
-use strict;
use warnings;
no warnings 'closure';
use Data::Dumper;
#
# Triggers on !lastspoke <nick>, !seen <nick> and !lastseen <nick>
#
+use strict;
use Irssi;
use Irssi::Irc;
+use vars qw($VERSION %IRSSI);
$VERSION = "0.2";
%IRSSI = (
url => 'http://irssi.freshdot.net/',
);
+my $target;
+
# Storage for the data.
my %lasthash;
my ($server, $channel, $nick, $address) = @_;
my $allowedChans = lc(Irssi::settings_get_str("lastspoke_channels")) || "(null)";
- if (index($allowedChans, $target) >= 0) {
+ if (index($allowedChans, $channel) >= 0) {
$lasthash{lc($nick)}{'last'} = time();
$lasthash{lc($nick)}{'words'} = "$nick joined $channel";
}
my ($server, $channel, $nick, $address, $reason) = @_;
my $allowedChans = lc(Irssi::settings_get_str("lastspoke_channels")) || "(null)";
- if (index($allowedChans, $target) >= 0) {
+ if (index($allowedChans, $channel) >= 0) {
$lasthash{lc($nick)}{'last'} = time();
if (! $reason) {
$lasthash{lc($nick)}{'words'} = "$nick left from $channel with no reason";
# Hook for public messages.
# Only act on channels we are supposed to act on (settings_get_str)
sub on_public {
- my ($server, $msg, $nick, $addr, $target) = @_;
+ my ($server, $msg, $nick, $addr, $_target) = @_;
- $target = $nick if ( ! $target );
+ $_target = $nick if ( ! $_target );
$nick = $server->{'nick'} if ($nick =~ /^#/);
$target = lc($target);
+use strict;
+use vars qw($VERSION %IRSSI);
$VERSION = "0.5";
%IRSSI = (
authors => "Jari Matilainen",
my $filename = "$rdir" . "$_";
if(-e $filename) {
- open(FILE, $filename);
+ open(FILE, "<", $filename);
$_ = "";
$_ = <FILE> until /NewMessages/;
my @total = split / /, $_;
sub save_config()
{
- open CONFIG, ">$config";
+ open CONFIG, ">", $config;
foreach my $chatnet1 (keys %links)
{
foreach my $channel1 (keys %{$links{$chatnet1}})
sub load_config()
{
%links = ();
- open CONFIG, $config or return;
+ open CONFIG, "<", $config or return;
while (<CONFIG>)
{
chomp;
+use strict;
use Irssi;
use Irssi::Irc;
# list of supported mp3 players
# if you would like to use the script with other players, just type these
# name into the list below... it will probably work :)
-@mp3players=("mpg123", "mpg321", "xmms", "mp3blaster", "alsaplayer");
+my @mp3players=("mpg123", "mpg321", "xmms", "mp3blaster", "alsaplayer", "audacious");
+my ($mp3player, $mp3file);
+my @line;
+my %idtag;
################## PLZ DON'T CHANGE ANYTHING BELOW THIS LINE ##################
# or do it on your own risk!!
}
sub getmp3filename {
- open(CSOCS,$_[0]);
+ open(CSOCS, "-|", $_[0]);
GECMO: while (<CSOCS>) {
chop;
(@line) = split(/\s/,$_);
# we check wheter the mp3file returned by lsof has been opened
# with a known mp3player or not
- HMM: foreach $w (@mp3players) {
+ HMM: foreach my $w (@mp3players) {
# if yes we save it, and leave
if ($w =~ /^$line[0]/) {
$mp3player=$w;
sub getmp3proces {
# most of the players put the file into the memory at first,
# let's try to catch it there, first
- getmp3filename("/usr/sbin/lsof -d mem | grep -i .mp3|");
+ getmp3filename("lsof -d mem | grep -i .mp3");
# if we didn't find anything there, we check the fds for mp3s
if ($mp3player eq "nope") {
- getmp3filename("/usr/sbin/lsof -d 1-15 | grep -i .mp3|");
+ getmp3filename("lsof -d 1-15 | grep -i \\.mp3");
}
# hmm are we listening to anything?
sub getmp3idtags {
# getting the idtags from file
- open(ID3GECMO, "/usr/bin/id3 -R -l \"$mp3file\" |");
+ open(ID3GECMO, "-|", "id3 -R -l \"$mp3file\"");
while (<ID3GECMO>) {
chop;
- foreach $kulcs (keys %idtag) {
+ foreach my $kulcs (keys %idtag) {
if ($_=~ /^$kulcs/) {
s/^$kulcs://; s/\s*$//; s/^\s*//;
if ($_) { $idtag{$kulcs}=$_; }
}
sub do_listen {
-
#setting up variables
my ($data, $server, $witem) = @_;
default_values();
if (!getmp3proces()) { return };
getmp3idtags();
+ my $outtext;
# if there's no usable idtag in the mp3 we use the filename
if (($idtag{"Artist"} eq "Unknow Artist") && ($idtag{"Title"} eq "Unknown Title")) {
- $outtext=$mp3filename;
+ $outtext=$mp3file;
} else {
# if the file is tagged we parse over the tagorder
$outtext=Irssi::settings_get_str("listen_tagorder");
- foreach $w (keys %idtag) {
+ foreach my $w (keys %idtag) {
$outtext=~s/%$w/$idtag{$w}/i;
}
$outtext=~s/%player/$mp3player/i;
}
- $prefix=Irssi::settings_get_str("listen_prefix");
+ my $prefix=Irssi::settings_get_str("listen_prefix");
if (Irssi::settings_get_bool("listen_use_action")) {
$outtext="ME ".$prefix." ".$outtext;
# /statusbar window add loadavg
# /set loadavg_refresh
+use strict;
use Irssi;
+use Irssi::TextUI;
use vars qw($VERSION %IRSSI);
$VERSION="0.4";
license => 'public domain',
);
+my ($timeout, $lavg);
+
sub reload { Irssi::statusbar_items_redraw('loadavg'); }
sub setup {
# compress log files when they're rotated
# for irssi 0.7.99 by Timo Sirainen
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.01";
description => "compress logfiles then they\'re rotated",
license => "Public Domain",
url => "http://irssi.org/",
- changed => "2002-03-04T22:47+0100"\r
+ changed => "2002-03-04T22:47+0100"
);
+use strict;
use vars qw($VERSION %IRSSI);
-
use Irssi 20020120;
$VERSION = "0.02";
%IRSSI = (
# This script adds command /lwho that shows
# locally logged users in current window
-
+use strict;
+use vars qw($VERSION %IRSSI);
$VERSION = '0.01a';
%IRSSI = (
authors => 'Mika',