summaryrefslogtreecommitdiffstats
path: root/scripts/lastspoke.pl
diff options
context:
space:
mode:
authorObfuscoder2014-10-17 22:54:13 +0200
committerObfuscoder2014-10-19 10:28:41 +0200
commitd84f1e1808b3252af83e4963eccfd1e4f19c5326 (patch)
tree18b64164a95e6ba73e50d4ce9938e9760ad8a217 /scripts/lastspoke.pl
parent263a56d196da657b72ccf2b195b50008d6a988dc (diff)
downloadscripts.irssi.org-d84f1e1808b3252af83e4963eccfd1e4f19c5326.tar.bz2
Fix perlcritic issues for all scripts starting with e to l
Diffstat (limited to 'scripts/lastspoke.pl')
-rw-r--r--scripts/lastspoke.pl12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/lastspoke.pl b/scripts/lastspoke.pl
index 6cabda7..063c4a9 100644
--- a/scripts/lastspoke.pl
+++ b/scripts/lastspoke.pl
@@ -20,8 +20,10 @@
#
# 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 = (
@@ -33,6 +35,8 @@ $VERSION = "0.2";
url => 'http://irssi.freshdot.net/',
);
+my $target;
+
# Storage for the data.
my %lasthash;
@@ -83,7 +87,7 @@ sub on_join {
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";
}
@@ -94,7 +98,7 @@ sub on_part {
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";
@@ -107,9 +111,9 @@ sub on_part {
# 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);