+# broadcast a message to all users [except those mentioned after buffer]
+sub broadcast
+{
+ my $pkg = shift; # ignored
+ my $s = shift; # the line to be rebroadcast
+ my @except = @_; # to all channels EXCEPT these (dxchannel refs)
+ my @list = DXChannel->get_all(); # just in case we are called from some funny object
+ my ($chan, $except);
+
+L: foreach $chan (@list) {
+ next if !$chan->sort eq 'U'; # only interested in user channels
+ foreach $except (@except) {
+ next L if $except == $chan; # ignore channels in the 'except' list
+ }
+ chan->send($s); # send it
+ }
+}
+
+# gimme all the users
+sub get_all
+{
+ my @list = DXChannel->get_all();
+ my $ref;
+ my @out;
+ foreach $ref (@list) {
+ push @out, $ref if $ref->sort eq 'U';
+ }
+ return @out;
+}
+