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
30 my ($pkg, $name) = @_;
31 my $s = readfilestr($main::data, $name);
32 my $self = eval $s if $s;
33 dbg('err', "error in reading $name in DXHash $@") if $@;
34 $self = bless {name => $name}, $pkg unless $self;
41 writefilestr($main::data, $self->{name}, undef, $self);
48 my $t = shift || time;
63 return exists $self->{$n};
66 # this is really just a general shortcut for all commands to
67 # set and unset values
70 my ($self, $priv, $noline, $dxchan, $line) = @_;
71 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
72 my @f = split /\s+/, $line;
73 return (1, $noline) unless @f;
80 push @out, $dxchan->msg('hasha',uc $f, $self->{name});
84 push @out, $dxchan->msg('hashb', uc $f, $self->{name});
90 # this is really just a general shortcut for all commands to
91 # set and unset values
94 my ($self, $priv, $noline, $dxchan, $line) = @_;
95 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
96 my @f = split /\s+/, $line;
97 return (1, $noline) unless @f;
103 unless ($self->in($f)) {
104 push @out, $dxchan->msg('hashd', uc $f, $self->{name});
108 push @out, $dxchan->msg('hashc', uc $f, $self->{name});
116 my ($self, $priv, $dxchan) = @_;
117 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
120 for (sort keys %{$self}) {
121 next if $_ eq 'name';
122 push @out, $dxchan->msg('hashe', $_, cldatetime($self->{$_}));