if ($no_timehires) { # fallback.
return time();
} else { # the real thing.
- return gettimeofday();
+ return [gettimeofday()];
}
}
return 1 unless ( -f $file);
if ($file =~ /idx/) {
my $age2 = time() - (stat($file))[9];
- &DEBUG("stale: $age2. (". &Time2String($age2) .")");
+ &VERB("stale: $age2. (". &Time2String($age2) .")",2);
}
$age *= 60*60*24 if ($age >= 0 and $age < 30);
# Usage: &makeHostMask($host);
sub makeHostMask {
- my ($host) = @_;
+ my ($host) = @_;
+ my $nu = "";
+
+ if ($host =~ s/^(\S+!\S+\@)//) {
+ &DEBUG("mHM: detected nick!user\@ for host arg; fixing");
+ $nu = $1;
+ }
if ($host =~ /^$mask{ip}$/) {
- return "$1.$2.$3.*";
+ return $nu."$1.$2.$3.*";
}
my @array = split(/\./, $host);
- return $host if (scalar @array <= 3);
- return "*.".join('.',@{array}[1..$#array]);
+ return $nu.$host if (scalar @array <= 3);
+ return $nu."*.".join('.',@{array}[1..$#array]);
}
# Usage: &makeRandom(int);
return crypt($str, $salt);
}
+sub closeStats {
+ return unless (&getChanConfList("ircTextCounters"));
+
+ foreach (keys %cmdstats) {
+ my $type = $_;
+ my $i = &dbGet("stats", "counter", "nick=".&dbQuote($type).
+ " AND type='cmdstats'");
+ $i += $cmdstats{$type};
+
+ &dbReplace("stats",
+ (nick => $type, type => "cmdstats", counter => $i)
+ );
+ }
+}
+
1;