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);
33 $self = eval $s if $s;
34 dbg("error in reading $name in DXHash $@") if $@;
35 $self = bless({name => $name}, $pkg) unless defined $self;
42 writefilestr($main::data, $self->{name}, undef, $self);
49 my $t = shift || time;
64 return exists $self->{$n};
67 # this is really just a general shortcut for all commands to
68 # set and unset values
71 my ($self, $priv, $noline, $dxchan, $line) = @_;
72 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
73 my @f = split /\s+/, $line;
74 return (1, $noline) unless @f;
81 push @out, $dxchan->msg('hasha',uc $f, $self->{name});
85 push @out, $dxchan->msg('hashb', uc $f, $self->{name});
91 # this is really just a general shortcut for all commands to
92 # set and unset values
95 my ($self, $priv, $noline, $dxchan, $line) = @_;
96 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
97 my @f = split /\s+/, $line;
98 return (1, $noline) unless @f;
104 unless ($self->in($f)) {
105 push @out, $dxchan->msg('hashd', uc $f, $self->{name});
109 push @out, $dxchan->msg('hashc', uc $f, $self->{name});
117 my ($self, $priv, $dxchan) = @_;
118 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
121 for (sort keys %{$self}) {
122 next if $_ eq 'name';
123 push @out, $dxchan->msg('hashe', $_, cldatetime($self->{$_}));