X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProtout.pm;h=f08fef492bbfff7afd364cf1cf2c290593380494;hb=598233c22daef138cd7b0a653d3165b4a16905e2;hp=180ce526ef17357c67d474bc45c34b9994e0b368;hpb=22df46c61d3f1ae4115224bcc230ffe7ed6aff99;p=spider.git diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index 180ce526..f08fef49 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -66,14 +66,15 @@ sub pc11 # create an announce message sub pc12 { - my ($call, $text, $tonode, $sysop, $wx) = @_; + my ($call, $text, $tonode, $sysop, $wx, $origin) = @_; my $hops = get_hops(12); - $sysop = ' ' if !$sysop; - $text = ' ' if !$text; - $wx = '0' if !$wx; - $tonode = '*' if !$tonode; + $origin ||= $main::mycall; + $sysop ||= ' '; + $text ||= ' '; + $wx ||= '0'; + $tonode ||= '*'; $text =~ s/\^/%5E/g; - return "PC12^$call^$tonode^$text^$sysop^$main::mycall^$wx^$hops^~"; + return "PC12^$call^$tonode^$text^$sysop^$origin^$wx^$hops^~"; } # @@ -122,7 +123,7 @@ sub pc17 # Request init string sub pc18 { - return "PC18^DXSpider Version: $main::version Build: $main::build^$DXProt::myprot_version^"; + return "PC18^DXSpider Version: $main::version Build: $main::build NewRoute^$DXProt::myprot_version^"; } # @@ -357,6 +358,68 @@ sub pc51 return "PC51^$to^$from^$val^"; } +my $hexlasttime = 0; +my $hexlastlet = 'A'; + +sub hexstamp +{ + my $t = shift || $main::systime; + if ($t ne $hexlasttime) { + $hexlasttime = $t; + $hexlastlet = 'A'; + } else { + do { + $hexlastlet = chr(ord($hexlastlet) + 1); + } while ($hexlastlet eq '^'); + } + return sprintf "%c%08X", $hexlastlet, $hexlasttime; +} + +sub pc58 +{ + my $sort = shift; + my $hexstamp = shift || hexstamp(); + my $from = shift; + my $to = shift; + my $text = unpad(shift); + $text = ' ' if !$text; + $text =~ s/\^/%5E/g; + return "PC58^$sort^$hexstamp^$from^$to^$text" . sprintf "^%s^", get_hops(58); +} + +sub pc59 +{ + my @out; + my $sort = shift; + my $hexstamp = shift || hexstamp(); + + my $node = $_[0]->call; + for (@_) { + next unless $_; + my $ref = $_; + my $call = $ref->call; + my $here = $ref->here; + $s .= $ref->isa('Route::Node') ? "^N$here$call" : "^U$here$call"; + } + push @out, "PC59^$sort^$hexstamp^$node^$s" . sprintf "^%s^", get_hops(59); + return @out; +} + +sub PC59c +{ + return PC59('C', @_); +} + +sub PC59a +{ + return PC59('A', @_); +} + +sub PC59d +{ + return PC59('D', @_); +} + # clx remote cmd send sub pc84 {