]> dxcluster.net Git - spider.git/commitdiff
fix allow 2/more commands on a line
authorDirk Koopman <djk@tobit.co.uk>
Tue, 7 Mar 2023 23:06:26 +0000 (23:06 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 7 Mar 2023 23:06:26 +0000 (23:06 +0000)
See Changes for details
Also send debug before loading caches, so you know what you are
waiting for.

Changes
perl/AnnTalk.pm
perl/DXCommandmode.pm
perl/Geomag.pm
perl/WCY.pm
perl/cluster.pl

diff --git a/Changes b/Changes
index fdfdb9a63d114e966cf2ded85b4ffbddd3c399fd..9a4307e4dcab4121d6249780725796ccdb05e9c3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,14 @@
 07Mar23=======================================================================
 1. Fix odd (and old) regression dx command (line ending 59+++) '++' being the 
    culprit.
+2. Allow multiple commands on one line when separated with the 2 character 
+   string '\n' (sigh). 
+3. Move a few init things about on startup so that more parameters are 
+   scriptable. 
+4. Put some debug comments before loading various caches (that might take a
+   longgggg time) and then tell people how long each cache load took. This
+   should reduce the worry that something is "wrong" when there is a delay
+   (such as searching for announces). 
 06Mar23=======================================================================
 1. Fix filter error reporting, including incrementing concurrent error count 
    if there are actually any detected parse errors.
index 8c702e4edffc214a3dac6f311454690e31418f35..71bd272f2736dc6e28642035f92a86311607260c 100644 (file)
@@ -16,6 +16,7 @@ use DXDebug;
 use DXDupe;
 use DXLog;
 use DXLogPrint;
+use Time::HiRes qw(gettimeofday tv_interval);
 
 use vars qw(%dup $duplth $dupage $filterdef);
 
@@ -45,10 +46,12 @@ our @anncache;
 
 sub init
 {
+       my $t0 = [gettimeofday];
+       dbg("AnnTalk: loading up to $maxcache announcements into cache");
        @anncache = DXLog::search(0, $maxcache, $main::systime, 'ann');
        shift @anncache while @anncache > $maxcache;
        my $l = @anncache;
-       dbg("AnnTalk: loaded last $l announcements into cache");
+       dbg("AnnTalk: loaded last $l announcements into cache in " . _diffms($t0) . "mS");
 }
 
 sub add_anncache
index d1feb3e18eb2e6dea892108a3eb15d2a8977d81f..dfaaa3e34887454ffe047c14b9a397fb70aa27e3 100644 (file)
@@ -349,22 +349,26 @@ sub normal
                        }
                        $self->state('prompt');
                        delete $self->{talklist};
-               } elsif ($cmdline =~ m|^/+\w+|) {
+               } elsif ($cmdline =~ m|^[/\w\\]+|) {
                        $cmdline =~ s|^/||;
                        my $sendit = $cmdline =~ s|^/+||;
                        if (@bad = BadWords::check($cmdline)) {
                                $self->badcount(($self->badcount||0) + @bad);
                                LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with badwords: '" . join(',', @bad) . "'");
                        } else {
-                               my @in = $self->run_cmd($cmdline);
-                               $self->send_ans(@in);
-                               if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
-                                       foreach my $l (@in) {
-                                               for (@{$self->{talklist}}) {
-                                                       if ($self->{state} eq 'talk') {
-                                                               $self->send_talks($_, $l);
-                                                       } else {
-                                                               send_chats($self, $_, $l)
+                               my @cmd = split /\s*\\n\s*/, $cmdline;
+                               foreach my $l (@cmd) {
+                                       my @in = $self->run_cmd($l);
+                                       $self->send_ans(@in);
+                                       if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
+                                               foreach my $l (@in) {
+                                                       for (@{$self->{talklist}}) {
+                                                               if ($self->{state} eq 'talk') {
+                                                                       $self->send_talks($_, $l);
+                                                               }
+                                                               else {
+                                                                       send_chats($self, $_, $l)
+                                                               }
                                                        }
                                                }
                                        }
@@ -410,8 +414,11 @@ sub normal
 #              if (@bad = BadWords::check($cmdline)) {
 #                      $self->badcount(($self->badcount||0) + @bad);
 #                      LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with badwords: '" . join(',', @bad) . "'");
-#              } else {
-                       $self->send_ans(run_cmd($self, $cmdline));
+               #               } else {
+               my @cmd = split /\s*\\n\s*/, $cmdline;
+               foreach my $l (@cmd) {
+                       $self->send_ans(run_cmd($self, $l));
+               }
 #              }
        } 
 
index 9b4421d821cb10c4b2db24277536d28eba6ec1db..f8a1ec720c0d820f9c82ee1e3eee9635098b57e2 100644 (file)
@@ -17,6 +17,7 @@ use Julian;
 use IO::File;
 use DXDebug;
 use DXDupe;
+use Time::HiRes qw(gettimeofday tv_interval);
 
 use strict;
 
@@ -63,9 +64,11 @@ sub init
        $fp = DXLog::new('wwv', 'dat', 'm');
        do "$param" if -e "$param";
        # read in existing data
+       my $t0 = [gettimeofday];
+       dbg(sprintf "WWV read in upto %d records into cache", $maxcache);       
        @cache = readfile($main::systime);
        shift @cache while @cache > $maxcache;  
-       dbg(sprintf "WWV read in last %d records into cache", scalar @cache);   
+       dbg(sprintf "WWV read in last %d records into cache in %dmS", scalar @cache, _diffms($t0));     
        confess $@ if $@;
 }
 
index 534d89d76ca9b2ce3ecf7dbaafe551d70e5501b2..ef536ddb2fa8681c986766f67537f84d1cc7fefb 100644 (file)
@@ -16,6 +16,7 @@ use Julian;
 use IO::File;
 use DXDebug;
 use Data::Dumper;
+use Time::HiRes qw(gettimeofday tv_interval);
 
 use strict;
 
@@ -64,9 +65,10 @@ sub init
        $fp = DXLog::new('wcy', 'dat', 'm');
        do "$param" if -e "$param";
        # read in existing data
+       my $t0 = [gettimeofday];
        @cache = readfile($main::systime);
        shift @cache while @cache > $maxcache;
-       dbg(sprintf "WCY read in last %d records into cache", scalar @cache);   
+       dbg(sprintf "WCY read in last %d records into cache %dmS", scalar @cache, _diffms($t0));        
        confess $@ if $@;
 }
 
index b6c38166b6dba898a1a513f730b015b4850f9673..93e769ba4e788a2d4ccf0dcac3d0e592b2f7fb94 100755 (executable)
@@ -633,9 +633,6 @@ sub setup_start
 
        Filter::init();                         # doesn't do much, but has to be done
 
-       AnnTalk::init();                        # initialise announce cache
-       
-       
 
        # look for the sysop and the alias user and complain if they aren't there
        {
@@ -727,12 +724,6 @@ sub setup_start
        dbg("Read in Aliases");
        CmdAlias->init();
 
-       # initialise the Geomagnetic data engine
-       dbg("Start WWV");
-       Geomag->init();
-       dbg("Start WCY");
-       WCY->init();
-
        # initialise the protocol engine
        dbg("Start Protocol Engines ...");
        DXProt->init();
@@ -741,6 +732,15 @@ sub setup_start
        my $script = new Script "startup";
        $script->run($main::me) if $script;
 
+
+       # initialise the Geomagnetic data engine
+       dbg("Start WWV");
+       Geomag->init();
+       dbg("Start WCY");
+       WCY->init();
+       AnnTalk::init();                        # initialise announce cache
+   
+
        # put in a DXCluster node for us here so we can add users and take them away
        $routeroot = Route::Node->new($mycall, $version*100+5300, Route::here($main::me->here)|Route::conf($main::me->conf));
        $routeroot->do_pc9x(1);