Changed the talk logging.
Changed the email of personal messages to use Net::SMTP.
Tidied up Expunging.
+02Nov01=======================================================================
+1. fixed some Aliasing problems, but this whole area will have to be addressed
+more comprehensively.
+2. Changed talk logging so that it hopefully is more consistant and maybe even
+useful.
+3. Altered the mechanism of the personal emailing so that it uses lower level
+components and should be therefore available on M$ platforms. You will need
+to install a version of libnet (perl -MCPAN -eshell, then install Net::SMTP).
+I believe all 5.6.x perls have this built in (ie M$ should have this). If you
+are on M$ or you want to use an MTA via SMTP in linux then you need to declare
+the dns name of the MTA by: set/var $DXMsg::email_server = 'post.fred.net'
+(or whatever the MTA is called). You can also use local programs other than
+sendmail by: set/var $DXMsg::email_prog = '/usr/bin/postfix ..' or whatever.
+Finally you can alter the 'from' address using: set/var $DXMsg::email_from
+= 'FBloggs@msn.com' (\@ if you use " and ") - bewarned that you may be
+prevented from using just any old address. You can place these commands in
+/spider/scripts/startup for permanent use.
01Nov01=======================================================================
1. added information on registration, login scripts and passwords to the
-administration manual
+26Oct01=======================================================================
+1. If $main::reqreg = 1 then set/register will allow 'registered' users
+full access, if $main::reqreg = 2 then registered users will be 'read-only'
+(ie the opposite). If $main::reqreg = 0 then registration and its effects
+are disabled.
25Oct01=======================================================================
1. added unset/password command to allow sysops (only) to completely delete
and remove a user's password.
3. give a read receipt for everybody that reads a message so marked.
4. enhance set/email so that if you set email address(es) with this command
it will send any messages to your callsign as they come in. unset/email
-will disable forwarding. This probably only works for unix systems. To enable
-this feature you need to download Mail::Send from CPAN and install it.
-(http://www.cpan.org/modules/by-module/Mail/MailTools-1.40.tar.gz). If you
-don't want this then it should work without.
+will disable forwarding.
24Oct01=======================================================================
1. added (un)set/register, show/registered commands which when a 'set/var
$main::reqreg = 1' is done in the startup script will require users to
],
'a' => [
'^acc?e?p?t?$', 'apropos accept', 'apropos',
- '^ann\w*/full', 'announce full', 'announce',
- '^ann\w*/sysop', 'announce sysop', 'announce',
- '^ann\w*/(.*)$', 'announce $1', 'announce',
+ '^ann?o?u?n?c?e?/full', 'announce full', 'announce',
+ '^ann?o?u?n?c?e?/sysop', 'announce sysop', 'announce',
+ '^ann?o?u?n?c?e?/(.*)$', 'announce $1', 'announce',
],
'b' => [
'^b$', 'bye', 'bye',
'^cre?a?t?e?$', 'apropos create', 'apropos',
],
'd' => [
- '^del\w*/u', 'delete/user', 'delete/user',
- '^del\w*/fu', 'kill full', 'kill',
- '^del', 'kill', 'kill',
- '^di\w*/a\w*', 'directory all', 'directory',
- '^di\w*/b\w*', 'directory bulletins', 'directory',
- '^di\w*/n\w*', 'directory new', 'directory',
- '^di\w*/o\w*', 'directory own', 'directory',
- '^di\w*/s\w*', 'directory subject', 'directory',
- '^di\w*/t\w*', 'directory to', 'directory',
- '^di\w*/f\w*', 'directory from', 'directory',
- '^di\w*/(\d+)-(\d+)', 'directory $1-$2', 'directory',
- '^di\w*/(\d+)', 'directory $1', 'directory',
+ '^dele?t?e?/u', 'delete/user', 'delete/user',
+ '^dele?t?e?/fu', 'kill full', 'kill',
+ '^dele?t?e?$', 'kill', 'kill',
+ '^dir?e?c?t?o?r?y?/a\w*', 'directory all', 'directory',
+ '^dir?e?c?t?o?r?y?/b\w*', 'directory bulletins', 'directory',
+ '^dir?e?c?t?o?r?y?/n\w*', 'directory new', 'directory',
+ '^dir?e?c?t?o?r?y?/o\w*', 'directory own', 'directory',
+ '^dir?e?c?t?o?r?y?/s\w*', 'directory subject', 'directory',
+ '^dir?e?c?t?o?r?y?/t\w*', 'directory to', 'directory',
+ '^dir?e?c?t?o?r?y?/f\w*', 'directory from', 'directory',
+ '^dir?e?c?t?o?r?y?/(\d+)-(\d+)', 'directory $1-$2', 'directory',
+ '^dir?e?c?t?o?r?y?/(\d+)', 'directory $1', 'directory',
],
'e' => [
'^exi?t?$', 'bye', 'bye',
- '^exp?u?\w+$', 'kill expunge', 'kill expunge',
+ '^export_u', 'export_users', 'export_users',
+ '^expor?', 'export', 'export',
+ '^expun?g?e?$', 'kill expunge', 'kill expunge',
],
'f' => [
'^fo\w*$', 'apropos forward', 'apropos',
'j' => [
],
'k' => [
+ '^ki?l?l?/ex', 'kill expunge', 'kill',
],
'l' => [
'^loa?d?$', 'apropos load', 'apropos',
'^sho?w?/up', 'show/cluster', 'show/cluster',
'^sho?w?/ww?v?/(\d+)-(\d+)', 'show/wwv $1-$2', 'show/wwv',
'^sho?w?/ww?v?/(\d+)', 'show/wwv $1', 'show/wwv',
- '^shut?d?\w*$', 'shutdown', 'shutdown',
'^sho?w?$', 'apropos show', 'apropos',
+ '^shut?d?\w*$', 'shutdown', 'shutdown',
'^sp$', 'send', 'send',
'^sta?t?$', 'apropos stat', 'apropos',
$m = $self->msg('export2', $msgno, $fn, $!, $self->call);
}
Log('msg', $m);
-dbg('msg', $m);
+dbg($m) if isdbg('msg');
push @out, $m;
return (1, @out);
$old = $ref->keep ? 'Keep' : 'No Keep';
$new = 'No Keep';
$ref->keep(0);
+} elsif ($cmd =~ /^node/i) {
+ $m = 'Delete';
+ $old = $ref->delete ? 'Delete' : 'Not Delete';
+ $new = 'Not Delete';
+ $ref->unmark_delete;
} elsif ($cmd =~ /^su/i) {
$m = 'Subject';
$old = $ref->subject;
# that I haven't read yet
if (@f == 0) {
foreach $ref (DXMsg::get_all()) {
- if ($ref->to eq $self->call && $ref->private && !$ref->read) {
+ if ($ref->to eq $self->call && $ref->private && !$ref->read && !$ref->delete) {
push @f, $ref->msgno;
last;
}
$self->{here} = 1;
# sort out registration
- if ($main::reqreg) {
+ if ($main::reqreg == 1) {
$self->{registered} = $user->registered;
+ } elsif ($main::reqreg == 2) {
+ $self->{registered} = !$user->registered;
} else {
$self->{registered} = 1;
}
} else {
eval { @ans = &{$self->{func}}($self, $cmdline) };
}
- $self->send_ans("Syserr: on stored func $self->{func}", $@) if $@;
+ if ($@) {
+ $self->send_ans("Syserr: on stored func $self->{func}", $@);
+ $self->state('prompt');
+ undef $@;
+ }
$self->send_ans(@ans);
} else {
$self->send_ans(run_cmd($self, $cmdline));
my ($self, $from, $to, $via, $line) = @_;
$line =~ s/\\5E/\^/g;
$self->local_send('T', "$to de $from: $line") if $self->{talk};
- Log('talk', $to, $from, $main::mycall, $line);
+ Log('talk', $to, $from, $via?$via:$main::mycall, $line);
# send a 'not here' message if required
unless ($self->{here} && $from ne $to) {
my $key = "$to$from";
use Fcntl;
eval {
- require Mail::Send;
+ require Net::SMTP;
};
use strict;
use vars qw(%work @msg $msgdir %valid %busy $maxage $last_clean $residencetime
@badmsg @swop $swopfn $badmsgfn $forwardfn @forward $timeout $waittime
+ $email_server $email_prog $email_from
$queueinterval $lastq $importfn $minchunk $maxchunk $bulltopriv);
%work = (); # outstanding jobs
$maxchunk = 6000; # maximum chunk size
$bulltopriv = 1; # convert msgs with callsigns to private if they are bulls
$residencetime = 2*86400; # keep deleted messages for this amount of time
-
+$email_server = undef; # DNS address of smtp server if 'smtp'
+$email_prog = undef; # program name + args for sending mail
+$email_from = undef; # the from address the email will appear to be from
$badmsgfn = "$msgdir/badmsg.pl"; # list of TO address we wont store
$forwardfn = "$msgdir/forward.pl"; # the forwarding table
deletetime => '5,Deletion Time,cldatetime',
);
+# fix up the default sendmail if available
+for (qw(/usr/sbin/sendmail /usr/lib/sendmail /usr/sbin/sendmail)) {
+ if (-e $_) {
+ $email_prog = $_;
+ last;
+ }
+}
+
# allocate a new object
# called fromnode, tonode, from, to, datetime, private?, subject, nolinesper
sub alloc
# $to =~ s/-\d+$//o;
$self->{to} = ($to eq $main::mycall) ? $main::myalias : $to;
my $from = shift;
- $from =~ s/-\d+$//o;
$self->{from} = uc $from;
$self->{t} = shift;
$self->{private} = shift;
my $to = $ref->{to};
my $uref = DXUser->get($to);
my $dxchan = DXChannel->get($to);
- if (*Mail::Send && $uref && $uref->wantemail) {
+ if (((*Net::SMTP && $email_server) || $email_prog) && $uref && $uref->wantemail) {
my $email = $uref->email;
if ($email) {
- my @list = ref $email ? @{$email} : $email;
- my $msg = new Mail::Send Subject=>"[DXSpider: $ref->{from}] $ref->{subject}";
- $msg->to(@list);
- my $fh = $msg->open;
- if ($fh) {
- print $fh "From: $ref->{from} To: $to On Node: $main::mycall Origin: $ref->{origin} Msgno: $ref->{msgno}\r\n\r\n";
- print $fh map {"$_\r\n"} $ref->read_msg_body;
- $fh->close;
- for (@list) {
- Log('msg', "Msgno $ref->{msgno} from $ref->{from} emailed to $_");
+ my @rcpt = ref $email ? @{$email} : $email;
+ my $fromaddr = $email_from || $main::myemail;
+ my @headers = ("To: $ref->{to}",
+ "From: $fromaddr",
+ "Subject: [DXSpider: $ref->{from}] $ref->{subject}",
+ "X-DXSpider-To: $ref->{to}",
+ "X-DXSpider-From: $ref->{from}\@$ref->{origin}",
+ "X-DXSpider-Gateway: $main::mycall"
+ );
+ my @data = ("Msgno: $ref->{msgno} To: $to From: $ref->{from}\@$ref->{origin} Gateway: $main::mycall",
+ "",
+ $ref->read_msg_body
+ );
+ my $msg;
+ undef $!;
+ if (*Net::SMTP && $email_server) {
+ $msg = Net::SMTP->new($email_server);
+ if ($msg) {
+ $msg->mail($fromaddr);
+ $msg->to(@rcpt);
+ $msg->data(map {"$_\n"} @headers, '', @data);
+ $msg->quit;
+ }
+ } elsif ($email_prog) {
+ $msg = new IO::File "|$email_prog " . join(' ', @rcpt);
+ if ($msg) {
+ print $msg map {"$_\r\n"} @headers, '', @data, '.';
+ $msg->close;
}
- } else {
- dbg("email forwarding error $!") if isdbg('msg');
}
+ dbg("email forwarding error $!") if isdbg('msg') && !$msg && defined $!;
}
}
$dxchan->send($dxchan->msg('m9')) if $dxchan && $dxchan->is_user;
confess "can't open msg file $fn $!";
}
}
+
+ # actual remove all the 'deleted' messages in one hit.
+ # this has to me delayed until here otherwise it only does one at
+ # a time because @msg is rewritten everytime del_msg is called.
+ my @del = grep {!$_->{tonode} && $_->{delete} && $_->{deletetime} < $main::systime} @msg;
+ for (@del) {
+ $_->del_msg;
+ }
}
# delete a message
{
my $self = shift;
my $dxchan = shift;
+ my $call = '';
+ $call = ' by ' . $dxchan->call if $dxchan;
if ($self->{tonode}) {
$self->{delete}++;
$self->{deletetime} = 0;
+ dbg("Msgno $self->{msgno} but marked as expunged$call") if isdbg('msg');
} else {
# remove it from the active message list
@msg = grep { $_ != $self } @msg;
- my $call = '';
- $call = ' by ' . $dxchan->call if $dxchan;
Log('msg', "Msgno $self->{msgno} expunged$call");
+ dbg("Msgno $self->{msgno} expunged$call") if isdbg('msg');
# remove the file
unlink filename($self->{msgno});
$ref->store( [$ref->read_msg_body] );
}
+sub unmark_delete
+{
+ my $ref = shift;
+ my $t = shift;
+ delete $ref->{delete};
+ delete $ref->{deletetime};
+}
+
# clean out old messages from the message queue
sub clean_old
{
next if $ref->{tonode}; # ignore it if it already being processed
# is it awaiting deletion?
- if ($ref->{delete} && $main::systime >= $ref->{deletetime}) {
- $ref->del_msg;
- next;
- }
next if $ref->{delete};
# firstly, is it private and unread? if so can I find the recipient
# if all the available nodes are busy then stop
last if @nodelist == scalar grep { get_busy($_->call) } @nodelist;
}
+
+
}
# is there a message for me?
sub dir
{
my $ref = shift;
- my $flag = $ref->read ? '-' : ' ';
- $flag = 'D' if $ref->delete;
- return sprintf "%6d%s%s%5d %8.8s %8.8s %-6.6s %5.5s %-30.30s",
- $ref->msgno, $flag, $ref->private ? 'p' : ' ', $ref->size,
- $ref->to, $ref->from, cldate($ref->t), ztime($ref->t), $ref->subject;
+ my $flag = $ref->{private} && $ref->{read} ? '-' : ' ';
+ if ($ref->{delete}) {
+ $flag = $ref->{deletetime} > $main::systime ? 'D' : 'E';
+ }
+ return sprintf("%6d%s%s%5d %8.8s %8.8s %-6.6s %5.5s %-30.30s",
+ $ref->{msgno}, $flag, $ref->{private} ? 'p' : ' ',
+ $ref->{size}, $ref->{to}, $ref->{from}, cldate($ref->{t}),
+ ztime($ref->{t}), $ref->{subject});
}
# load the forward table
$line =~ s/\^/\\5E/g; # remove any ^ characters
$self->send(DXProt::pc10($from, $to, $via, $line, $origin));
- Log('talk', $self->call, $from, $via?$via:$main::mycall, $line) unless $origin && $origin ne $main::mycall;
+ Log('talk', $to, $from, $via?$via:$self->call, $line) unless $origin && $origin ne $main::mycall;
}
# send it if it isn't the except list and isn't isolated and still has a hop count
lat => '0,Latitude,slat',
long => '0,Longitude,slong',
qra => '0,Locator',
- email => '0,E-mail Address',
+ email => '0,E-mail Address,parray',
priv => '9,Privilege Level',
lastin => '0,Last Time in,cldatetime',
passwd => '9,Password,yesno',