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,0));
31 $main::build += $VERSION;
32 $main::branch += $BRANCH;
36 my ($pkg, $name) = @_;
37 my $s = readfilestr($main::data, $name);
39 $self = eval $s if $s;
40 dbg("error in reading $name in DXHash $@") if $@;
41 $self = bless({name => $name}, $pkg) unless defined $self;
48 writefilestr($main::data, $self->{name}, undef, $self);
55 my $t = shift || time;
70 return exists $self->{$n};
73 # this is really just a general shortcut for all commands to
74 # set and unset values
77 my ($self, $priv, $noline, $dxchan, $line) = @_;
78 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
79 my @f = split /\s+/, $line;
80 return (1, $noline) unless @f;
87 push @out, $dxchan->msg('hasha',uc $f, $self->{name});
91 push @out, $dxchan->msg('hashb', uc $f, $self->{name});
97 # this is really just a general shortcut for all commands to
98 # set and unset values
101 my ($self, $priv, $noline, $dxchan, $line) = @_;
102 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
103 my @f = split /\s+/, $line;
104 return (1, $noline) unless @f;
110 unless ($self->in($f)) {
111 push @out, $dxchan->msg('hashd', uc $f, $self->{name});
115 push @out, $dxchan->msg('hashc', uc $f, $self->{name});
123 my ($self, $priv, $dxchan) = @_;
124 return (1, $dxchan->msg('e5')) unless $dxchan->priv >= $priv;
127 for (sort keys %{$self}) {
128 next if $_ eq 'name';
129 push @out, $dxchan->msg('hashe', $_, cldatetime($self->{$_}));