feat: Winkeyer

This commit is contained in:
2026-06-02 01:17:26 +02:00
parent 2eb77370e4
commit 2b4326b553
26 changed files with 3125 additions and 645 deletions
+19 -4
View File
@@ -27,6 +27,13 @@ type Exporter struct {
// AppName / AppVersion populate the ADIF header comments. Optional.
AppName string
AppVersion string
// IncludeAppFields controls whether application-specific fields (ADIF
// "APP_<programid>_<name>" tags, e.g. Log4OM's APP_LOG4OM_* or our own
// OpsLog extensions) are written. Leave false for a clean standard-ADIF
// export destined for another logger; set true for a full OpsLog→OpsLog
// round-trip that preserves everything.
IncludeAppFields bool
}
// ExportFile creates path (overwriting if it exists) and writes every QSO.
@@ -70,7 +77,7 @@ func (e *Exporter) Export(ctx context.Context, w io.Writer) (int, error) {
count := 0
err := e.Repo.IterateAll(ctx, func(q qso.QSO) error {
writeRecord(bw, q)
writeRecord(bw, q, e.IncludeAppFields)
count++
return nil
})
@@ -84,7 +91,8 @@ func (e *Exporter) Export(ctx context.Context, w io.Writer) (int, error) {
func SingleRecordADIF(q qso.QSO) string {
var b strings.Builder
bw := bufio.NewWriter(&b)
writeRecord(bw, q)
// Uploads target other services — keep it standard (no app-specific tags).
writeRecord(bw, q, false)
bw.Flush()
return b.String()
}
@@ -93,7 +101,7 @@ func SingleRecordADIF(q qso.QSO) string {
// Empty fields are omitted. MODE/SUBMODE are massaged so a "promoted"
// mode (e.g. FT4 stored without a parent) is exported as the canonical
// pair MODE=MFSK SUBMODE=FT4 — round-trips cleanly with strict loggers.
func writeRecord(bw *bufio.Writer, q qso.QSO) {
func writeRecord(bw *bufio.Writer, q qso.QSO, includeApp bool) {
// --- Core ---
writeField(bw, "CALL", q.Callsign)
@@ -218,8 +226,15 @@ func writeRecord(bw *bufio.Writer, q qso.QSO) {
writeField(bw, "NOTES", q.Notes)
// --- Extras (unpromoted ADIF fields preserved verbatim) ---
// In standard mode we drop application-specific tags (APP_*) so the file
// stays portable to other loggers; in full mode they're kept for a
// lossless OpsLog round-trip.
for k, v := range q.Extras {
writeField(bw, strings.ToUpper(k), v)
tag := strings.ToUpper(k)
if !includeApp && strings.HasPrefix(tag, "APP_") {
continue
}
writeField(bw, tag, v)
}
bw.WriteString("<EOR>\n")