+#
+# set the user's home node
+#
+# Copyright (c) 1998 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+#
+# print out the general log file for announces only
+#
+# Copyright (c) 1998 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+my $self = shift;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+my $cmdline = shift;
+my @f = split /\s+/, $cmdline;
+my $f;
+my @out;
+my ($from, $to);
+
+$from = 0;
+while ($f = shift @f) { # next field
+ # print "f: $f list: ", join(',', @list), "\n";
+ if (!$from && !$to) {
+ ($from, $to) = $f =~ /^(\d+)-(\d+)$/o; # is it a from -> to count?
+ next if $from && $to > $from;
+ }
+ if (!$to) {
+ ($to) = $f =~ /^(\d+)$/o if !$to; # is it a to count?
+ next if $to;
+ }
+}
+
+$to = 20 if !$to;
+
+@out = DXLog::print($from, $to, $main::systime, '^ann');
+return (1, @out);
+#
+# print out the general log file
+#
+# Copyright (c) 1998 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+my $self = shift;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+my $cmdline = shift;
+my @f = split /\s+/, $cmdline;
+my $f;
+my @out;
+my ($from, $to);
+
+$from = 0;
+while ($f = shift @f) { # next field
+ # print "f: $f list: ", join(',', @list), "\n";
+ if (!$from && !$to) {
+ ($from, $to) = $f =~ /^(\d+)-(\d+)$/o; # is it a from -> to count?
+ next if $from && $to > $from;
+ }
+ if (!$to) {
+ ($to) = $f =~ /^(\d+)$/o if !$to; # is it a to count?
+ next if $to;
+ }
+}
+
+$to = 20 if !$to;
+
+@out = DXLog::print($from, $to, $main::systime);
+return (1, @out);
my $sort = $ref->sort;
my $qth = $ref->qth;
my $home = $ref->node;
- push @out, "$call $sort $home $qth";
+ push @out, "$call $sort $qth $node";
}
} else {
foreach $call (@f) {
- my $ref = DXUser::get_current($call);
+ my $ref = DXUser->get_current($call);
if ($ref) {
- my $name;
- my $qth;
- my $lat;
- my $long;
- my $node;
- my $homenode;
- push @out, "$call $qth";
+ my $name = $ref->name;
+ my $qth = $ref->qth;
+ my $lat = $ref->lat;
+ my $long = $ref->long;
+ my $node = $ref->node;
+# my $homenode = $ref->homenode;
+ push @out, "$call $qth $lat $long $node";
} else {
push @out, "$call not known";
}
+#
+# print out the general log file for talks only
+#
+# Copyright (c) 1998 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+my $self = shift;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+my $cmdline = shift;
+my @f = split /\s+/, $cmdline;
+my $f;
+my @out;
+my ($from, $to);
+
+$from = 0;
+while ($f = shift @f) { # next field
+ # print "f: $f list: ", join(',', @list), "\n";
+ if (!$from && !$to) {
+ ($from, $to) = $f =~ /^(\d+)-(\d+)$/o; # is it a from -> to count?
+ next if $from && $to > $from;
+ }
+ if (!$to) {
+ ($to) = $f =~ /^(\d+)$/o if !$to; # is it a to count?
+ next if $to;
+ }
+}
+
+$to = 20 if !$to;
+
+@out = DXLog::print($from, $to, $main::systime, '^talk');
+return (1, @out);
{
my $users = DXCommandmode::get_all();
my $uptime = main::uptime();
-
- return " $DXNode::nodes nodes, $users local / $DXNode::users total users Max users $DXNode::maxusers Uptime $uptime";
+ my $tot = $DXNode::users + 1;
+
+ return " $DXNode::nodes nodes, $users local / $tot total users Max users $DXNode::maxusers Uptime $uptime";
}
sub DESTROY
use DXDebug;
use DXM;
use DXLog;
+use DXLogPrint;
use CmdAlias;
use FileHandle;
use Carp;
my $user = $self->{user};
my $call = $self->{call};
my $name = $user->{name};
- my $info = DXCluster::cluster();
$self->{name} = $name ? $name : $call;
$self->send($self->msg('l2',$self->{name}));
$self->send_file($main::motd) if (-e $main::motd);
- $self->send("Cluster:$info");
- $self->send($self->msg('pr', $call));
$self->state('prompt'); # a bit of room for further expansion, passwords etc
$self->{priv} = $user->priv;
$self->{lang} = $user->lang;
my @pc16 = DXProt::pc16($nchan, $cuser);
DXProt::broadcast_ak1a(@pc16);
Log('DXCommand', "$call connected");
+
+ # send prompts and things
+ my $info = DXCluster::cluster();
+ $self->send("Cluster:$info");
+ $self->send($self->msg('pr', $call));
}
#
$log->writeunix($t, join('^', $t, @_) );
}
-sub DESTROY # catch undefs and do what is required further do the tree
+sub DESTROY # catch undefs and do what is required further down the tree
{
my $self = shift;
DXDebug::dbg("dxlog", "closing $self->{fn}\n");
--- /dev/null
+#
+# Log Printing routines
+#
+# Copyright (c) - 1998 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+package DXLog;
+
+use FileHandle;
+use DXVars;
+use DXDebug ();
+use DXUtil;
+use DXLog;
+use Julian;
+use Carp;
+
+use strict;
+
+#
+# print some items from the log backwards in time
+#
+# This command outputs a list of n lines starting from time t with $pattern tags
+#
+sub print
+{
+ my $self = $DXLog::log;
+ my $from = shift;
+ my $to = shift;
+ my @date = $self->unixtoj(shift);
+ my $pattern = shift;
+ my $search;
+ my @in;
+ my @out;
+ my $eval;
+ my $count;
+
+ $search = $pattern ? "\$ref->[1] =~ /$pattern/" : '1' ;
+ $eval = qq(
+ my \$c;
+ my \$ref;
+ for (\$c = \$#in; \$c >= 0; \$c--) {
+ \$ref = \$in[\$c];
+ if ($search) {
+ \$count++;
+ next if \$count < $from;
+ push \@out, print_item(\$ref);
+ last LOOP if \$count >= \$to; # stop after n
+ }
+ }
+ );
+
+ $self->close; # close any open files
+
+ my $fh = $self->open(@date);
+LOOP:
+ while ($count < $to) {
+ my @spots = ();
+ if ($fh) {
+ while (<$fh>) {
+ chomp;
+ push @in, [ split '\^' ];
+ }
+ eval $eval; # do the search on this file
+ return ("Spot search error", $@) if $@;
+ }
+ $fh = $self->openprev(); # get the next file
+ last if !$fh;
+ }
+
+ return @out;
+}
+
+#
+# the standard log printing interpreting routine.
+#
+# every line that is printed should call this routine to be actually visualised
+#
+# Don't really know whether this is the correct place to put this stuff, but where
+# else is correct?
+#
+# I get a reference to an array of items
+#
+sub print_item
+{
+ my $r = shift;
+ my @ref = @$r;
+ my $d = atime($ref[0]);
+ my $s = 'undef';
+
+ if ($ref[1] eq 'rcmd') {
+ if ($ref[2] eq 'in') {
+ $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
+ } else {
+ $s = "$ref[3] reply: $ref[4]";
+ }
+ } elsif ($ref[1] eq 'talk') {
+ $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
+ } elsif ($ref[1] eq 'ann') {
+ $s = "$ref[2] -> $ref[3] $ref[4]";
+ } else {
+ $s = "$ref[2]";
+ }
+ return "$d $s";
+}
+
+1;
use DXVars;
use DXDebug;
use DXLog;
+use DXLogPrint;
use DXUtil;
use DXChannel;
use DXUser;
my $data = $self->{data};
my $dxchan = $self->{dxchan};
- my ($sort, $call, $line) = $data =~ /^(\w)(\w+)\|(.*)$/;
+ my ($sort, $call, $line) = $data =~ /^(\w)(\S+)\|(.*)$/;
# do the really sexy console interface bit! (Who is going to do the TK interface then?)
dbg('chan', "<- $sort $call $line\n");
$self->{lastin} = 0;
$self->{dxok} = 1;
$self->{annok} = 1;
-
+ $self->{lang} = 'en';
+
# write it away
$self->close();