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
19 use vars qw (@ISA %bid $bidfn $lastbidclean $bidcleanint %hash $maxbidage);
23 %bid = (); # the bid hash
24 $bidfn = "$main::root/msg/bid"; # the bid file filename
25 $lastbidclean = time; # the last time the bid file was cleaned
26 $bidcleanint = 86400; # the time between bid cleaning intervals
27 $maxbidage = 60; # the maximum age of a stored bid
31 tie %hash, 'DB_File', $bidfn;
35 # obtain a new connection this is derived from dxchannel
40 my $self = DXChannel::alloc(@_);
45 # start a new connection
49 my ($self, $line, $sort) = @_;
50 my $call = $self->{call};
51 my $user = $self->{user};
53 # remember type of connection
54 $self->{consort} = $line;
55 $self->{outbound} = $sort eq 'O';
56 $self->{priv} = $user->priv;
57 $self->{lang} = $user->lang;
58 $self->{isolate} = $user->{isolate};
59 $self->{consort} = $line; # save the connection type
61 # set unbuffered and no echo
62 $self->send_now('B',"0");
63 $self->send_now('E',"0");
65 # send initialisation string
66 $self->send("[SDX-$main::version-H\$]");
68 $self->state('prompt');
70 Log('BBS', "$call", "connected");
80 $self->send("$main::mycall>");
89 my ($self, $line) = @_;
91 my ($com, $rest) = split /\s+/, $line, 2;
94 my ($to, $at, $from) = $rest =~ /^(\w+)\s*\@\s*([\#\w\.]+)\s*<\s*(\w+)/;
95 my ($bid) = $rest =~ /\$(\S+)$/;
96 my ($justat, $haddr) = $at =~ /^(\w+)\.(.*)$/;
97 $justat = $at unless $justat;
99 $self->send('N - no "to" address');
103 $self->send('N - no "from" address');
107 # now handle the different types of send
110 $self->send('N - "ALL" not allowed');
115 } elsif ($com =~ /^F/) {
117 } elsif ($com =~ /^(B|Q)/) {
123 # end a connection (called by disconnect)
128 my $call = $self->call;
129 Log('BBS', "$call", "disconnected");
130 $self->SUPER::disconnect;
134 # process (periodic processing)