use DXUtil;
use DXM;
-use Carp;
+use DXDebug;
use strict;
sub pc10
{
my ($from, $to, $via, $text) = @_;
- my $user2 = $via ? $to : ' ';
- my $user1 = $via ? $via : $to;
+ my ($user1, $user2);
+ if ($via && $via ne $to) {
+ $user1 = $via;
+ $user2 = $to;
+ } else {
+ $user2 = ' ';
+ $user1 = $to;
+ }
$text = unpad($text);
- $text = ' ' if !$text;
+ $text = ' ' unless $text && length $text > 0;
+ $text =~ s/\^/%5E/g;
return "PC10^$from^$user1^$text^*^$user2^$main::mycall^~";
}
my $hops = get_hops(11);
my $t = time;
$text = ' ' if !$text;
- return sprintf "PC11^%.1f^$dxcall^%s^%s^$text^$mycall^$hops^~", $freq, cldate($t), ztime($t);
+ $text =~ s/\^/%5E/g;
+ return sprintf "PC11^%.1f^$dxcall^%s^%s^$text^$mycall^$main::mycall^$hops^~", $freq, cldate($t), ztime($t);
}
# create an announce message
$text = ' ' if !$text;
$wx = '0' if !$wx;
$tonode = '*' if !$tonode;
+ $text =~ s/\^/%5E/g;
return "PC12^$call^$tonode^$text^$sysop^$main::mycall^$wx^$hops^~";
}
# Request init string
sub pc18
{
- my $info = DXCluster::cluster;
- return "PC18^$info^$DXProt::myprot_version^~";
+ return "PC18^DXSpider Version: $main::version Build: $main::build^$DXProt::myprot_version^";
}
#
return "PC24^$call^$flag^$hops^";
}
+
+# create a merged dx message (freq, dxcall, t, text, spotter, orig-node)
+sub pc26
+{
+ my ($freq, $dxcall, $t, $text, $spotter, $orignode) = @_;
+ $text = ' ' unless $text;
+ $orignode = $main::mycall unless $orignode;
+ return sprintf "PC26^%.1f^$dxcall^%s^%s^$text^$spotter^$orignode^ ^~", $freq, cldate($t), ztime($t);
+}
+
+# create a merged WWV spot (logger, t, sfi, a, k, forecast, orig-node)
+sub pc27
+{
+ my ($logger, $t, $sfi, $a, $k, $forecast, $orignode) = @_;
+ return sprintf "PC27^%s^%-2.2s^$sfi^$a^$k^$forecast^$logger^$orignode^ ^~", cldate($t), ztime($t);
+}
+
# message start (fromnode, tonode, to, from, t, private, subject, origin)
sub pc28
{
sub pc29
{
my ($fromnode, $tonode, $stream, $text) = @_;
- $text =~ s/\^//og; # remove ^
+ $text = ' ' unless $text && length $text > 0;
+ $text =~ s/\^/%5E/og; # remove ^
return "PC29^$fromnode^$tonode^$stream^$text^~";
}
# send all the DX clusters I reckon are connected
sub pc38
{
- my @list = DXNode->get_all();
- my $list;
- my @nodes;
-
- foreach $list (@list) {
- push @nodes, $list->call;
- }
+ my @nodes = map { ($_->dxchan && $_->dxchan->isolate) ? () : $_->call } DXNode->get_all();
return "PC38^" . join(',', @nodes) . "^~";
}
return "PC42^$fromnode^$tonode^$stream^";
}
+# remote db request
+sub pc44
+{
+ my ($fromnode, $tonode, $stream, $db, $req, $call) = @_;
+ $db = uc $db;
+ return "PC44^$tonode^$fromnode^$stream^$db^$req^$call^";
+}
+
+# remote db data
+sub pc45
+{
+ my ($fromnode, $tonode, $stream, $data) = @_;
+ return "PC45^$tonode^$fromnode^$stream^$data^";
+}
+
+# remote db data complete
+sub pc46
+{
+ my ($fromnode, $tonode, $stream) = @_;
+ return "PC46^$tonode^$fromnode^$stream^";
+}
+
# bull delete
sub pc49
{
# periodic update of users, plus keep link alive device (always H99)
sub pc50
{
- my $me = DXCluster->get_exact($main::mycall);
- my $n = $me->users ? $me->users : '0';
+ my $n = shift;
+ $n = 0 unless $n >= 0;
return "PC50^$main::mycall^$n^H99^";
}
my ($to, $from, $val) = @_;
return "PC51^$to^$from^$val^";
}
+
+# clx remote cmd send
+sub pc84
+{
+ my($fromnode, $tonode, $call, $msg) = @_;
+ return "PC84^$tonode^$fromnode^$call^$msg^~";
+}
+
+# clx remote cmd reply
+sub pc85
+{
+ my($fromnode, $tonode, $call, $msg) = @_;
+ return "PC85^$tonode^$fromnode^$call^$msg^~";
+}
+
1;
__END__
+
+
+