3 # Sigh, I suppose it had to happen at some point...
5 # This is a simple BBS Forwarding module.
7 # Copyright (c) 1999 - Dirk Koopman G1TLH
22 use vars qw (%bid $bidfn $lastbidclean $bidcleanint);
24 %bid = (); # the bid hash
25 $bidfn = "$main::root/msg/bid"; # the bid file filename
26 $lastbidclean = time; # the last time the bid file was cleaned
27 $bidcleanint = 86400; # the time between bid cleaning intervals
28 $maxbidage = 60; # the maximum age of a stored bid
32 tie %hash, 'DB_File', $bidfn;
36 # obtain a new connection this is derived from dxchannel
41 my $self = DXChannel::alloc(@_);
46 # start a new connection
50 my ($self, $line, $sort) = @_;
51 my $call = $self->{call};
52 my $user = $self->{user};
54 # remember type of connection
55 $self->{consort} = $line;
56 $self->{outbound} = $sort eq 'O';
57 $self->{priv} = $user->priv;
58 $self->{lang} = $user->lang;
59 $self->{isolate} = $user->{isolate};
60 $self->{consort} = $line; # save the connection type
62 # set unbuffered and no echo
63 $self->send_now('B',"0");
64 $self->send_now('E',"0");
66 # send initialisation string
67 $self->send("[SDX-$main::version-H\$]");
69 $self->state('prompt');
71 Log('BBS', "$call", "connected");
81 $self->send("$main::mycall>");
90 my ($self, $line) = @_;
92 my ($com, $rest) = split /\s+/, $line, 2;
95 my ($to, $at, $from) = $rest =~ /^(\w+)\s*\@\s*([\#\w\.]+)\s*<\s*(\w+)/;
96 my ($bid) = $rest =~ /\$(\S+)$/;
97 my ($justat, $haddr) = $at =~ /^(\w+)\.(.*)$/;
98 $justat = $at unless $justat;
100 $self->send('N - no "to" address');
104 $self->send('N - no "from" address');
108 # now handle the different types of send
111 $self->send('N - "ALL" not allowed');
116 } elsif ($com =~ /^F/) {
118 } elsif ($com =~ /^(B|Q)) {
124 # end a connection (called by disconnect)
129 my $call = $self->call;
130 Log('BBS', "$call", "disconnected");
131 $self->SUPER::disconnect;
135 # process (periodic processing)