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(@_);
42 $self->{'sort'} = 'B';
47 # start a new connection
51 my ($self, $line, $sort) = @_;
52 my $call = $self->{call};
53 my $user = $self->{user};
55 # remember type of connection
56 $self->{consort} = $line;
57 $self->{outbound} = $sort eq 'O';
58 $self->{priv} = $user->priv;
59 $self->{lang} = $user->lang;
60 $self->{isolate} = $user->{isolate};
61 $self->{consort} = $line; # save the connection type
63 # set unbuffered and no echo
64 $self->send_now('B',"0");
65 $self->send_now('E',"0");
67 # send initialisation string
68 $self->send("[SDX-$main::version-H\$]");
70 $self->state('prompt');
72 Log('BBS', "$call", "connected");
82 $self->send("$main::mycall>");
91 my ($self, $line) = @_;
93 my ($com, $rest) = split /\s+/, $line, 2;
96 my ($to, $at, $from) = $rest =~ /^(\w+)\s*\@\s*([\#\w\.]+)\s*<\s*(\w+)/;
97 my ($bid) = $rest =~ /\$(\S+)$/;
98 my ($justat, $haddr) = $at =~ /^(\w+)\.(.*)$/;
99 $justat = $at unless $justat;
101 $self->send('N - no "to" address');
105 $self->send('N - no "from" address');
109 # now handle the different types of send
112 $self->send('N - "ALL" not allowed');
117 } elsif ($com =~ /^F/) {
119 } elsif ($com =~ /^(B|Q)) {
125 # end a connection (called by disconnect)
130 my $call = $self->call;
131 Log('BBS', "$call", "disconnected");
135 # process (periodic processing)