2 # Route Thingy handling
6 # Copyright (c) 2005 Dirk Koopman G1TLH
13 use vars qw($VERSION $BRANCH);
15 main::mkver($VERSION = q$Revision$);
21 use Thingy::RouteFilter;
25 @ISA = qw(Thingy Thingy::RouteFilter);
30 unless ($thing->{Aranea}) {
32 if ($ref = $thing->{anodes}) {
33 $thing->{n} = join(':', map {$_->{call}} @$ref);
35 if ($ref = $thing->{ausers}) {
36 $thing->{u} = join(':', map {$_->{call}} @$ref);
38 $thing->{Aranea} = Aranea::genmsg($thing, [qw(s n u)]);
40 return $thing->{Aranea};
56 my $sub = "handle_$thing->{s}";
57 if ($thing->can($sub)) {
59 $thing = $thing->$sub($dxchan);
62 $thing->broadcast($dxchan) if $thing;
73 $node->add_user($user, $flag);
74 my $ur = upd_user_rec($user, $node);
81 my $parentcall = shift;
83 # add this station to the user database, if required
84 $call =~ s/-\d+$//o; # remove ssid for users
85 my $user = DXUser->get_current($call);
86 $user = DXUser->new($call) if !$user;
87 $user->homenode($parentcall) if !$user->homenode;
88 $user->node($parentcall);
89 $user->lastin($main::systime) unless DXChannel::get($call);
94 # Generate a configuration for onward broadcast
96 # Basically, this creates a thingy with list of nodes and users that
97 # are on this node. This the normal method of spreading this
98 # info whenever a node connects and also periodically.
104 my $thing = $pkg->SUPER::new(@_);
106 $thing->{'s'} = 'lcf';
111 foreach my $dxchan (DXChannel::get_all()) {
112 if ($dxchan->is_node || $dxchan->is_aranea) {
113 my $ref = Route::Node::get($dxchan->{call});
114 push @nodes, $ref if $ref;
116 my $ref = Route::User::get($dxchan->{call});
117 push @users, $ref if $ref;
120 $thing->{anodes} = \@nodes if @nodes;
121 $thing->{ausers} = \@users if @users;