added who command
[spider.git] / cmd / who.pl
diff --git a/cmd/who.pl b/cmd/who.pl
new file mode 100644 (file)
index 0000000..34e2d0a
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# who : is online
+# a complete list of stations connected
+#
+# Copyright (c) 1999 Dirk Koopman G1TLH
+#
+# $Id$
+
+
+my $self = shift;
+my $dxchan;
+my @out;
+
+push @out, "  Callsign Type Started           Name";
+
+foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) {
+    my $call = $dxchan->call();
+       my $t = cldatetime($dxchan->user->lastin);
+       my $sort = $dxchan->is_ak1a() ? "NODE" : "USER";
+       my $name = $dxchan->user->name;
+       push @out, sprintf "%10s $sort $t $name", $call;
+}
+
+return (1, @out)