Change DXUser->get* to DXUser::get*
[spider.git] / perl / DXXml / Text.pm
index 35c83191e504fe8a5909e77ad6bb433012c3d60f..3b8b5b4438797e5919b0989d24cc1feb7b0c772d 100644 (file)
@@ -1,7 +1,7 @@
 #
 # XML Text handler
 #
-# $Id$
+#
 #
 # Copyright (c) Dirk Koopman, G1TLH
 #
@@ -12,16 +12,9 @@ package DXXml::Text;
 
 use DXDebug;
 use DXProt;
-use IsoTime;
-use Investigate;
-use Time::HiRes qw(gettimeofday tv_interval);
-
-use vars qw($VERSION $BRANCH @ISA %pings);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
+use DXLog;
 
+use vars qw(@ISA);
 @ISA = qw(DXXml);
 
 sub handle_input
@@ -29,13 +22,16 @@ sub handle_input
        my $self = shift;
        my $dxchan = shift;
 
-       # this is always routed
-       if ($self->{to} eq $main::mycall ) {
-               my $r = DXChannel::get($main::myalias);
-               $dxchan = $r if $r;
+       if ($self->{to} eq $main::mycall) {
+               my $tochan = DXChannel::get($self->{u} || $main::myalias);
+               if ($tochan) {
+                       $tochan->send($self->tocmd);
+               } else {
+                       dbg("no user or $main::myalias not online") if isdbg('chanerr');
+               }
+       } else {        
+               $self->route($dxchan);
        }
-       $self->route($dxchan);
-
 }
 
 sub topcxx
@@ -44,15 +40,15 @@ sub topcxx
        my $dxchan = shift;
        my @out;
 
-       my $ref = DXUser->get_current($self->{to});
-       while (@_) {
-               my $line = shift;
+       my $ref = DXUser::get_current($self->{to});
+       for (split /(?:%0D)?\%0A/, $self->{content}) {
+               my $line = $_;
                $line =~ s/\s*$//;
                Log('rcmd', 'out', $self->{to}, $line);
                if ($self->{u} && $dxchan->is_clx && $ref->is_clx) {
-                       push @out, pc85($main::mycall, $self->{to}, $self->{u}, "$main::mycall:$line");
+                       push @out, DXProt::pc85($main::mycall, $self->{to}, $self->{u}, "$main::mycall:$line");
                } else {
-                       push @out, pc35($main::mycall, $self->{to}, "$main::mycall:$line");
+                       push @out, DXProt::pc35($main::mycall, $self->{to}, "$main::mycall:$line");
                }
        }