2 # DX database control routines
4 # This manages the on-line cluster user 'database'
6 # This should all be pretty trees and things, but for now I
7 # just can't be bothered. If it becomes an issue I shall
10 # Copyright (c) 1998 - Dirk Koopman G1TLH
20 %cluster = (); # this is where we store the dxcluster database
24 my ($pkg, $call, $confmode, $here, $dxprot) = @_;
25 die "$call is already alloced" if $cluster{$call};
27 $self->{call} = $call;
28 $self->{confmode} = $confmode;
29 $self->{here} = $here;
30 $self->{dxprot} = $dxprot;
32 $cluster{$call} = bless $self, $pkg;
36 # search for a call in the cluster
39 my ($pkg, $call) = @_;
40 return $cluster{$call};
46 return values(%cluster);
52 delete $cluster{$self->{call}};
56 mynode => '0,Parent Node',
58 confmode => '5,Conference Mode,yesno',
59 here => '5,Here?,yesno',
60 dxprot => '5,Channel ref',
61 version => '5,Node Version',
64 # return a prompt for a field
67 my ($self, $ele) = @_;
76 return if $name =~ /::DESTROY$/;
79 die "Non-existant field '$AUTOLOAD'" if !$valid{$name};
80 @_ ? $self->{$name} = shift : $self->{$name} ;
84 # USER special routines
95 my ($pkg, $mynode, $call, $confmode, $here, $dxprot) = @_;
96 my $self = $pkg->alloc($call, $confmode, $here, $dxprot);
97 $self->{mynode} = $mynode;
99 $users{$call} = $self;
106 $self->delcluster(); # out of the whole cluster table
107 delete $users{$self->{call}}; # out of the users table
112 return %users + 1; # + 1 for ME (naf eh!)
116 # NODE special routines
121 @ISA = qw(DXCluster);
127 my ($pkg, $call, $confmode, $here, $version, $dxprot) = @_;
128 my $self = $pkg->alloc($call, $confmode, $here, $dxprot);
129 $self->{version} = $version;
130 $nodes{$call} = $self;
137 my ($pkg, $call) = @_;
138 return $nodes{$call};
146 foreach $list (values(%nodes)) {
147 push @out, $list if $list->{version};
155 my $call = $self->call;
157 DXUser->delete($call); # delete all the users one this node
158 delete $nodes{$call};
163 return %nodes + 1; # + 1 for ME!