6. Make the scripts look for user and node_default files if there isn't a
[spider.git] / perl / DXProt.pm
index e986055692de4a2a00bca485b42a1d0c32b190bf..b8b17ae612065b2080eb8c44f7c34cc20120c81c 100644 (file)
@@ -32,6 +32,7 @@ use BadWords;
 use DXHash;
 use Route;
 use Route::Node;
+use Script;
 
 use strict;
 
@@ -272,6 +273,10 @@ sub start
 
        # send info to all logged in thingies
        $self->tell_login('loginn');
+
+       # run a script send the output to the debug file
+       my $script = new Script(lc $call) || new Script('node_default');
+       $script->run($self) if $script;
 }
 
 #
@@ -332,7 +337,7 @@ sub normal
 
                        # if we are converting announces to talk is it a dup?
                        if ($ann_to_talk) {
-                               if (AnnTalk::is_talk_candidate($$from, $field[3]) && AnnTalk::dup($$from, $to, $field[3])) {
+                               if (AnnTalk::is_talk_candidate($from, $field[3]) && AnnTalk::dup($from, $to, $field[3])) {
                                        dbg("DXPROT: Dupe talk from announce, dropped") if isdbg('chanerr');
                                        return;
                                }
@@ -343,7 +348,7 @@ sub normal
                        $dxchan = DXChannel->get($to) unless $dxchan;
                        if ($dxchan && $dxchan->is_user) {
                                $field[3] =~ s/\%5E/^/g;
-                               $dxchan->talk($$from, $to, $via, $field[3]);
+                               $dxchan->talk($from, $to, $via, $field[3]);
                                return;
                        }
 
@@ -354,17 +359,17 @@ sub normal
                        if ($ref = Route::get($to)) {
                                $vref = Route::Node::get($via) if $via;
                                $vref = undef unless $vref && grep $to eq $_, $vref->users;
-                               $ref->dxchan->talk($$from, $to, $vref ? $via : undef, $field[3], $field[6]);
+                               $ref->dxchan->talk($from, $to, $vref ? $via : undef, $field[3], $field[6]);
                                return;
                        }
 
                        # not visible here, send a message of condolence
                        $vref = undef;
-                       $ref = Route::get($$from);
+                       $ref = Route::get($from);
                        $vref = $ref = Route::Node::get($field[6]) unless $ref; 
                        if ($ref) {
                                $dxchan = $ref->dxchan;
-                               $dxchan->talk($main::mycall, $$from, $vref ? $vref->call : undef, $dxchan->msg('talknh', $to) );
+                               $dxchan->talk($main::mycall, $from, $vref ? $vref->call : undef, $dxchan->msg('talknh', $to) );
                        }
                        return;
                }
@@ -969,7 +974,7 @@ sub normal
 #                      my $ref = Route::get($call) || Route->new($call);
 #                      return unless $self->in_filter_route($ref);
 
-                       if ($field[3] eq $field[2]) {
+                       if ($field[3] eq $field[2] || $field[3] =~ /^\s*$/) {
                                dbg('PCPROT: invalid value') if isdbg('chanerr');
                                return;
                        }