2 # a class for setting 'bad' (or good) things
4 # This is really a general purpose list handling
5 # thingy for determining good or bad objects like
6 # callsigns. It is for storing things "For Ever".
8 # Things entered into the list are always upper
11 # The files that are created live in /spider/data
13 # Dunno why I didn't do this earlier but heyho..
15 # Copyright (c) 2001 Dirk Koopman G1TLH
28 use vars qw($VERSION $BRANCH);
29 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
30 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
31 $main::build += $VERSION;
32 $main::branch += $BRANCH;
36 my ($pkg, $name) = @_;
37 my $s = readfilestr($main::data, $name);
38 my $self = eval $s if $s;
39 dbg("error in reading $name in DXHash $@") if $@;
40 $self = bless {name => $name}, $pkg unless $self;
47 writefilestr($main::data, $self->{name}, undef, $self);
54 my $t = shift || time;
69 return exists $self->{$n};
72 # this is really just a general shortcut for all commands to
73 # set and unset values
76 my ($self, $priv, $noline, $dxchan, $line) = @_;
77 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
78 my @f = split /\s+/, $line;
79 return (1, $noline) unless @f;
86 push @out, $dxchan->msg('hasha',uc $f, $self->{name});
90 push @out, $dxchan->msg('hashb', uc $f, $self->{name});
96 # this is really just a general shortcut for all commands to
97 # set and unset values
100 my ($self, $priv, $noline, $dxchan, $line) = @_;
101 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
102 my @f = split /\s+/, $line;
103 return (1, $noline) unless @f;
109 unless ($self->in($f)) {
110 push @out, $dxchan->msg('hashd', uc $f, $self->{name});
114 push @out, $dxchan->msg('hashc', uc $f, $self->{name});
122 my ($self, $priv, $dxchan) = @_;
123 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
126 for (sort keys %{$self}) {
127 next if $_ eq 'name';
128 push @out, $dxchan->msg('hashe', $_, cldatetime($self->{$_}));