+ my $thing = shift;
+ my $dxchan = shift;
+ my $class;
+ if (@_) {
+ $class = shift;
+ } elsif ($dxchan->isa('DXChannel')) {
+ $class = ref $dxchan;
+ }
+
+ # do output filtering
+ if ($thing->can('out_filter')) {
+ return unless $thing->out_filter($dxchan);
+ }
+
+ # generate the line which may (or not) be cached
+ my @out;
+ if (my $ref = $thing->{class}) {
+ push @out, ref $ref ? @$ref : $ref;
+ } else {
+ no strict 'refs';
+ my $sub = "gen_$class";
+ push @out, $thing->$sub($dxchan) if $thing->can($sub);
+ }
+ $dxchan->send(@out) if @out;
+}
+
+# broadcast to all except @_
+sub broadcast
+{
+ my $thing = shift;
+ dbg("Thingy::broadcast: " . $thing->ascii) if isdbg('thing');
+
+ foreach my $dxchan (DXChannel::get_all()) {
+ next if $dxchan == $main::me;
+ next if grep $dxchan == $_, @_;
+ $thing->send($dxchan);
+ }