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/local_data (was data)
13 # Dunno why I didn't do this earlier but heyho..
15 # Copyright (c) 2001 Dirk Koopman G1TLH
30 my ($pkg, $name) = @_;
34 my $s = readfilestr($main::local_data, $name);
36 $self = eval $s if $s;
37 dbg("error in reading $name in DXHash $@") if $@;
38 $self = bless({name => $name}, $pkg) unless defined $self;
45 writefilestr($main::local_data, $self->{name}, undef, $self);
52 my $t = shift || time;
67 return exists $self->{$n};
70 # this is really just a general shortcut for all commands to
71 # set and unset values
74 my ($self, $priv, $noline, $dxchan, $line) = @_;
75 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
76 my @f = split /\s+/, $line;
77 return (1, $noline) unless @f;
84 push @out, $dxchan->msg('hasha',uc $f, $self->{name});
88 push @out, $dxchan->msg('hashb', uc $f, $self->{name});
94 # this is really just a general shortcut for all commands to
95 # set and unset values
98 my ($self, $priv, $noline, $dxchan, $line) = @_;
99 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
100 my @f = split /\s+/, $line;
101 return (1, $noline) unless @f;
107 unless ($self->in($f)) {
108 push @out, $dxchan->msg('hashd', uc $f, $self->{name});
112 push @out, $dxchan->msg('hashc', uc $f, $self->{name});
120 my ($self, $priv, $dxchan) = @_;
121 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
124 for (sort keys %{$self}) {
125 next if $_ eq 'name';
126 push @out, $dxchan->msg('hashe', $_, cldatetime($self->{$_}));