get the basic (r)cmd thing working.
[spider.git] / perl / DXChannel.pm
index 31f912c6030b789b5fef9fa3c310273aa3b45e3e..b0208f103e0e6093df5b654c133420e110780419 100644 (file)
@@ -117,14 +117,15 @@ $count = 0;
                  ve7cc => '0,VE7CC program special,yesno',
                  lastmsgpoll => '0,Last Msg Poll,atime',
                  inscript => '9,In a script,yesno',
+                 handle_xml => '9,Handles XML,yesno',
                  inqueue => '9,Input Queue,parray',
-                 lastcf => '1,Last CF Update,atime',
-                 lasthello => '1,Last Hello Update,atime',
                 );
 
 use vars qw($VERSION $BRANCH);
-
-main::mkver($VERSION = q$Revision$);
+$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;
 
 # object destruction
 sub DESTROY
@@ -177,6 +178,14 @@ sub alloc
        return $channels{$call} = $self;
 }
 
+# rebless this channel as something else
+sub rebless
+{
+       my $self = shift;
+       my $class = shift;
+       return $channels{$self->{call}} = bless $self, $class;
+}
+
 sub rec        
 {
        my ($self, $msg) = @_;
@@ -190,7 +199,8 @@ sub rec
 # obtain a channel object by callsign [$obj = DXChannel::get($call)]
 sub get
 {
-       return $channels{$_[0]};
+       my $call = shift;
+       return $channels{$call};
 }
 
 # obtain all the channel objects
@@ -265,7 +275,7 @@ sub is_bbs
 sub is_node
 {
        my $self = shift;
-       return $self->{'sort'} =~ /[ACRSX]/;
+       return $self->{'sort'} =~ /[ACRSXW]/;
 }
 # is it an ak1a node ?
 sub is_ak1a
@@ -386,15 +396,16 @@ sub send                                          # this is always later and always data
        return unless $conn;
        my $call = $self->{call};
 
-       for (@_) {
-#              chomp;
-        my @lines = split /\n/;
-               for (@lines) {
-                       $conn->send_later("D$call|$_");
-                       dbg("-> D $call $_") if isdbg('chan');
+       foreach my $l (@_) {
+               for (ref $l ? @$l : $l) {
+                       my @lines = split /\n/;
+                       for (@lines) {
+                               $conn->send_later("D$call|$_");
+                               dbg("-> D $call $_") if isdbg('chan');
+                       }
                }
        }
-       $self->{t} = time;
+       $self->{t} = $main::systime;
 }
 
 # send a file (always later)