feat: added support for eQSL
This commit is contained in:
@@ -116,6 +116,7 @@ func (m *Manager) SetConfig(cfg ExternalServices) {
|
||||
cfg.Clublog = cfg.Clublog.normalised()
|
||||
cfg.LoTW = cfg.LoTW.normalised()
|
||||
cfg.HRDLog = cfg.HRDLog.normalised()
|
||||
cfg.EQSL = cfg.EQSL.normalised()
|
||||
m.cfg = cfg
|
||||
}
|
||||
|
||||
@@ -156,6 +157,10 @@ func (m *Manager) OnQSOLogged(id int64) {
|
||||
if h := cfg.HRDLog; h.AutoUpload && h.Callsign != "" && h.Code != "" {
|
||||
m.route(ServiceHRDLog, id, h)
|
||||
}
|
||||
// eQSL — needs the account username (callsign) + password.
|
||||
if e := cfg.EQSL; e.AutoUpload && e.Username != "" && e.Password != "" {
|
||||
m.route(ServiceEQSL, id, e)
|
||||
}
|
||||
}
|
||||
|
||||
// route sends a logged QSO down the configured timing path: queue it for the
|
||||
@@ -198,6 +203,9 @@ func (m *Manager) onCloseServices() []Service {
|
||||
if h := cfg.HRDLog; h.AutoUpload && h.UploadMode == ModeOnClose && h.Callsign != "" && h.Code != "" {
|
||||
out = append(out, ServiceHRDLog)
|
||||
}
|
||||
if e := cfg.EQSL; e.AutoUpload && e.UploadMode == ModeOnClose && e.Username != "" && e.Password != "" {
|
||||
out = append(out, ServiceEQSL)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -251,6 +259,12 @@ func (m *Manager) FlushOnClose() int {
|
||||
uploaded++
|
||||
}
|
||||
}
|
||||
case ServiceEQSL:
|
||||
for _, id := range ids {
|
||||
if m.upload(svc, id, cfg.EQSL) {
|
||||
uploaded++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return uploaded
|
||||
@@ -319,6 +333,8 @@ func (m *Manager) upload(svc Service, id int64, cfg ServiceConfig) bool {
|
||||
owner = cfg.ForceStationCallsign
|
||||
case ServiceClublog, ServiceHRDLog:
|
||||
owner = cfg.Callsign
|
||||
case ServiceEQSL:
|
||||
owner = cfg.Username
|
||||
}
|
||||
if owner != "" && m.deps.StationCallOf != nil {
|
||||
qcall := m.deps.StationCallOf(id)
|
||||
@@ -374,6 +390,15 @@ func (m *Manager) upload(svc Service, id int64, cfg ServiceConfig) bool {
|
||||
return false
|
||||
}
|
||||
res, err = UploadHRDLog(ctx, m.deps.Client, cfg.Callsign, cfg.Code, record)
|
||||
case ServiceEQSL:
|
||||
// eQSL keeps the QSO's own station call; the account is identified by
|
||||
// the Username + Password, with an optional QTH nickname.
|
||||
record, ok := m.deps.BuildADIF(id, "")
|
||||
if !ok {
|
||||
m.logf("extsvc: %s upload of QSO %d skipped (no record)", svc, id)
|
||||
return false
|
||||
}
|
||||
res, err = UploadEQSL(ctx, m.deps.Client, cfg.Username, cfg.Password, cfg.QTHNickname, record)
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user