fix(udp): ignore N0CALL, and stop returning a grid as a callsign

N0CALL is what WSJT-X transmits under when its owner never set a callsign. It
has a letter, a digit and an ordinary shape, so nothing rejected it: it was
spotted, coloured, counted as a new WPX prefix, and now that CQ grids are read
it would have put a grid into the worked index under a callsign nobody holds.

The obvious fix - adding it to looksLikeCall's reject list - was wrong, and the
test caught it before it shipped. That function answers "could this token be a
callsign at all", and the CQ grammar uses it to decide whether the word after CQ
is a modifier (DX, NA, a zone) or the call itself. Teaching it that N0CALL is
not a callsign made "CQ N0CALL JN36" skip a slot and return JN36. Shape and
policy are different questions and now live in different functions.

Chasing that turned up the real defect behind it: ANY unrecognised word after CQ
made the parser skip a slot, and a four-character grid passes every shape test a
callsign does. "CQ FOO JN36" returned JN36 as the sender - logged, spotted and
coloured as a station. A grid in the callsign slot is now refused outright.
This commit is contained in:
2026-08-10 21:51:49 +02:00
parent 6969560efb
commit 55879809f2
5 changed files with 72 additions and 29 deletions
@@ -24,6 +24,14 @@ func TestWSJTSender(t *testing.T) {
{"CQ K1ABC FN42AB", "K1ABC", true, ""}, // 6-char: WSJT-X never sends it here
{"CQ K1ABC 73", "K1ABC", true, ""}, // bare sign-off
{"CQ K1ABC SS42", "K1ABC", true, ""}, // S is past R — no such field
// Placeholder callsigns: WSJT-X's default, from an operator who never set
// their own. A letter and a digit, so nothing else here catches it.
{"CQ N0CALL JN36", "", true, ""},
{"W2XYZ N0CALL -10", "", false, ""},
{"CQ NOCALL JN36", "", true, ""},
// An unknown word after CQ made the parser skip a slot; a grid passes every
// shape test a callsign does, so it came back AS the callsign.
{"CQ FOO JN36", "", true, ""},
// Non-callsign / free text → no sender.
{"TNX 73 GL", "", false, ""},
{"K1ABC RR73", "", false, ""}, // only one call + a token → 2nd token not a call