Skip to content

Commit

Permalink
Fix perlcritic issues for all scripts starting with m to r
Browse files Browse the repository at this point in the history
  • Loading branch information
obfuscoder committed Oct 19, 2014
1 parent 263a56d commit dd80027
Show file tree
Hide file tree
Showing 37 changed files with 103 additions and 84 deletions.
4 changes: 2 additions & 2 deletions scripts/autoopper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ sub read_dynamic_hosts {
# Save data to file
sub cmd_save_autoop {
my $file = Irssi::get_irssi_dir."/autoop";
open FILE, "> $file" or return;
open FILE, ">", "$file" or return;

foreach my $item (@opitems) {
printf FILE ("%s\t%s\t%s\n", $item->{mask}, $item->{chan}, $item->{dynamic});
Expand All @@ -172,7 +172,7 @@ sub cmd_save_autoop {
# Load data from file
sub cmd_load_autoop {
my $file = Irssi::get_irssi_dir."/autoop";
open FILE, "< $file" or return;
open FILE, "<","$file" or return;
undef @opitems if (@opitems);

while (<FILE>) {
Expand Down
4 changes: 3 additions & 1 deletion scripts/mail.pl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "2.92";
%IRSSI = (
authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei",
Expand Down Expand Up @@ -114,7 +116,7 @@ sub mbox_count {
$last_mtime = $mtime;

my $f = gensym;
return 0 if (!open($f, $mailfile));
return 0 if (!open($f, "<", $mailfile));

# count new mails only
my $internal_removed = 0;
Expand Down
4 changes: 1 addition & 3 deletions scripts/mailcheck_imap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Contains code from centericq.pl (public domain) and imapbiff (GPL) and
# hence this is also GPL'd.

use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "0.5";
%IRSSI = (
Expand Down Expand Up @@ -40,9 +41,6 @@

use Irssi;
use Irssi::TextUI;


use strict;
use IO::Socket;

# TODO : avoid requiring SSL when it's not in use?
Expand Down
5 changes: 2 additions & 3 deletions scripts/mailcheck_mbox_flux.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/perl -w

use strict;
use Irssi;

use vars qw($VERSION %IRSSI);
Expand All @@ -14,11 +15,9 @@
changed => "Mon Mar 4 23:25:18 EET 2002"
);

use strict;

sub getMessages( $ ) {
local *F;
open(F, $_[0]) or return ();
open(F, "<", $_[0]) or return ();
my $inHeaders = 0;
my $headers;
my %result = ();
Expand Down
20 changes: 10 additions & 10 deletions scripts/mailcheck_pop3_kimmo.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# >install Net::POP3
#

use strict;
use Irssi;
use Net::POP3;
use vars qw($VERSION %IRSSI);
Expand All @@ -23,17 +24,16 @@
);




my (%_mailcount, %_mailchecktimer);

sub cmd_checkmail
{
my $args = shift;
my ($user, $pass, $host) = split(/\;/, $args);
my $i, $from, $subject, $head;
my ($i, $from, $subject, $head);
my $POP3TIMEOUT = Irssi::settings_get_int("pop3_timeout");
my $pop = Net::POP3->new( $host, Timeout => $POP3TIMEOUT );
$count = $pop->login($user, $pass);
my $pop = Net::POP3->new( $host, Timeout => $POP3TIMEOUT );
my $count = $pop->login($user, $pass);

if (!$count || !$pop)
{
Expand Down Expand Up @@ -83,18 +83,18 @@ sub cmd_mail
my $args = shift;
my (@arg) = split(/\s+/, $args);

if ((@arg[0] eq "add") && @arg[1] && @arg[2])
if (($arg[0] eq "add") && $arg[1] && $arg[2])
{
if ($_mailchecktimer{@arg[1]})
if ($_mailchecktimer{$arg[1]})
{
Irssi::print("Account " . @arg[1] . " is already being monitored.");
Irssi::print("Account " . $arg[1] . " is already being monitored.");
}
else
{
start_check(@arg[1], @arg[2]);
start_check($arg[1], $arg[2]);
}
}
elsif (@arg[0] eq "list")
elsif ($arg[0] eq "list")
{
Irssi::print("Active POP3 Accounts Being Monitored:");
foreach (keys %_mailchecktimer)
Expand Down
3 changes: 2 additions & 1 deletion scripts/mass_hilight_blocker.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# * 30.05.2004
# first version of the script

use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.2";
Expand All @@ -39,7 +40,7 @@ sub sig_printtext {
my $server = $dest->{server}; # get server and channel for target
my $channel = $server->channel_find($dest->{target});

foreach $nick ($channel->nicks()) # walk through nicks
foreach my $nick ($channel->nicks()) # walk through nicks
{
$nick = $nick->{nick};
$nick =~ s/([\]\[])/\\$1/g; # ']' and '[' need masking
Expand Down
6 changes: 2 additions & 4 deletions scripts/mkshorterlink.pl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use strict;
use vars qw($VERSION %IRSSI);

$VERSION = "0.3";

%IRSSI = (
'authors' => 'Gergely Nagy',
'contact' => 'algernon\@bonehunter.rulez.org',
Expand Down Expand Up @@ -165,7 +163,7 @@ sub load_unshortlist {
my $count = 0;
local *CONF;

open CONF, "< $file";
open CONF, "<", $file;
while (<CONF>)
{
$noshort{$_} = 1;
Expand All @@ -181,7 +179,7 @@ sub save_unshortlist {
my $file = Irssi::get_irssi_dir."/unshortlist";
local *CONF;

open CONF, "> $file";
open CONF, ">", $file;
foreach (keys %noshort)
{
print CONF $_ if ($noshort{$_});
Expand Down
4 changes: 2 additions & 2 deletions scripts/monitor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ sub cmd_monitor_save {
#my ($data, $server, $item) = @_;
my $file = Irssi::get_irssi_dir."/monitor";
my ($net, $n, $k);
open FILE, "> $file" or return;
open FILE, ">", $file or return;
foreach $net (keys %monitorlist) {
foreach $n (keys %{$monitorlist{$net}}) {
$monitorlist{$net}{$n}{lastseen} = time() if $monitorlist{$net}{$n}{mask_online};
Expand All @@ -369,7 +369,7 @@ sub cmd_monitor_load {
#my ($data, $server, $item) = @_;
my $file = Irssi::get_irssi_dir."/monitor";

open FILE, "< $file" or return;
open FILE, "<", $file or return;
%monitorlist = ();
while (<FILE>) {
chomp;
Expand Down
2 changes: 1 addition & 1 deletion scripts/mpg123.pl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sub cmd_mpg123 {
}
}

open (f, $mpg123file) || return;
open (f, "<", $mpg123file) || return;

while ($mpg123linha=<f>) {

Expand Down
4 changes: 3 additions & 1 deletion scripts/my_beep.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# $/set beep_msg_level HILIGHT
# $/set beep_cmd beep


use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "0.9";
%IRSSI = (
authors => "Remco den Breeje",
Expand All @@ -26,6 +27,7 @@
use Irssi;

my $can_I_beep = 1;
my ($timeout_tag, $autoaway_to_tag);

sub beep_overflow_timeout() {
$can_I_beep = 1;
Expand Down
10 changes: 5 additions & 5 deletions scripts/mysqlurllogger.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#| line | char(255) | YES | | NULL | |
#+-----------+---------------+------+-----+---------+-------+


use strict;
use DBI;
use Irssi;
use Irssi::Irc;
Expand All @@ -30,13 +30,13 @@
url => "http://nchip.ukkosenjyly.mine.nu/irssiscripts/",
);

$dsn = 'DBI:mysql:ircurl:localhost';
$db_user_name = 'tunnus';
$db_password = 'salakala';
my $dsn = 'DBI:mysql:ircurl:localhost';
my $db_user_name = 'tunnus';
my $db_password = 'salakala';

sub cmd_logurl {
my ($server, $data, $nick, $mask, $target) = @_;
$d = $data;
my $d = $data;
if (($d =~ /(.{1,2}tp\:\/\/.+)/) or ($d =~ /(www\..+)/)) {
db_insert($nick, $target, $1);
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/nact.pl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ ()
my @list;
my $ignore = 2;

open(FID, "/proc/net/dev");
open(FID, "<", "/proc/net/dev");

while (<FID>) {
if ($ignore > 0) {
Expand All @@ -130,7 +130,7 @@ ()
sub getBytesOBSD() {
my @list;

open(FID, "/usr/bin/netstat -nib|");
open(FID, "-|", "/usr/bin/netstat -nib");

while (<FID>) {
my $line = $_;
Expand All @@ -146,7 +146,7 @@ ()
my @list;
my $olddev="";

open(FID, "/usr/bin/netstat -nib|");
open(FID, "-|", "/usr/bin/netstat -nib");
while (<FID>) {
my $line = $_;
@list = split(" ", $line);
Expand Down
3 changes: 2 additions & 1 deletion scripts/nickban.pl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "1.1";
%IRSSI = (
authors => "Roeland 'Trancer' Nieuwenhuis",
Expand All @@ -7,7 +9,6 @@
license => "Public Domain"
);

use strict;
use Irssi;

# The channels the nicks are banned on (on which this script is active)
Expand Down
2 changes: 1 addition & 1 deletion scripts/nickcolor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sub load_colors {
}

sub save_colors {
open COLORS, ">$ENV{HOME}/.irssi/saved_colors";
open COLORS, ">", "$ENV{HOME}/.irssi/saved_colors";

foreach my $nick (keys %saved_colors) {
print COLORS "$nick:$saved_colors{$nick}\n";
Expand Down
20 changes: 10 additions & 10 deletions scripts/nickserv.pl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ sub load_nickservnet {

if (-e $file) {
local *F;
open(F, "<$file");
open(F, "<", $file);
local $/ = "\n";

while (<F>) {
Expand All @@ -134,7 +134,7 @@ sub save_nickservnet {

if (-e $file) {
local *F;
open(F, ">$file");
open(F, ">", $file);

for (my $n = 0; $n < @nickservnet; ++$n) {
print(F join("\t", $nickservnet[$n]->{name}, $nickservnet[$n]->{host}) . "\n");
Expand All @@ -151,7 +151,7 @@ sub create_network_file {

my ($file) = @_;

open(F, ">$file") or die "Can't create $file. Reason: $!";
open(F, ">", $file) or die "Can't create $file. Reason: $!";
}

sub new_nickserv_network {
Expand All @@ -172,7 +172,7 @@ sub load_nickservnick {

if (-e $file) {
local *F;
open(F, "<$file");
open(F, "<" ,$file);
local $/ = "\n";

while (<F>) {
Expand All @@ -196,7 +196,7 @@ sub save_nickservnick {

if (-e $file) {
local *F;
open(F, ">$file");
open(F, ">", $file);

for (my $n = 0; $n < @nickservauth; ++$n) {
print(F join("\t", $nickservauth[$n]->{ircnet}, $nickservauth[$n]->{nick}, $nickservauth[$n]->{pass}) . "\n");
Expand All @@ -214,7 +214,7 @@ sub create_nick_file {
my ($file) = @_;

my $umask = umask 0077; # save old umask
open(F, ">$file") or die "Can't create $file. Reason: $!";
open(F, ">", $file) or die "Can't create $file. Reason: $!";
umask $umask;
}

Expand All @@ -231,7 +231,7 @@ sub new_nickserv_nick {

sub add_nickname {

my ($network, $nickname, $password) = split(" ", @_[0], 3);
my ($network, $nickname, $password) = split(" ", $_[0], 3);
my ($correct_network, $correct_nickname, $correct_password);

if ($network eq "" || $nickname eq "" || $password eq "") {
Expand Down Expand Up @@ -267,7 +267,7 @@ sub add_nickname {

sub add_network {

my ($network, $hostname) = split(" ", @_[0], 2);
my ($network, $hostname) = split(" ", $_[0], 2);
my ($correct_net, $correct_host);

if ($network eq "" || $hostname eq "") {
Expand Down Expand Up @@ -471,7 +471,7 @@ sub get_password {

sub del_network {

my ($ircnet) = split(" ", @_[0], 1);
my ($ircnet) = split(" ", $_[0], 1);
my ($ircnetindex);

if ($ircnet eq "") {
Expand All @@ -498,7 +498,7 @@ sub del_network {

sub del_nickname {

my ($ircnet, $nickname) = split(" ", @_[0], 2);
my ($ircnet, $nickname) = split(" ", $_[0], 2);
my ($nickindex);

if ($ircnet eq "" || $nickname eq "") {
Expand Down
4 changes: 2 additions & 2 deletions scripts/nm.pl
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ ()

# load colors from file
sub load_colors() {
open(FID, "<".$ENV{HOME}."/.irssi/saved_colors") || return;
open(FID, "<", $ENV{HOME}."/.irssi/saved_colors") || return;

while (<FID>) {
chomp;
Expand All @@ -434,7 +434,7 @@ ()

# save colors to file
sub save_colors() {
open(FID, ">".$ENV{HOME}."/.irssi/saved_colors");
open(FID, ">", $ENV{HOME}."/.irssi/saved_colors");

print FID $_.":".$saved_colors{$_}."\n" foreach (keys(%saved_colors));

Expand Down
Loading

0 comments on commit dd80027

Please sign in to comment.