]> dxcluster.org Git - spider.git/commitdiff
add set/believe code
authorminima <minima>
Wed, 23 Jun 2004 19:38:40 +0000 (19:38 +0000)
committerminima <minima>
Wed, 23 Jun 2004 19:38:40 +0000 (19:38 +0000)
cmd/set/believe.pl [new file with mode: 0644]
cmd/unset/believe.pl [new file with mode: 0644]
perl/DXUser.pm
perl/Messages

diff --git a/cmd/set/believe.pl b/cmd/set/believe.pl
new file mode 100644 (file)
index 0000000..aa31b36
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Add a believable node - used to filter nodes as being believable
+#
+# Copyright (c) 2004 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $call;
+my $node = shift @args;
+my @out;
+my @nodes;
+
+return (1, $self->msg('e5')) if $self->priv < 6;
+return (1, $self->msg('e22', $node)) unless is_callsign($node);
+my $user = DXUser->get_current($node);
+return (1, $self->msg('e13', $node)) unless $user->is_node;
+
+foreach $call (@args) {
+       return (1, $self->msg('e22', $node)) unless is_callsign($call);
+
+       my $u = DXUser->get_current($call);
+       if ($u->is_node) {
+                       push @nodes, $call;
+       } else {
+                       push @out, $self->msg('e13', $call);
+       }
+}
+
+foreach $call (@nodes) {
+       $user->set_believe($call);
+       push @out, $self->msg('believes', $call, $node);
+}
+$user->put if @nodes;
+               
+return (1, @out);
diff --git a/cmd/unset/believe.pl b/cmd/unset/believe.pl
new file mode 100644 (file)
index 0000000..4ee33f5
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# Add a believable node - used to filter nodes as being believable
+#
+# Copyright (c) 2004 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $call;
+my $node = shift @args;
+my @out;
+my @nodes;
+
+return (1, $self->msg('e5')) if $self->priv < 6;
+return (1, $self->msg('e22', $node)) unless is_callsign($node);
+my $user = DXUser->get_current($node);
+return (1, $self->msg('e13', $node)) unless $user->is_node;
+
+foreach $call (@args) {
+       return (1, $self->msg('e22', $node)) unless is_callsign($call);
+
+       my $u = DXUser->get_current($call);
+       push @nodes, $call;
+}
+
+foreach $call (@nodes) {
+       $user->unset_believe($call);
+       push @out, $self->msg('believeu', $call, $node);
+}
+$user->put if @nodes;
+               
+return (1, @out);
index b254ae5ab1723b33b159058014af9a146295afb4..f371161ba2a13feee8c4b96d07a3b948d4012060 100644 (file)
@@ -92,6 +92,7 @@ $v3 = 0;
                  prompt => '0,Required Prompt',
                  version => '1,Version',
                  build => '1,Build',
+                 believe => '1,Believable nodes,parray',
                 );
 
 #no strict;
@@ -777,6 +778,24 @@ sub unset_passphrase
        my $self = shift;
        delete $self->{passphrase};
 }
+
+sub set_believe
+{
+       my $self = shift;
+       my $call = uc shift;
+       $self->{believe} ||= [];
+       push @{$self->{believe}}, $call;
+}
+
+sub unset_believe
+{
+       my $self = shift;
+       my $call = uc shift;
+       if (exists $self->{believe}) {
+               $self->{believe} = [grep {$_ ne $call} @{$self->{believe}}];
+               delete $self->{believe} unless @{$self->{believe}};
+       }
+}
 1;
 __END__
 
index 6233bfe18e0d7a565685bea3e909bce8ca2739da..e7356ba2381420bdcd308100b62ca961161fc8a2 100644 (file)
@@ -24,6 +24,8 @@ package DXM;
                                bbs => 'Your BBS Address is now \"$_[0]\"',
                                beepoff => 'Beeps are now off',
                                beepon => 'Beeps are now on',
+                               believes => 'Believe node $_[0] via $_[1]',
+                               believeu => 'Don\'t believe node $_[0] via $_[1]', 
                                call1 => 'Callsign lookup via $_[0]:',
                                conother => 'Sorry $_[0] you are connected to me on another port',
                                concluster => 'Sorry $_[0] you are already connected elsewhere on the cluster (on $_[1])',