use Verify;
use DXDupe;
use Thingy;
+use RouteDB;
use vars qw($VERSION $BRANCH);
-$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;
+
+main::mkver($VERSION = q$Revision$);
use vars qw(@ISA $ntpflag $dupeage);
my $call = $self->call;
return if $self->{disconnecting}++;
-
+
+ my $thing = Thingy::Bye->new(origin=>$main::mycall, user=>$call);
+ $thing->process($self);
+
# get rid of any PC16/17/19
-# eph_del_regex("^PC1[679]*$call");
+ DXProt::eph_del_regex("^PC1[679]*$call");
# do routing stuff, remove me from routing table
my $node = Route::Node::get($call);
# and all my ephemera as well
for (@rout) {
my $c = $_->call;
-# eph_del_regex("^PC1[679].*$c");
+ DXProt::eph_del_regex("^PC1[679].*$c");
}
}
# because it has to be used before a channel is fully initialised).
#
+sub formathead
+{
+ my $mycall = shift;
+ my $dts = shift;
+ my $hop = shift;
+ my $user = shift;
+ my $group = shift;
+
+ my $s = "$mycall,$dts,$hop";
+ $s .= ",$user" if $user;
+ if ($group) {
+ $s .= "," unless $user;
+ $s .= ",$group" if $group;
+ }
+ return $s;
+}
+
sub genheader
{
my $mycall = shift;
my $from = shift;
my $date = ((($dayno << 1) | $ntpflag) << 18) | ($main::systime % 86400);
- my $r = "$mycall," . sprintf('%6X%04X,0', $date, $seqno);
- $r .= ",$to" if $to;
- $r .= ",$from" if $from;
+ my $r = formathead($mycall, sprintf('%6X%04X', $date, $seqno), 0, $from, $to);
$seqno++;
$seqno = 0 if $seqno > 0x0ffff;
return $r;
my ($head, $data) = split /\|/, $line, 2;
return unless $head && $data;
- my ($origin, $dts, $hop, $group, $user) = split /,/, $head;
+ my ($origin, $dts, $hop, $user, $group) = split /,/, $head;
return if DXDupe::check("Ara,$origin,$dts", $dupeage);
my $err;
$err .= "incomplete header," unless $origin && $dts && defined $hop;
$thing = $class->new();
# reconstitute the header but wth hop increased by one
- $head = join(',', $origin, $dts, ++$hop);
- $head .= ",$group" if $group;
- $head .= ",$user" if $user;
+ $head = formathead($origin, $dts, ++$hop, $user, $group);
$thing->{Aranea} = "$head|$data";
# store useful data
$thing->{touser} = $tus if $tus;
$thing->{user} = $user if $user;
$thing->{hopsaway} = $hop;
-
- for (split(/,/, $rdata)) {
- if (/=/) {
- my ($k,$v) = split /=/, $_, 2;
- $thing->{$k} = tdecode($v);
- } else {
- $thing->{$_} = 1;
+
+ if ($rdata) {
+ for (split(/,/, $rdata)) {
+ if (/=/) {
+ my ($k,$v) = split /=/, $_, 2;
+ $thing->{$k} = tdecode($v);
+ } else {
+ $thing->{$_} = 1;
+ }
}
}
-
+
# post process the thing, this generally adds on semantic meaning
# does parameter checking etc. It also adds / prepares the thingy so
# this is compatible with older protocol and arranges data so