# sort out privilege reduction
$self->{priv} = 0 unless $self->{hostname} eq '127.0.0.1' || $self->conn->peerhost eq '127.0.0.1' || $self->{hostname} eq '::1' || $self->conn->{usedpasswd};
- # get the filters
- my $nossid = $call;
- $nossid =~ s/-\d+$//;
- $self->{spotsfilter} = Filter::read_in('spots', $call, 0)
- || Filter::read_in('spots', $nossid, 0)
- || Filter::read_in('spots', 'user_default', 0);
- $self->{wwvfilter} = Filter::read_in('wwv', $call, 0)
- || Filter::read_in('wwv', $nossid, 0)
- || Filter::read_in('wwv', 'user_default', 0);
- $self->{wcyfilter} = Filter::read_in('wcy', $call, 0)
- || Filter::read_in('wcy', $nossid, 0)
- || Filter::read_in('wcy', 'user_default', 0);
- $self->{annfilter} = Filter::read_in('ann', $call, 0)
- || Filter::read_in('ann', $nossid, 0)
- || Filter::read_in('ann', 'user_default', 0) ;
- $self->{rbnfilter} = Filter::read_in('rbn', $call, 0)
- || Filter::read_in('rbn', $nossid, 0)
- || Filter::read_in('rbn', 'user_default', 0);
+ Filter::load_dxchan($self, 'spots', 0);
+ Filter::load_dxchan($self, 'wwv', 0);
+ Filter::load_dxchan($self, 'wcy', 0);
+ Filter::load_dxchan($self, 'ann', 0);
+ Filter::load_dxchan($self, 'rbn', 0);
# clean up qra locators
my $qra = $user->qra;
for (@{$self->{talklist}}) {
if ($self->{state} eq 'talk') {
$self->send_talks($_, $self->msg('talkend'));
+ } elsif ($self->{state} eq 'chat') {
+ $self->send_talks($_, $self->msg('chatend'));
} else {
$self->local_send('C', $self->msg('chatend', $_));
}
delete $self->{talklist};
} elsif ($cmdline =~ m|^[/\w\\]+|) {
$cmdline =~ s|^/||;
- my $sendit = $cmdline =~ s|^/+||;
+ my $sendit = ($cmdline = unpad($cmdline));
if (@bad = BadWords::check($cmdline)) {
$self->badcount(($self->badcount||0) + @bad);
LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with badwords: '" . join(',', @bad) . "'");
} else {
- my @cmd = split /\s*\\n\s*/, $cmdline;
- foreach my $l (@cmd) {
- my @in = $self->run_cmd($l);
+ my $c;
+ my @in;
+ if (($c) = $cmdline =~ /^cmd\s+(.*)$/) {
+ @in = $self->run_cmd($c);
$self->send_ans(@in);
+ } else {
+ push @in, $cmdline;
if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
foreach my $l (@in) {
for (@{$self->{talklist}}) {
$self->prompt() if $self->{state} =~ /^prompt/o;
}
-# send out the talk messages taking into account vias and connectivity
-sub send_talks
-{
- my ($self, $ent, $line) = @_;
-
- my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
- $to = $ent unless $to;
- my $call = $via && $via ne '*' ? $via : $to;
- my $clref = Route::get($call);
- my $dxchan = $clref->dxchan if $clref;
- if ($dxchan) {
- $dxchan->talk($self->{call}, $to, undef, $line);
- } else {
- $self->send($self->msg('disc2', $via ? $via : $to));
- my @l = grep { $_ ne $ent } @{$self->{talklist}};
- if (@l) {
- $self->{talklist} = \@l;
- } else {
- delete $self->{talklist};
- $self->state('prompt');
- }
- }
-}
-
-sub send_chats
-{
- my $self = shift;
- my $target = shift;
- my $text = shift;
-
- my $msgid = DXProt::nextchatmsgid();
- $text = "#$msgid $text";
- my $ipaddr = alias_localhost($self->hostname || '127.0.0.1');
- $main::me->normal(DXProt::pc93($target, $self->{call}, undef, $text, undef, $ipaddr));
-}
sub special_prompt
{
}
}
-# send a talk message here
-sub talk
-{
- my ($self, $from, $to, $via, $line, $onode) = @_;
- $line =~ s/\\5E/\^/g;
- if ($self->{talk}) {
- if ($self->{gtk}) {
- $self->local_send('T', dd(['talk',$to,$from,$via,$line]));
- } else {
- $self->local_send('T', "$to de $from: $line");
- }
- }
- Log('talk', $to, $from, '<' . ($onode || '*'), $line);
- # send a 'not here' message if required
- unless ($self->{here} && $from ne $to) {
- my $key = "$to$from";
- unless (exists $nothereslug{$key}) {
- my ($ref, $dxchan);
- if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
- my $name = $self->user->name || $to;
- my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
- $nothereslug{$key} = $main::systime;
- $dxchan->talk($to, $from, undef, $s);
- }
- }
- }
-}
# send an announce
sub announce
$self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
}
+# send a talk message here
+sub talk
+{
+ my ($self, $from, $to, $via, $line, $onode) = @_;
+ $line =~ s/^\#\d+ //;
+ $line =~ s/\\5E/\^/g;
+ if ($self->{talk}) {
+ if ($self->{gtk}) {
+ $self->local_send('T', dd(['talk',$to,$from,$via,$line]));
+ } else {
+ $self->local_send('T', "$to de $from: $line");
+ }
+ }
+ Log('talk', $to, $from, '<' . ($onode || '*'), $line);
+}
+
# send a chat
sub chat
{
$self->local_send('C', $buf);
}
+# send out the talk messages taking into account vias and connectivity
+sub send_talks
+{
+ my ($self, $target, $text) = @_;
+
+ my $msgid = DXProt::nextchatmsgid();
+ $text = "#$msgid $text";
+ my $ipaddr = alias_localhost($self->hostname || '127.0.0.1');
+ $main::me->normal(DXProt::pc93($target, $self->{call}, undef, $text, undef, $ipaddr));
+
+}
+
+sub send_chats
+{
+ my $self = shift;
+ my $target = shift;
+ my $text = shift;
+
+ my $msgid = DXProt::nextchatmsgid();
+ $text = "#$msgid $text";
+ my $ipaddr = alias_localhost($self->hostname || '127.0.0.1');
+ $main::me->normal(DXProt::pc93($target, $self->{call}, undef, $text, undef, $ipaddr));
+}
+
+
sub format_dx_spot
{
my $self = shift;