chore: release v0.26.2
This commit is contained in:
@@ -372,8 +372,29 @@ func ParseWSJT(pkt []byte) (WSJTEvent, bool, error) {
|
||||
// third slot, never a locator.
|
||||
//
|
||||
// Returns "" for free-text / telemetry / hashed-call messages we can't resolve.
|
||||
// unbracket strips the angle brackets FT8 puts around a HASHED callsign.
|
||||
//
|
||||
// A compound or non-standard call does not fit in a 77-bit message, so the
|
||||
// protocol sends a hash of it and the receiving software prints what it
|
||||
// resolved between angle brackets: "F4BPO <ZA/IW2JOP> -24". The brackets are
|
||||
// notation, not part of the callsign — but every character test here rejected
|
||||
// them, so the whole decode was thrown away as unparseable. Every reply from a
|
||||
// station with a compound call was invisible: precisely the stations worth
|
||||
// seeing, and precisely the message that says one of them answered you.
|
||||
func unbracket(s string) string {
|
||||
return strings.TrimSuffix(strings.TrimPrefix(s, "<"), ">")
|
||||
}
|
||||
|
||||
func wsjtSender(message string) (call string, isCQ bool, grid string) {
|
||||
f := strings.Fields(strings.ToUpper(strings.TrimSpace(message)))
|
||||
msg := strings.ToUpper(strings.TrimSpace(message))
|
||||
// The compound form — "OK1UA RR73; DH1HRN <ZA/IW2JOP> -08" — is one station
|
||||
// signing off with another while answering a third. The sender is in the
|
||||
// part AFTER the semicolon; reading the line from the left names OK1UA, who
|
||||
// did not send it.
|
||||
if i := strings.LastIndexByte(msg, ';'); i >= 0 {
|
||||
msg = strings.TrimSpace(msg[i+1:])
|
||||
}
|
||||
f := strings.Fields(msg)
|
||||
if len(f) == 0 {
|
||||
return "", false, ""
|
||||
}
|
||||
@@ -381,11 +402,11 @@ func wsjtSender(message string) (call string, isCQ bool, grid string) {
|
||||
// Skip an optional modifier after CQ (DX / a region like NA / a zone like
|
||||
// 020) — it never looks like a callsign (no letter+digit mix).
|
||||
idx := 1
|
||||
if len(f) > 2 && !looksLikeCall(f[1]) {
|
||||
if len(f) > 2 && !looksLikeCall(unbracket(f[1])) {
|
||||
idx = 2
|
||||
}
|
||||
if idx < len(f) {
|
||||
c := f[idx]
|
||||
c := unbracket(f[idx])
|
||||
// A GRID sitting in the callsign slot means the real call was
|
||||
// unparseable and the skip above went one word too far. JN36 has letters
|
||||
// and digits and passes every shape test there is, so without this the
|
||||
@@ -411,11 +432,13 @@ func wsjtSender(message string) (call string, isCQ bool, grid string) {
|
||||
//
|
||||
// isGridField is what keeps the reports and sign-offs out: -05, R-05, RRR,
|
||||
// 73 and RR73 all fail it, on length, charset or by name.
|
||||
if len(f) >= 2 && looksLikeCall(f[1]) {
|
||||
if len(f) >= 3 && isGridField(f[2]) {
|
||||
return f[1], false, f[2]
|
||||
if len(f) >= 2 {
|
||||
if c := unbracket(f[1]); looksLikeCall(c) {
|
||||
if len(f) >= 3 && isGridField(f[2]) {
|
||||
return c, false, f[2]
|
||||
}
|
||||
return c, false, ""
|
||||
}
|
||||
return f[1], false, ""
|
||||
}
|
||||
return "", false, ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user