if (scalar @new) {
&msg($who, "+==== New news for $chan (".scalar(@new)."):");
# todo: show how many sec/min/etc ago?
- my $timestr = &Time2String( $::newsuser{$chan}{$who} );
+ my $timestr = &Time2String( time() - $::newsuser{$chan}{$who} );
&msg($who, "|= Last time read $timestr ago");
foreach (@new) {
&msg($who, sprintf("\002[\002%2d\002]\002 %s (%s)",
$i, $_, &Time2String($age) ) );
}
+ &msg($who, "to read, do 'news read <#>' or 'news read <keyword>'");
# lame hack to prevent dupes if we just ignore it.
$::newsuser{$chan}{$who} = time();
my $time = shift;
my $retval;
- return("0s")
- if (!defined $time or $time !~ /\d+/ or $time <= 0);
+ return("NULL s") if (!defined $time or $time !~ /\d+/);
+
+ my $prefix = "";
+ if ($time < 0) {
+ $time = - $time;
+ $prefix = "- ";
+ }
my $s = int($time) % 60;
my $m = int($time / 60) % 60;
$retval .= sprintf(" \002%d\002m", $m) if ($m != 0);
$retval .= sprintf(" \002%d\002s", $s) if ($s != 0);
- return substr($retval, 1);
+ return $prefix.substr($retval, 1);
}
###