added registration
[spider.git] / cmd / wx.pl
1 #
2 # do an wx message, this is identical to the announce except that it does WX
3 # instead
4 #
5 # handles wx
6 #         wx full
7 #         wx sysop
8 #
9 # at the moment these keywords are fixed, but I dare say a file containing valid ones
10 # will appear
11 #
12 # Copyright (c) 1998 Dirk Koopman G1TLH
13 #
14 # $Id$
15 #
16
17 my ($self, $line) = @_;
18 my @f = split /\s+/, $line;
19 my $sort = uc $f[0];
20 my @locals = DXCommandmode->get_all();
21 my $to;
22 my $from = $self->call;
23 my $t = ztime(time);
24 my $tonode;
25 my $sysopflag;
26 return (1, $self->msg('e5')) if $self->remotecmd;
27 return (1, $self->msg('e28')) unless $self->registered;
28
29 if ($sort eq "FULL") {
30   $line =~ s/^$f[0]\s+//;    # remove it
31   $to = "ALL";
32 } elsif ($sort eq "SYSOP") {
33   $line =~ s/^$f[0]\s+//;     # remove it
34   @locals = map { $_->priv >= 5 ? $_ : () } @locals;
35   $to = "SYSOP";
36   $sysopflag = '*';
37 } else {
38   $to = "LOCAL";
39 }
40
41 DXChannel::broadcast_list("WX de $from <$t>: $line", 'wx', undef, @locals);
42 if ($to ne "LOCAL") {
43   $line =~ s/\^//og;    # remove ^ characters!
44   my $pc = DXProt::pc12($from, $line, $tonode, $sysopflag, 1);
45   DXChannel::broadcast_nodes($pc, $main::me);
46 }
47
48 return (1, ());