From a421ba50c9bc1636d9cc45baf6cfdc5dcbe36437 Mon Sep 17 00:00:00 2001 From: minima Date: Wed, 27 Jun 2001 11:49:46 +0000 Subject: [PATCH] slug the not here messages so they can't loopback --- Changes | 1 + perl/DXCommandmode.pm | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index fe4156cd..4c528768 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ 27Jun01======================================================================= 1. try adding an ARC mail hack +2. slug the not here messages so they can't loopback 25Jun01======================================================================= 1. added automatic 'not here' message 21Jun01======================================================================= diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index c7ce8c3c..cfedb1db 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -32,7 +32,7 @@ use Sun; use Internet; use strict; -use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors); +use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug); %Cache = (); # cache of dynamically loaded routine's mod times %cmd_cache = (); # cache of short names @@ -393,6 +393,12 @@ sub process $dxchan->t($t); } } + + while (my ($k, $v) = each %nothereslug) { + if ($main::systime >= $v + 300) { + delete $nothereslug{$k}; + } + } } # @@ -646,11 +652,15 @@ sub talk Log('talk', $to, $from, $main::mycall, $line); # send a 'not here' message if required unless ($self->{here} && $from ne $to) { - my ($ref, $dxchan); - if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) { - my $name = $self->user->name || $to; - my $s = $self->user->nothere || $dxchan->msg('nothere', $name); - $dxchan->talk($to, $from, undef, $s); + my $key = "$to$from"; + unless (exists $nothereslug{$key}) { + my ($ref, $dxchan); + if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) { + my $name = $self->user->name || $to; + my $s = $self->user->nothere || $dxchan->msg('nothere', $name); + $nothereslug{$key} = $main::systime; + $dxchan->talk($to, $from, undef, $s); + } } } } -- 2.43.0