make buddies work better :-)
authorDirk Koopman <djk@tobit.co.uk>
Sat, 28 Jun 2008 14:27:16 +0000 (15:27 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 28 Jun 2008 14:27:16 +0000 (15:27 +0100)
also prettify show/sun.pl to help my understanding

Changes
cmd/show/sun.pl
perl/DXProtHandle.pm
perl/Version.pm

diff --git a/Changes b/Changes
index 7a4c91fd16cba44fefada2a219fce6e318989021..62e915f3092876f764a2531acef548a3953d6f5b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+28Jun08=======================================================================
+1. Made buddies work again on PC92.
 26Jun08=======================================================================
 1. added show/ik3qar command by Leo IZ5FSA. See comments in perl/Internet.pm
 for setup instructions (note that you will have to copy these lines to
index cf27423e48e1b5739689829728fdb7403808f2c1..eacd85d68c151089198084840b0234617c252ffc 100644 (file)
@@ -18,18 +18,18 @@ my $l;
 my $n_offset;
 my @list;
 
-while ($f = shift @f){
-        if(!$n_offset){
-                ($n_offset) = $f =~ /^([-+]?\d+)$/;
-                next if $n_offset;
-        }
-        push @list, $f;
+while ($f = shift @f) {
+       if (!$n_offset) {
+               ($n_offset) = $f =~ /^([-+]?\d+)$/;
+               next if $n_offset;
+       }
+       push @list, $f;
 }
 $n_offset = 0 unless defined $n_offset;
-$n_offset = 0 if $n_offset > 365;  # can request moon rise/set up to 1 year ago or from now...
+$n_offset = 0 if $n_offset > 365; # can request moon rise/set up to 1 year ago or from now...
 $n_offset = 0 if $n_offset < -365;
 
-my ($lat, $lon);              # lats and longs in radians
+my ($lat, $lon);                               # lats and longs in radians
 my ($sec, $min, $hr, $day, $month, $yr) = (gmtime($main::systime+$n_offset*24*60*60))[0,1,2,3,4,5];
 
 $month++;
@@ -63,21 +63,21 @@ if (@list) {
        }
 }
 
-if( !$n_offset ) {
-        push @out, $self->msg('sun_with_azel');
+if ( !$n_offset ) {
+       push @out, $self->msg('sun_with_azel');
 } else {
-        push @out, $self->msg('sun');
+       push @out, $self->msg('sun');
 }
 
 foreach $l (@in) {
        my ($dawn, $rise, $set, $dusk, $az, $dec )=Sun::rise_set($yr,$month,$day,$hr,$min,$l->[1],$l->[2],0);
                
-        $l->[3] =~ s{(-\d+|/\w+)$}{};
-        if( !$n_offset ) {
+       $l->[3] =~ s{(-\d+|/\w+)$}{};
+       if ( !$n_offset ) {
         push @out,sprintf("%-6.6s %-30.30s %02d/%02d/%4d %s %s %6.1f %6.1f", $l->[3], $l->[0], $day, $month, $yr, $rise, $set, $az, $dec);
-        } else {
+       } else {
         push @out,sprintf("%-6.6s %-30.30s %02d/%02d/%4d %s %s", $l->[3], $l->[0], $day, $month, $yr, $rise, $set);
-        }
+       }
 }
 
 
index 2fa4095fa381c0a1b9ddb94829405a7cd6fd9173..c5f6cc81b2a7edcf0043b94e37ac2665d5dbceae 100644 (file)
@@ -1406,6 +1406,7 @@ sub _add_thingy
                } else {
                        dbg("ROUTE: added user $call to " . $parent->call) if isdbg('routelow');
                        @rout = $parent->add_user($call, Route::here($here));
+                       $dxchan->tell_buddies('loginb', $call, $parent->call) if $dxchan;
                }
                if ($pc92_slug_changes && $parent == $main::routeroot) {
                        $things_add{$call} = Route::get($call);
@@ -1419,6 +1420,7 @@ sub _del_thingy
 {
        my $parent = shift;
        my $s = shift;
+       my $dxchan = shift;
        my ($call, $is_node, $is_extnode, $here, $version, $build) = @$s;
        my @rout;
        if ($call) {
@@ -1428,9 +1430,12 @@ sub _del_thingy
                        dbg("ROUTE: deleting node $call from " . $parent->call) if isdbg('routelow');
                        @rout = $ref->del($parent) if $ref;
                } else {
-                       $ref = Route::User::get($call);
                        dbg("ROUTE: deleting user $call from " . $parent->call) if isdbg('routelow');
-                       @rout = $parent->del_user($ref) if $ref;
+                       $ref = Route::User::get($call);
+                       if ($ref) {
+                               $dxchan->tell_buddies('logoutb', $call, $parent->call) if $dxchan;
+                               @rout = $parent->del_user($ref);
+                       }
                }
                if ($pc92_slug_changes && $parent == $main::routeroot) {
                        $things_del{$call} = $ref unless exists $things_add{$call};
@@ -1773,7 +1778,7 @@ sub handle_92
                        }
                } elsif ($sort eq 'D') {
                        for (@nent) {
-                               push @rdel, _del_thingy($parent, $_);
+                               push @rdel, _del_thingy($parent, $_, $self);
                        }
                } elsif ($sort eq 'C') {
                        my (@nodes, @users);
@@ -1807,10 +1812,10 @@ sub handle_92
                        }
                        # del users here
                        foreach my $r (@$dnodes) {
-                               push @rdel,_del_thingy($parent, [$r, 1]);
+                               push @rdel,_del_thingy($parent, [$r, 1], $self);
                        }
                        foreach my $r (@$dusers) {
-                               push @rdel,_del_thingy($parent, [$r, 0]);
+                               push @rdel,_del_thingy($parent, [$r, 0], $self);
                        }
 
                        # remember this last PC92C for rebroadcast on demand
index e77d9957ad56f518a6e49b6d5ee420d9fe98114a..b2641bf4eb17e85df540a8990b56cc23ab6dbf5d 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.55';
 $subversion = '0';
-$build = '25';
+$build = '26';
 
 1;