- my $line = join '^', sprintf("QX%02d", $pcno), $to, $from, @_;
- my $cs = unpack("%32C*", $line) % 255;
- return $line . sprintf("^%02X", $cs);
+ my @f = split /\^/, $_[2];
+ my $inv = Verify->new($f[5]);
+ unless ($inv->verify($main::me->user->passphrase, $f[6], $main::mycall, $self->call)) {
+ $self->sendnow('D','Sorry...');
+ $self->disconnect;
+ }
+ if ($self->{outbound}) {
+ $self->send($self->gen1);
+ }
+ if ($self->{sort} ne 'S' && $f[2] eq 'DXSpider') {
+ $self->{user}->{sort} = $self->{sort} = 'S';
+ $self->{user}->{priv} = $self->{priv} = 1 unless $self->{priv};
+ }
+ $self->{version} = $f[3];
+ $self->{build} = $f[4];
+ $self->state('normal');
+ $self->{lastping} = 0;
+}
+
+sub gen1
+{
+ my $self = shift;
+ my $inp = Verify->new;
+ return frame(1, 1, "DXSpider", $main::version + 53, $main::build, $inp->challenge, $inp->response($self->user->passphrase, $self->call, $main::mycall));
+}
+
+sub handle2
+{
+
+}
+
+sub gen2
+{
+ my $self = shift;
+
+ my $node = shift;
+ my $sort = shift;
+ my @out;
+ my $dxchan;
+
+ while (@_) {
+ my $str = '';
+ for (; @_ && length $str <= 230;) {
+ my $ref = shift;
+ my $call = $ref->call;
+ my $flag = 0;
+
+ $flag += 1 if $ref->here;
+ $flag += 2 if $ref->conf;
+ if ($ref->is_node) {
+ my $ping = int($ref->pingave * 10);
+ $str .= "^N$flag$call,$ping";
+ my $v = $ref->build || $ref->version;
+ $str .= ",$v" if defined $v;
+ } else {
+ $str .= "^U$flag$call";
+ }
+ }
+ push @out, $str if $str;
+ }
+ my $n = @out;
+ my $h = get_hops(90);
+ @out = map { sprintf "PC90^%s^%X^%s%d%s^%s^", $node->call, $main::systime, $sort, --$n, $_, $h } @out;
+ return @out;