+sub _add_thingy
+{
+ my $parent = shift;
+ my $s = shift;
+ my ($call, $is_node, $is_extnode, $here, $version, $build) = @$s;
+ my @rout;
+
+ if ($call) {
+ if ($is_node) {
+ dbg("ROUTE: added node $call to " . $parent->call) if isdbg('routelow');
+ @rout = $parent->add($call, $version, Route::here($here));
+ } else {
+ dbg("ROUTE: added user $call to " . $parent->call) if isdbg('routelow');
+ @rout = $parent->add_user($call, Route::here($here));
+ }
+ }
+ return @rout;
+}
+
+sub _del_thingy
+{
+ my $parent = shift;
+ my $s = shift;
+ my ($call, $is_node, $is_extnode, $here, $version, $build) = @$s;
+ my @rout;
+ if ($call) {
+ if ($is_node) {
+ my $nref = Route::Node::get($call);
+ dbg("ROUTE: deleting node $call from " . $parent->call) if isdbg('routelow');
+ @rout = $nref->del($parent) if $nref;
+ } else {
+ my $uref = Route::User::get($call);
+ dbg("ROUTE: deleting user $call from " . $parent->call) if isdbg('routelow');
+ @rout = $parent->del_user($uref) if $uref;
+ }
+ }
+ return @rout;
+}
+
+my $_last_time;
+my $_last_occurs;
+
+sub gen_pc9x_t
+{
+ if (!$_last_time || $_last_time != $main::systime) {
+ $_last_time = $main::systime;
+ $_last_occurs = 0;
+ return $_last_time - $main::systime_daystart;
+ } else {
+ $_last_occurs++;
+ return sprintf "%d.%02d", $_last_time - $main::systime_daystart, $_last_occurs;
+ }
+}
+
+sub check_pc9x_t
+{
+ my $call = shift;
+ my $t = shift;
+ my $pc = shift;
+ my $create = shift;
+
+ my $parent = ref $call ? $call : Route::Node::get($call);
+ if ($parent) {
+ my $lastid = $parent->lastid->{$pc} || 0;
+ if ($lastid + $main::systime_daystart >= $t + $main::systime_daystart) {
+ dbg("PCPROT: dup / old id on $call <= $lastid, ignored") if isdbg('chanerr');
+ return;
+ }
+ } elsif ($create) {
+ $parent = Route::Node->new($call);
+ }
+ $parent->lastid->{$pc} = $t;
+
+ return $parent;
+}
+