summaryrefslogtreecommitdiff
path: root/lib/lastlog.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lastlog.pm')
-rw-r--r--lib/lastlog.pm29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/lastlog.pm b/lib/lastlog.pm
new file mode 100644
index 0000000..94ffd99
--- /dev/null
+++ b/lib/lastlog.pm
@@ -0,0 +1,29 @@
+sub lastlog
+ {
+ my ($whoami) = @_;
+ my $lastlog_data = get_lastlog();
+ my $lastlog_text = "";
+
+ for (my $i = 0; $i < @$lastlog_data; $i++)
+ {
+ my $lastlog = $lastlog_data->[$i];
+
+ last if ($LASTLOG_ONLY_FIRST_DAY && (time - $lastlog->{lastseen}) > 86400);
+
+ $lastlog_text .= ", " if ($i > 0);
+ $lastlog_text .= message_link($lastlog->{username});
+
+ if ((time - $lastlog->{lastseen}) > 4)
+ {
+ $lastlog_text .= " [".(get_age($lastlog->{lastseen}))."]";
+ # $lastlog_text .= " $lastlog->{last_hostname}" if ($DEBUG); # ...previously kept track of host
+ }
+ }
+
+ return "$whoami->{username} [<b>now</b>]" unless (length($lastlog_text));
+
+ return $lastlog_text;
+ }
+
+1;
+