1. Add $main::bumpexisting variable which allows a new connection for a user
authorminima <minima>
Wed, 12 Jan 2005 12:33:48 +0000 (12:33 +0000)
committerminima <minima>
Wed, 12 Jan 2005 12:33:48 +0000 (12:33 +0000)
call to disconnect an existing connection with the same call. The default for
this variable is 'true' (1). This means that existing behaviour has changed.
set/var $main::bumpexisting = 0 to return to original behaviour.
2. Remind a user every hour (as default) that they have new messages.
set/var $DXCommandmode::msgpolltime = 3*3600 to set it to 3 hours.
3. Allow some substitutions in set/prompt (call, date, time and
cluster call) and add dxspider just before the > as standard.
4. Add $main::allowdxby variable so that sysops can switch off the
'DX BY <othercall' command. It is set to 0 (ie disabled) by default. This
is for sysops who don't want to bump privilege to allow it. That still works
as before.
5. Fix the bug in 'dx by <call>' that causes only the first word of the
comment to be recorded.

Changes
cmd/Commands_en.hlp
cmd/dx.pl
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/Messages
perl/cluster.pl
techdoc/protocol.pod

diff --git a/Changes b/Changes
index 952c28143c34f709e14edc2479985d41fdf9be43..60e4b0a5c3f063035114e6619a8a5ce2791cff80 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,18 @@
+12Jan05=======================================================================
+1. Add $main::bumpexisting variable which allows a new connection for a user
+call to disconnect an existing connection with the same call. The default for
+this variable is 'true' (1). This means that existing behaviour has changed.
+set/var $main::bumpexisting = 0 to return to original behaviour.
+2. Remind a user every hour (as default) that they have new messages.
+set/var $DXCommandmode::msgpolltime = 3*3600 to set it to 3 hours.
+3. Allow some substitutions in set/prompt (call, date, time and
+cluster call) and add dxspider just before the > as standard. 
+4. Add $main::allowdxby variable so that sysops can switch off the 
+'DX BY <othercall' command. It is set to 0 (ie disabled) by default. This
+is for sysops who don't want to bump privilege to allow it. That still works
+as before.
+5. Fix the bug in 'dx by <call>' that causes only the first word of the 
+comment to be recorded.
 27Dec04=======================================================================
 1. add improved VE data from Charlie K1XX. You should update usdb as well.
 22Dec04=======================================================================
index cf0f981603e5205f4f5ab38d798f2ea78e041f68..eaa862ef50483d01cdd7fd7de4dc55b2b995b5e4 100644 (file)
@@ -1703,14 +1703,25 @@ password for a user.
 
 === 0^SET/PROMPT <string>^Set your prompt to <string>
 === 0^UNSET/PROMPT^Set your prompt back to default
-This command will set your user prompt to exactly the string that you 
+This command will set your user prompt to the string that you 
 say. The point of this command to enable a user to interface to programs
 that are looking for a specific prompt (or else you just want a different
-fixed prompt).
+prompt).
 
   SET/PROMPT clx >
 
-UNSET/PROMPT will undo the SET/PROMPT command and set you prompt back to
+There are some substitutions that can be added to the prompt:
+
+  %C - callsign [which will have ( and ) around it if not here]
+  %D - date
+  %T - time
+  %M - cluster 'mycall'
+
+The standard prompt is defined as:
+
+  SET/PROMPT %C de %M %D %T dxspider >
+
+UNSET/PROMPT will undo the SET/PROMPT command and set your prompt back to
 normal.
 
 === 5^SET/SPIDER <call> [<call>..]^Make the callsign an DXSpider node
index ce0c304fe87705be7194f66d46a2f1ee1e95f112..b0be3bd83038c781f454acb5db9b54ff82d1e372 100644 (file)
--- a/cmd/dx.pl
+++ b/cmd/dx.pl
@@ -34,11 +34,11 @@ return (1, $self->msg('dx2')) unless @f >= 2;
 # can be in any order
 
 if ($f[0] =~ /^by$/i) {
-       return (1, $self->msg('e5')) unless $self->priv;
+       return (1, $self->msg('e5')) unless $main::allowdxby || $self->priv;
     $spotter = uc $f[1];
-    $line =~ s/^\s*\Q$f[0]\s+\Q$f[1]\s+//;
-       $line = $f[2];
-       @f = split /\s+/, $line;
+    $line =~ s/\s*$f[0]\s+$f[1]\s+//;
+#      $line = $f[2];
+       @f = split /\s+/, $line, 3;
        return (1, $self->msg('dx2')) unless @f >= 2;
 }
 
index 1994846b20894092ffd6f81a56c25057fe5f6169..0f25a5dd3c90cadada415e94caffa0e93c0a68ff 100644 (file)
@@ -115,6 +115,7 @@ $count = 0;
                  verified => '9,Verified?,yesno',
                  newroute => '1,New Style Routing,yesno',
                  ve7cc => '0,VE7CC program special,yesno',
+                 lastmsgpoll => '0,Last Msg Poll,atime',
                 );
 
 use vars qw($VERSION $BRANCH);
index e49498574415692f7543d95cf89e5c6050db791d..1004544255610b92df8beea126e2ec90f4caa37d 100644 (file)
@@ -37,7 +37,7 @@ use DB_File;
 use VE7CC;
 
 use strict;
-use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount);
+use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount $msgpolltime);
 
 %Cache = ();                                   # cache of dynamically loaded routine's mod times
 %cmd_cache = ();                               # cache of short names
@@ -46,6 +46,7 @@ $errstr = ();                                 # error string from eval
 $scriptbase = "$main::root/scripts"; # the place where all users start scripts go
 $maxerrors = 20;                               # the maximum number of concurrent errors allowed before disconnection
 $maxbadcount = 3;                              # no of bad words allowed before disconnection
+$msgpolltime = 3600;                   # the time between polls for new messages 
 
 
 use vars qw($VERSION $BRANCH);
@@ -182,6 +183,7 @@ sub start
        $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
        $self->send($self->msg('hnodee1')) if !$user->qth;
        $self->send($self->msg('m9')) if DXMsg::for_me($call);
+       $self->lastmsgpoll($main::systime);
        $self->prompt;
 }
 
@@ -492,6 +494,12 @@ sub process
        
        foreach $dxchan (@dxchan) {
                next if $dxchan->sort ne 'U';  
+       
+               # send a outstanding message prompt if required
+               if ($t >= $dxchan->lastmsgpoll + $msgpolltime) {
+                       $dxchan->send($dxchan->msg('m9')) if DXMsg::for_me($dxchan->call);
+                       $dxchan->lastmsgpoll($t);
+               }
                
                # send a prompt if no activity out on this channel
                if ($t >= $dxchan->t + $main::user_interval) {
@@ -549,11 +557,18 @@ sub disconnect
 sub prompt
 {
        my $self = shift;
-       if ($self->{prompt}) {
-               $self->send($self->{prompt});
-       } else {
-               $self->send($self->msg($self->here ? 'pr' : 'pr2', $self->call, cldate($main::systime), ztime($main::systime)));
-       }
+       my $call = $self->call;
+       my $date = cldate($main::systime);
+       my $time = ztime($main::systime);
+       my $prompt = $self->{prompt} || $self->msg('pr');
+
+       $call = "($call)" unless $self->here;
+       $prompt =~ s/\%C/$call/g;
+       $prompt =~ s/\%D/$date/g;
+       $prompt =~ s/\%T/$time/g;
+       $prompt =~ s/\%M/$main::mycall/g;
+       
+       $self->send($prompt);
 }
 
 # broadcast a message to all users [except those mentioned after buffer]
index e7356ba2381420bdcd308100b62ca961161fc8a2..a79debbc93581c33195eda81fcd6eb96df9c127e 100644 (file)
@@ -32,6 +32,7 @@ package DXM;
                                conscript => 'no connect script called \"$_[0]\" found in $main::root/connect',
                                confail => 'connection to $_[0] failed ($_[1])',
                                constart => 'connection to $_[0] started',
+                               conbump => 'Reconnected as $_[0] at $_[1], this instance is disconnected',
                                deluser => 'User $_[0] has been deleted',
                                db1 => 'This database is hosted at $_[0]',
                                db2 => 'Sorry, but key: $_[0] was not found in $_[1]',
@@ -227,9 +228,7 @@ package DXM;
                                pinge1 => 'Cannot ping yourself!',
                                pingint => 'Ping interval on $_[0] set to $_[1] secs',
                                'pos' => 'From Callsign: $_[0] Lat: $_[1] Long: $_[2]',
-                               pr => '$_[0] de $main::mycall $_[1] $_[2] >',
-                               pr2 => '($_[0]) de $main::mycall $_[1] $_[2] >',
-                               prs => 'Prompt now set to \"$_[0]\"',
+                               pr => '%C de %M %D %T dxspider >',
                                pru => 'Prompt now set back to default',
                                priv => 'Privilege level changed on $_[0]',
                                prx => '$main::mycall >',
index a2664b7730f3f64676fcce922d3461b66fddc0e5..20726684de2c7bbbd8f77d583dbe654a41e6d470 100755 (executable)
@@ -115,7 +115,8 @@ package main;
 use strict;
 use vars qw(@inqueue $systime $version $starttime $lockfn @outstanding_connects 
                        $zombies $root @listeners $lang $myalias @debug $userfn $clusteraddr 
-                       $clusterport $mycall $decease $is_win $routeroot $me $reqreg
+                       $clusterport $mycall $decease $is_win $routeroot $me $reqreg $bumpexisting
+                       $allowdxby
                   );
 
 @inqueue = ();                                 # the main input queue, an array of hashes
@@ -125,6 +126,9 @@ $starttime = 0;                 # the starting time of the cluster
 #@outstanding_connects = ();     # list of outstanding connects
 @listeners = ();                               # list of listeners
 $reqreg = 0;                                   # 1 = registration required, 2 = deregister people
+$bumpexisting = 1;                             # 1 = allow new connection to disconnect old, 0 - don't allow it
+$allowdxby = 0;                                        # 1 = allow "dx by <othercall>", 0 - don't allow it
+
 
 use vars qw($VERSION $BRANCH $build $branch);
 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
@@ -170,9 +174,20 @@ sub new_channel
        my $user = DXUser->get_current($call);
        my $dxchan = DXChannel->get($call);
        if ($dxchan) {
-               my $mess = DXM::msg($lang, ($user && $user->is_node) ? 'concluster' : 'conother', $call, $main::mycall);
-               already_conn($conn, $call, $mess);
-               return;
+               if ($user && $user->is_node) {
+                       already_conn($conn, $call, DXM::msg($lang, 'concluster', $call, $main::mycall));
+                       return;
+               }
+               if ($bumpexisting) {
+                       my $ip = $conn->{peerhost} || 'unknown';
+                       $dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
+                       Log('DXCommand', "$call bumped off by $ip, disconnected");
+                       dbg("$call bumped off by $ip, disconnected");
+                       $dxchan->disconnect;
+               } else {
+                       already_conn($conn, $call, DXM::msg($lang, 'conother', $call, $main::mycall));
+                       return;
+               }
        }
 
        # is he locked out ?
index 1e1f2436995dc0e3f03acbc8f8f8206f7f90dfba..d6b4a7ee475cdc0891f15f4092bd7b285dc7452c 100644 (file)
@@ -129,7 +129,7 @@ L</Node> to which this L</User> is connected.
 
 =head2 Endpoint
 
-An L</Endpoint> is a connection to a L<Node> that uses the protocol. From a routing point of
+An L</Endpoint> is a connection to a L</Node> that uses the protocol. From a routing point of
 view, it is indistiguishable from a L</Node>. The L</Endpoint> is responsible for creating and decoding
 well formed protocol messages. An L</Endpoint> does not route beyond the immediate L</Node>(s) to
 which it is connected. It may also be a L</Service> connected to a L</Node> which provides some