fix sh/muf
[spider.git] / perl / DXCommandmode.pm
index 3a94fb6a2629c82cb282ea6de174a2868c809ca7..ea99e3d147e277e9af8c4d9b3b8fd4b2dcc04687 100644 (file)
@@ -9,10 +9,11 @@
 
 package DXCommandmode;
 
-use POSIX;
+#use POSIX;
 
 @ISA = qw(DXChannel);
 
+use POSIX qw(:math_h);
 use DXUtil;
 use DXChannel;
 use DXUser;
@@ -150,10 +151,21 @@ sub start
        $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
 
        # get the filters
-       $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
-       $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
-       $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
-       $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
+       my $nossid = $call;
+       $nossid =~ s/-\d+$//;
+       
+       $self->{spotsfilter} = Filter::read_in('spots', $call, 0) 
+               || Filter::read_in('spots', $nossid, 0)
+                       || Filter::read_in('spots', 'user_default', 0);
+       $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) 
+               || Filter::read_in('wwv', $nossid, 0) 
+                       || Filter::read_in('wwv', 'user_default', 0);
+       $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) 
+               || Filter::read_in('wcy', $nossid, 0) 
+                       || Filter::read_in('wcy', 'user_default', 0);
+       $self->{annfilter} = Filter::read_in('ann', $call, 0) 
+               || Filter::read_in('ann', $nossid, 0) 
+                       || Filter::read_in('ann', 'user_default', 0) ;
 
        # clean up qra locators
        my $qra = $user->qra;
@@ -191,12 +203,24 @@ sub start
        my $info = Route::cluster();
        $self->send("Cluster:$info");
 
-       # send prompts and things
+       # send prompts for qth, name and things
        $self->send($self->msg('namee1')) if !$user->name;
        $self->send($self->msg('qthe1')) if !$user->qth;
        $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);
+
+       # send out any buddy messages for other people that are online
+       foreach my $call (@{$user->buddies}) {
+               my $ref = Route::User::get($call);
+               if ($ref) {
+                       foreach my $node (@{$ref->parent}) {
+                               my $s = $node eq $main::mycall ? $call : "$node: $call";
+                               $self->send($self->msg('loginb', $s));
+                       } 
+               }
+       }
+
        $self->lastmsgpoll($main::systime);
        $self->prompt;
 }
@@ -563,7 +587,7 @@ sub disconnect
                
        # send info to all logged in thingies
        $self->tell_login('logoutu');
-       $self->tell_login('logoutb');
+       $self->tell_buddies('logoutb');
 
        LogDbg('DXCommand', "$call disconnected");