diff options
author | Timo Sirainen <cras@irssi.org> | 2001-07-16 20:22:45 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-07-16 20:22:45 +0000 |
commit | 69a6096b8b4e0b94e3ba327801a120be2d446636 (patch) | |
tree | dd31da39c6a23514d8ade048fdef3426bfa4096f /scripts | |
parent | 0d3b5c729f16a0c8c2d7ccbc04854de2e8b5b45a (diff) | |
download | irssi-69a6096b8b4e0b94e3ba327801a120be2d446636.zip |
added "use strict" for all scripts, made some small changes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1639 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/autoop.pl | 14 | ||||
-rw-r--r-- | scripts/autorejoin.pl | 5 | ||||
-rw-r--r-- | scripts/clones.pl | 4 | ||||
-rw-r--r-- | scripts/hello.pl | 2 | ||||
-rw-r--r-- | scripts/mlock.pl | 26 | ||||
-rw-r--r-- | scripts/privmsg.pl | 3 | ||||
-rw-r--r-- | scripts/quitmsg.pl | 11 | ||||
-rw-r--r-- | scripts/realname.pl | 3 |
8 files changed, 37 insertions, 31 deletions
diff --git a/scripts/autoop.pl b/scripts/autoop.pl index 7891bce9..413f5e17 100644 --- a/scripts/autoop.pl +++ b/scripts/autoop.pl @@ -1,8 +1,9 @@ # /AUTOOP <*|#channel> [<nickmasks>] use Irssi; +use strict; -my %opnicks, %temp_opped; +my (%opnicks, %temp_opped); sub cmd_autoop { my ($data) = @_; @@ -12,7 +13,7 @@ sub cmd_autoop { if (!%opnicks) { Irssi::print("Usage: /AUTOOP <*|#channel> [<nickmasks>]"); Irssi::print("No-one's being auto-opped currently."); - return 1; + return; } Irssi::print("Currently auto-opping in channels:"); @@ -25,7 +26,7 @@ sub cmd_autoop { Irssi::print("$channel: $masks"); } } - return 1; + return; } if ($masks eq "") { @@ -39,17 +40,16 @@ sub cmd_autoop { } else { Irssi::print("$channel: Now auto-opping: $masks"); } - return 1; } sub autoop { my ($channel, $masks, @nicks) = @_; - my $server, $nickrec; + my ($server, $nickrec); $server = $channel->{server}; foreach $nickrec (@nicks) { - $nick = $nickrec->{nick}; - $host = $nickrec->{host}; + my $nick = $nickrec->{nick}; + my $host = $nickrec->{host}; if (!$temp_opped{$nick} && $server->masks_match($masks, $nick, $host)) { diff --git a/scripts/autorejoin.pl b/scripts/autorejoin.pl index 75bac90d..bbbb0ed8 100644 --- a/scripts/autorejoin.pl +++ b/scripts/autorejoin.pl @@ -6,6 +6,7 @@ use Irssi; use Irssi::Irc; +use strict; sub event_rejoin_kick { my ($server, $data) = @_; @@ -14,8 +15,8 @@ sub event_rejoin_kick { return if ($server->{nick} ne $nick); # check if channel has password - $chanrec = $server->channel_find($channel); - $password = $chanrec->{key} if ($chanrec); + my $chanrec = $server->channel_find($channel); + my $password = $chanrec->{key} if ($chanrec); # We have to use send_raw() because the channel record still # exists and irssi won't even try to join to it with command() diff --git a/scripts/clones.pl b/scripts/clones.pl index 27b5a1b1..a469a575 100644 --- a/scripts/clones.pl +++ b/scripts/clones.pl @@ -1,10 +1,11 @@ # /CLONES - display real name of nick use Irssi; +use strict; sub cmd_clones { my ($data, $server, $channel) = @_; - my %hostnames, $host, @nicks, $nick; + my (%hostnames, $host, @nicks, $nick); @nicks = $channel->nicks(); @@ -19,7 +20,6 @@ sub cmd_clones { $channel->print("$host: $clones"); } } - return 1; } Irssi::command_bind('clones', 'cmd_clones'); diff --git a/scripts/hello.pl b/scripts/hello.pl index b5b92aa8..82adfe22 100644 --- a/scripts/hello.pl +++ b/scripts/hello.pl @@ -1,12 +1,12 @@ # "Hello, world!" script :) /hello <nick> sends "Hello, world!" to <nick> use Irssi; +use strict; sub cmd_hello { my ($data, $server, $channel) = @_; $server->command("/msg $data Hello, world!"); - return 1; } Irssi::command_bind('hello', 'cmd_hello'); diff --git a/scripts/mlock.pl b/scripts/mlock.pl index 415bf93e..35ad7856 100644 --- a/scripts/mlock.pl +++ b/scripts/mlock.pl @@ -7,6 +7,9 @@ use Irssi; use Irssi::Irc; +use strict; + +my %keep_channels; sub cmd_mlock { my ($data, $server) = @_; @@ -14,25 +17,26 @@ sub cmd_mlock { $keep_channels{$channel} = $mode; mlock_check_mode($server, $channel); - return 1; } sub mlock_check_mode { my ($server, $channame) = @_; - $channel = $server->channel_find($channame); - return if (!channel || !$channel->{chanop}); + my $channel = $server->channel_find($channame); + return if (!$channel || !$channel->{chanop}); - $keep_mode = $keep_channels{$channame}; + my $keep_mode = $keep_channels{$channame}; return if (!$keep_mode); # old channel mode + my ($oldmode, $oldkey, $oldlimit); $oldmode = $channel->{mode}; $oldmode =~ s/^([^ ]*).*/\1/; $oldkey = $channel->{key}; $oldlimit = $channel->{limit}; # get the new channel key/limit + my (@newmodes, $newkey, $limit); @newmodes = split(/ /, $keep_mode); $keep_mode = $newmodes[0]; if ($keep_mode =~ /k/) { if ($keep_mode =~ /k.*l/) { @@ -49,15 +53,15 @@ sub mlock_check_mode { } # check the differences - undef %allmodes; + my %allmodes; $keep_mode =~ s/^\+//; - for ($n = 0; $n < length($keep_mode); $n++) { - $modechar = substr($keep_mode, $n, 1); + for (my $n = 0; $n < length($keep_mode); $n++) { + my $modechar = substr($keep_mode, $n, 1); $allmodes{$modechar} = '+'; } - for ($n = 0; $n < length($oldmode); $n++) { - $modechar = substr($oldmode, $n, 1); + for (my $n = 0; $n < length($oldmode); $n++) { + my $modechar = substr($oldmode, $n, 1); if ($allmodes{$modechar} eq '+') { next if (($modechar eq "k" && $newkey ne $oldkey) || @@ -69,8 +73,8 @@ sub mlock_check_mode { } # create the mode change string - $modecmd = ""; $extracmd = ""; - foreach $mode (keys %allmodes) { + my ($modecmd, $extracmd); + foreach my $mode (keys %allmodes) { Irssi::print("key = '$mode':".$allmodes{$mode}); if ($mode eq "k") { if ($allmodes{$mode} eq '+') { diff --git a/scripts/privmsg.pl b/scripts/privmsg.pl index c667220c..b1d119cb 100644 --- a/scripts/privmsg.pl +++ b/scripts/privmsg.pl @@ -1,6 +1,7 @@ # listen PRIVMSGs - send a notice to yourself when your nick is meantioned use Irssi; +use strict; sub event_privmsg { my ($server, $data, $nick, $address) = @_; @@ -8,7 +9,7 @@ sub event_privmsg { return if (!$server->ischannel($target)); - $mynick = $server->{nick}; + my $mynick = $server->{nick}; return if ($text !~ /\b$mynick\b/); $server->command("/notice $mynick In channel $target, $nick!$address said: $text"); diff --git a/scripts/quitmsg.pl b/scripts/quitmsg.pl index cc4b1d3a..17bf9444 100644 --- a/scripts/quitmsg.pl +++ b/scripts/quitmsg.pl @@ -2,17 +2,19 @@ use Irssi; use Irssi::Irc; +use strict; -$quitfile = "$ENV{HOME}/.irssi/irssi.quit"; +my $quitfile = glob "~/.irssi/irssi.quit"; sub cmd_quit { my ($data, $server, $channel) = @_; open (f, $quitfile) || return; - $lines = 0; while(<f>) { $lines++; }; + my $lines = 0; while(<f>) { $lines++; }; - $line = int(rand($lines))+1; + my $line = int(rand($lines))+1; + my $quitmsg; seek(f, 0, 0); $. = 0; while(<f>) { next if ($. != $line); @@ -23,8 +25,7 @@ sub cmd_quit { } close(f); - @servers = Irssi::servers; - foreach $server (@servers) { + foreach my $server (Irssi::servers) { $server->command("/disconnect ".$server->{tag}." $quitmsg"); } } diff --git a/scripts/realname.pl b/scripts/realname.pl index e3db5b6b..ccb1c6b1 100644 --- a/scripts/realname.pl +++ b/scripts/realname.pl @@ -2,6 +2,7 @@ use Irssi; use Irssi::Irc; +use strict; sub cmd_realname { my ($data, $server, $channel) = @_; @@ -20,7 +21,6 @@ sub cmd_realname { "event 313", "event empty", 1, "event 317", "event empty", 1, "event 319", "event empty", 1); - return 1; } sub event_rn_whois { @@ -28,7 +28,6 @@ sub event_rn_whois { $realname =~ s/^://; Irssi::print("%_$nick%_ is $realname"); - return 1; } Irssi::command_bind('rn', 'cmd_realname'); |