+# take a standard input message and decode it into its standard parts
+sub decode_input
+{
+ my $dxchan = shift;
+ my $data = shift;
+ my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z0-9\-]{3,9})\|(.*)$/;
+
+ my $chcall = (ref $dxchan) ? $dxchan->call : "UN.KNOWN";
+
+ # the above regexp must work
+ unless (defined $sort && defined $call && defined $line) {
+# $data =~ s/([\x00-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg;
+ dbg("DUFF Line on $chcall: $data") if isdbg('err');
+ return ();
+ }
+
+ if(ref($dxchan) && $call ne $chcall) {
+ dbg("DUFF Line come in for $call on wrong channel $chcall") if isdbg('err');
+ return();
+ }
+
+ return ($sort, $call, $line);
+}
+
+sub rspfcheck
+{
+ my ($self, $flag, $node, $user) = @_;
+ my $nref = Route::Node::get($node);
+ if ($nref) {
+ if ($nref->dxchan == $self) {
+ return 1 unless $user;
+ return 1 if grep $user eq $_, $nref->users;
+ dbg("RSPF: $user not on $node") if isdbg('rspf');
+ } else {
+ dbg("RSPF: Shortest path for $node is " . $nref->dxchan->{call}) if isdbg('rspf');
+ }
+ } else {
+ return 1 if $flag;
+ dbg("RSPF: required $node not found" ) if isdbg('rspf');
+ }
+ return 0;
+}
+