sub new
{
my $class = shift;
+ my $pkg = ref $class || $class;
my $thing = {@_};
$thing->{origin} ||= $main::mycall;
- bless $thing, $class;
+ bless $thing, $pkg;
return $thing;
}
# function must return true to make the send happen
$sub = "before_send_$class";
if ($thing->can($sub)) {
- return $thing->$sub($dxchan);
+ return unless $thing->$sub($dxchan);
}
# generate the protocol line which may (or not) be cached
dbg("Thingy::broadcast: " . $thing->ascii) if isdbg('thing');
my @dxchan;
- my $to ||= $thing->{touser};
+ my $to ||= $thing->{route};
+ $to ||= $thing->{touser};
$to ||= $thing->{group};
if ($to && is_callsign($to) && (my $ref = Route::get($to))) {
dbg("Thingy::broadcast: routing for $to") if isdbg('thing');
if ($thing->{group} eq $main::mycall) {
$out = $thing->new;
$out->{touser} = $thing->{user} if $thing->{user};
+ $out->{group} = $thing->{origin};
} elsif (DXChannel::get($thing->{group})) {
$out = $thing->new(user => $thing->{group});
$out->{touser} = $thing->{user} if $thing->{user};
+ $out->{group} = $thing->{origin};
} elsif ($thing->{touser} && DXChannel::get($thing->{touser})) {
$out = $thing->new(user => $thing->{touser});
$out->{group} = $thing->{group};