}
}
+sub handle_xml
+{
+ my $self = shift;
+ my $r = 0;
+
+ if (DXXml::available()) {
+ $r = $self->{handle_xml} || 0;
+ } else {
+ delete $self->{handle_xml} if exists $self->{handle_xml};
+ }
+ return $r;
+}
+
#no strict;
sub AUTOLOAD
{
$investigation_int $pc19_version $myprot_version
%nodehops $baddx $badspotter $badnode $censorpc $rspfcheck
$allowzero $decode_dk0wcy $send_opernam @checklist
- $handle_xml);
+ );
$pc11_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc11
$pc23_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc23
$chatimportfn = "$main::root/chat_import";
$investigation_int = 12*60*60; # time between checks to see if we can see this node
$pc19_version = 5466; # the visible version no for outgoing PC19s generated from pc59
-$handle_xml = 0; # handle XML sentences
@checklist =
(
$self->user->put;
$self->sort('S');
}
- $self->{handle_xml}++ if $main::do_xml && $_[1] =~ /\bxml\b/;
+ $self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml\b/;
} else {
$self->version(50.0);
$self->version($_[2] / 100) if $_[2] && $_[2] =~ /^\d+$/;
$main::build += $VERSION;
$main::branch += $BRANCH;
-use vars qw($sentencelth $handle_xml);
+use vars qw($sentencelth);
$sentencelth = 180;
sub pc18
{
my $flags = "";
- $flags .= " xml" if $handle_xml;
+ $flags .= " xml" if DXXml::available();
return "PC18^DXSpider Version: $main::version Build: $main::build$flags^$DXProt::myprot_version^";
}
eval { require XML::Parser } unless $@;
if ($@) {
LogDbg('err', "do_xml was set to 1 and the XML routines failed to load ($@)");
- $main::do_xml = 0;
+ $main::do_xml = $xs = 0;
} else {
$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
import XML::Simple;
- $DXProt::handle_xml = 1;
$xs = new XML::Simple(ContentKey=>'content', ForceArray=>1);
}
undef $@;
}
+# is XML avaiable and active
+sub available
+{
+ return $main::do_xml && $xs;
+}
+
#
# note that this a function not a method
#
my $dxchan = shift;
my $line = shift;
- unless ($main::do_xml) {
+ unless (available()) {
dbg("xml not enabled, IGNORED") if isdbg('chanerr');
return;
}
my $via = $to;
my $dxchan;
- if (my $u = $self->{u}) {
+ if (my $u = $self->{u} && $self->{to} eq $main::mycall) {
$via ||= $u if ($dxchan = DXChannel::get($u));
}
$via ||= $self->{'-via'} || $self->{to};