tidy the Local.pm changes
authorDirk Koopman <djk@tobit.co.uk>
Mon, 19 Nov 2007 13:05:56 +0000 (13:05 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Mon, 19 Nov 2007 13:05:56 +0000 (13:05 +0000)
use the correct perl-fu to determine whether a function is
defined or not.

Changes
perl/DXProt.pm
perl/DXProtHandle.pm
perl/Local.pm
perl/Version.pm
perl/cluster.pl

diff --git a/Changes b/Changes
index ee7a52ae3086db1fb6dab4d16cb637f23c54f3b4..f19c7b95785c941e1a9541e62d175122eabcae4f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+19Nov07=======================================================================
+1. change MRTG graphs to be based on GMT, not localtime. This allows one to
+more easily compare debug data with traffic graphs.
 17Nov07=======================================================================
 1. Add Local::ann() as requested by Felipe PY1NB.
 16Nov07=======================================================================
index 8b415974ed55cef98fd1062cc448576b8ca02a5e..eafb591dac4d64a5d3da6db501a150b116130794 100644 (file)
@@ -420,6 +420,12 @@ sub normal
                }
        }
 
+       if (defined &Local::pcprot) {
+               my $r;
+               eval { $r = Local::pcprot($self, $pcno, $line, @field); };
+               return if $r;                   # i.e don't process it
+       }
+
        # send it out for processing
        my $origin = $self->{call};
        no strict 'subs';
index c15f4939c551577f1ea4e34e19f824202265c8ab..f28de6d065cbae54941df6703de4e9ed55a26248 100644 (file)
@@ -273,7 +273,7 @@ sub handle_11
        }
 
        # local processing
-       if (defined *Local::spot) {
+       if (defined &Local::spot) {
                my $r;
                eval {
                        $r = Local::spot($self, @spot);
@@ -360,7 +360,7 @@ sub handle_12
        }
 
        # local processing
-       if (defined *Local::ann) {
+       if (defined &Local::ann) {
                my $r;
                eval {
                        $r = Local::ann($self, $line, @_[1..6]);
@@ -947,7 +947,7 @@ sub handle_23
        # note this only takes the first one it gets
        Geomag::update($d, $_[2], $sfi, $k, $i, @_[6..8], $r);
 
-       if (defined *Local::wwv) {
+       if (defined &Local::wwv) {
                my $rep;
                eval {
                        $rep = Local::wwv($self, $_[1], $_[2], $sfi, $k, $i, @_[6..8], $r);
@@ -1318,7 +1318,7 @@ sub handle_73
 
        my $wcy = WCY::update($d, @_[2..12]);
 
-       if (defined *Local::wcy) {
+       if (defined &Local::wcy) {
                my $rep;
                eval {
                        $rep = Local::wcy($self, @_[1..12]);
index 9421f784f3a83f182611702e7a8ec61b79eda022..3645b4deff187b53ccc62977ea994d7088c03d9a 100644 (file)
@@ -23,157 +23,157 @@ use strict;
 use vars qw{ };
 
 # called at initialisation time
-sub init
-{
-
-}
+#sub init
+#{
+#
+#}
 
 # called once every second
-sub process
-{
-
-}
+#sub process
+#{
+#
+#}
 
 # called just before the ending of the program
-sub finish
-{
-
-}
+#sub finish
+#{
+#
+#}
 
 # called after an incoming PC line has been split up, return 0 if you want to
 # continue and 1 if you wish the PC Protocol line to be ignored completely
 #
 # Parameters:-
-# $self      - the DXChannel object 
+# $self      - the DXChannel object
 # $pcno      - the no of the PC field
+# $line      - the actual incoming line with its hop count already decremented
 # @field     - the spot exactly as is, split up into fields
-#              $field[0] will be PC11 or PC26 
-sub pcprot
-{
-       return 0;            # remove this line if you want the switch
+#              $field[0] will be PC11 or PC26
+#sub pcprot
+#{
+
+#      my ($self, $pcno, $line, @field) = @_;
 
-       my ($self, $pcno, @field) = @_;
-       
        # take out any switches that aren't interesting to you.
- SWITCH: {
-               if ($pcno == 10) {              # incoming talk
-                       last SWITCH;
-               }
-               
-               if ($pcno == 11 || $pcno == 26) { # dx spot
-                       last SWITCH;
-               }
-               
-               if ($pcno == 12) {              # announces
-                       last SWITCH;
-               }
-               
-               if ($pcno == 13) {
-                       last SWITCH;
-               }
-               if ($pcno == 14) {
-                       last SWITCH;
-               }
-               if ($pcno == 15) {
-                       last SWITCH;
-               }
-               
-               if ($pcno == 16) {              # add a user
-                       last SWITCH;
-               }
-               
-               if ($pcno == 17) {              # remove a user
-                       last SWITCH;
-               }
-               
-               if ($pcno == 18) {              # link request
-                       last SWITCH;
-               }
-               
-               if ($pcno == 19) {              # incoming cluster list
-                       last SWITCH;
-               }
-               
-               if ($pcno == 20) {              # send local configuration
-                       last SWITCH;
-               }
-               
-               if ($pcno == 21) {              # delete a cluster from the list
-                       last SWITCH;
-               }
-               
-               if ($pcno == 22) {
-                       last SWITCH;
-               }
-               
-               if ($pcno == 23 || $pcno == 27) { # WWV info
-                       last SWITCH;
-               }
-               
-               if ($pcno == 24) {              # set here status
-                       last SWITCH;
-               }
-               
-               if ($pcno == 25) {      # merge request
-                       last SWITCH;
-               }
-               
-               if (($pcno >= 28 && $pcno <= 33) || $pcno == 40 || $pcno == 42 || $pcno == 49) { # mail/file handling
-                       last SWITCH;
-               }
-               
-               if ($pcno == 34 || $pcno == 36) { # remote commands (incoming)
-                       last SWITCH;
-               }
-               
-               if ($pcno == 35) {              # remote command replies
-                       last SWITCH;
-               }
-               
-               if ($pcno == 37) {
-                       last SWITCH;
-               }
-               
-               if ($pcno == 38) {              # node connected list from neighbour
-                       last SWITCH;
-               }
-               
-               if ($pcno == 39) {              # incoming disconnect
-                       last SWITCH;
-               }
-               
-               if ($pcno == 41) {              # user info
-                       last SWITCH;
-               }
-               if ($pcno == 43) {
-                       last SWITCH;
-               }
-               if ($pcno == 44) {
-                       last SWITCH;
-               }
-               if ($pcno == 45) {
-                       last SWITCH;
-               }
-               if ($pcno == 46) {
-                       last SWITCH;
-               }
-               if ($pcno == 47) {
-                       last SWITCH;
-               }
-               if ($pcno == 48) {
-                       last SWITCH;
-               }
-               
-               if ($pcno == 50) {              # keep alive/user list
-                       last SWITCH;
-               }
-               
-               if ($pcno == 51) {              # incoming ping requests/answers
-                       last SWITCH;
-               }
-       }
-       return 0;
-}
+# SWITCH: {
+#              if ($pcno == 10) {              # incoming talk
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 11 || $pcno == 26) { # dx spot
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 12) {              # announces
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 13) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 14) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 15) {
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 16) {              # add a user
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 17) {              # remove a user
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 18) {              # link request
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 19) {              # incoming cluster list
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 20) {              # send local configuration
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 21) {              # delete a cluster from the list
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 22) {
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 23 || $pcno == 27) { # WWV info
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 24) {              # set here status
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 25) {      # merge request
+#                      last SWITCH;
+#              }
+
+#              if (($pcno >= 28 && $pcno <= 33) || $pcno == 40 || $pcno == 42 || $pcno == 49) { # mail/file handling
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 34 || $pcno == 36) { # remote commands (incoming)
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 35) {              # remote command replies
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 37) {
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 38) {              # node connected list from neighbour
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 39) {              # incoming disconnect
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 41) {              # user info
+#                      last SWITCH;
+#              }
+#              if ($pcno == 43) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 44) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 45) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 46) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 47) {
+#                      last SWITCH;
+#              }
+#              if ($pcno == 48) {
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 50) {              # keep alive/user list
+#                      last SWITCH;
+#              }
+
+#              if ($pcno == 51) {              # incoming ping requests/answers
+#                      last SWITCH;
+#              }
+#      }
+#      return 0;
+#}
 
 # called after the spot has been stored but before it is broadcast,
 # you can do funky routing here that is non-standard. 0 carries on
@@ -181,18 +181,18 @@ sub pcprot
 # that YOU have done some routing or other instead
 #
 # Parameters:-
-# $self      - the DXChannel object 
+# $self      - the DXChannel object
 # $freq      - frequency
 # $spotted   - the spotted callsign
 # $d         - the date in unix time format
 # $text      - the text of the spot
 # $spotter   - who spotted it
 # $orignode  - the originating node
-# 
-sub spot
-{
-       return 0;
-}
+#
+#sub spot
+#{
+#      return 0;
+#}
 
 # called after the announce has been stored but before it is broadcast,
 # you can do funky routing here that is non-standard. 0 carries on
@@ -208,10 +208,10 @@ sub spot
 # $flag      - ' ' - normal announce, * - SYSOP, else CHAT group
 # $origin    - originating node
 # $wx        - 0 - normal, 1 - WX
-sub ann
-{
-       return 0;
-}
+#sub ann
+#{
+#      return 0;
+#}
 
 
 # called after the wwv has been stored but before it is broadcast,
@@ -220,33 +220,33 @@ sub ann
 # that YOU have done some routing or other instead
 #
 # Parameters:-
-# $self      - the DXChannel object 
-# The rest the same as for Geomag::update 
-sub wwv
-{
-       return 0;
-}
+# $self      - the DXChannel object
+# The rest the same as for Geomag::update
+#sub wwv
+#{
+#      return 0;
+#}
 
 # same for wcy broadcasts
-sub wcy
-{
-       return 0;
-}
+#sub wcy
+#{
+#      return 0;
+#}
 
 # no idea what or when these are called yet
-sub userstart
-{
-       return 0;
-}
-
-sub userline
-{
-       return 0;
-}
-
-sub userfinish
-{
-       return 0;
-}
+#sub userstart
+#{
+#      return 0;
+#}
+
+#sub userline
+#{
+#      return 0;
+#}
+
+#sub userfinish
+#{
+#      return 0;
+#}
 1;
 __END__
index 7f1c0f1c3a18b1b76fb72a00ecf8aca66eecc608..4d7bf1c56420502902f2a3bac4c7d8f07f083244 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '190';
+$build = '191';
 
 1;
index d3c905340ee7cf7d2875712c0bd467695b9739ec..620c7e77c90a7500a5a8ee5b6d7904cd6ab090ef 100755 (executable)
@@ -240,10 +240,12 @@ sub cease
 
        DXUser::sync;
 
-       eval {
-               Local::finish();   # end local processing
-       };
-       dbg("Local::finish error $@") if $@;
+       if (defined &Local::finish) {
+               eval {
+                       Local::finish();   # end local processing
+               };
+               dbg("Local::finish error $@") if $@;
+       }
 
        # disconnect nodes
        foreach $dxchan (DXChannel::get_all_nodes) {
@@ -491,10 +493,13 @@ DXDb::load();
 # starting local stuff
 dbg("doing local initialisation ...");
 QSL::init(1);
-eval {
-       Local::init();
-};
-dbg("Local::init error $@") if $@;
+if (defined &Local::init) {
+       eval {
+               Local::init();
+       };
+       dbg("Local::init error $@") if $@;
+}
+
 
 # this, such as it is, is the main loop!
 dbg("orft we jolly well go ...");
@@ -534,10 +539,12 @@ for (;;) {
                DXDupe::process();
                AGWMsg::process();
 
-               eval {
-                       Local::process();       # do any localised processing
-               };
-               dbg("Local::process error $@") if $@;
+               if (defined &Local::process) {
+                       eval {
+                               Local::process();       # do any localised processing
+                       };
+                       dbg("Local::process error $@") if $@;
+               }
        }
        if ($decease) {
                last if --$decease <= 0;