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/mlock.pl | |
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/mlock.pl')
-rw-r--r-- | scripts/mlock.pl | 26 |
1 files changed, 15 insertions, 11 deletions
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 '+') { |