From: minima <minima>
Date: Sun, 15 Apr 2001 16:55:44 +0000 (+0000)
Subject: add show/connect
X-Git-Tag: R_1_47~29
X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=70928ea2832755c4bcd8f4d04fc0acc3861a4496;p=spider.git

add show/connect
---

diff --git a/Changes b/Changes
index 81a2098b..c6d49fa6 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
 15Apr01=======================================================================
 1. made some mods to the sgml documentation for 1.47
+2. added show/connect command
 11Apr01=======================================================================
 1. fixed more of the "xxx disappeared from yyy" messages
 2. altered the build no logic so that it always checksums the same files
diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp
index 877180e6..af5bcbd9 100644
--- a/cmd/Commands_en.hlp
+++ b/cmd/Commands_en.hlp
@@ -1194,6 +1194,21 @@ for more information.
 Display all the bad spotter's callsigns in the system, see SET/BADSPOTTER
 for more information.
 
+=== 0^SHOW/CONFIGURATION [<node>]^Show all the nodes and users visible
+This command allows you to see all the users that can be seen
+and the nodes to which they are connected.
+
+This command is normally abbreviated to: sh/c
+
+BE WARNED: the list that is returned can be VERY long
+
+=== 0^SHOW/CONFIGURATION/NODE^Show all the nodes connected locally
+Show all the nodes connected to this node.
+
+=== 1^SHOW/CONNECT^Show all the active connections
+This command shows information on all the active connections known to
+the node. This command gives slightly more information than WHO.
+
 === 0^SHOW/DATE [<prefix>|<callsign>]^Show the local time 
 This is very nearly the same as SHOW/TIME, the only difference the format
 of the date string if no arguments are given.
diff --git a/cmd/show/connect.pl b/cmd/show/connect.pl
new file mode 100644
index 00000000..70811376
--- /dev/null
+++ b/cmd/show/connect.pl
@@ -0,0 +1,32 @@
+#
+# show active connections
+#
+# Copyright (c) 2001 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my $self = shift;
+return (1, $self->msg('e5')) if $self->priv < 1;
+my @out;
+my $count;
+
+push @out, "Cnum Call      Address/Port              State  Type   Dir.";
+
+foreach my $call (sort keys %Msg::conns) {
+	my $r = $Msg::conns{$call};
+	my $addr = "$r->{peerhost}/$r->{peerport}";
+	my $c = $call;
+	if ($c =~ /^Server\s+(\S+)$/) {
+		$addr = $1;
+		$c = "Server";
+	}
+	push @out, 	sprintf(" %3d %-9s %-27.27s %3s %7s %8s", 
+						$r->{cnum}, $c, 
+						$addr, $r->{state}, 
+						$r->{csort}, $r->{sort});
+
+	$count++;
+}
+push @out, "$count Connections";
+return (1, @out);