fix: autocall in remote not working properly
This commit is contained in:
@@ -4207,13 +4207,30 @@ func (a *App) saveQSORecording(q *qso.QSO) {
|
||||
return
|
||||
}
|
||||
applog.Printf("qso-rec: saved %s", path)
|
||||
// Auto-send the recording once the file exists.
|
||||
if es, _ := a.GetEmailSettings(); es.Enabled && es.AutoSend && strings.TrimSpace(qc.Email) != "" {
|
||||
_ = a.sendRecordingEmail(qc, path)
|
||||
// Auto-send the recording once the file exists. Give the operator visible
|
||||
// feedback either way — silently skipping (no e-mail known) was confusing.
|
||||
if es, _ := a.GetEmailSettings(); es.Enabled && es.AutoSend {
|
||||
if strings.TrimSpace(qc.Email) == "" {
|
||||
applog.Printf("qso-rec: %s not e-mailed — no recipient address known", qc.Callsign)
|
||||
a.toast(fmt.Sprintf("Recording saved — no e-mail for %s, not sent", qc.Callsign))
|
||||
} else if err := a.sendRecordingEmail(qc, path); err != nil {
|
||||
a.toast(fmt.Sprintf("Recording e-mail to %s failed", qc.Callsign))
|
||||
} else {
|
||||
a.toast(fmt.Sprintf("Recording e-mailed to %s", qc.Callsign))
|
||||
a.markRecordingSent(qc.ID)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// toast emits a transient message the frontend shows as a toast notification.
|
||||
// Used for background events (auto-send results) the UI can't otherwise surface.
|
||||
func (a *App) toast(msg string) {
|
||||
if a.ctx != nil {
|
||||
wruntime.EventsEmit(a.ctx, "toast", msg)
|
||||
}
|
||||
}
|
||||
|
||||
// sanitizeFilename makes a callsign safe for a filename (slashes etc.).
|
||||
func sanitizeFilename(s string) string {
|
||||
s = strings.ToUpper(strings.TrimSpace(s))
|
||||
@@ -4687,6 +4704,28 @@ func (a *App) fillTemplate(tmpl string, q qso.QSO) string {
|
||||
return r.Replace(tmpl)
|
||||
}
|
||||
|
||||
// markRecordingSent stamps the QSO so the UI (and the operator) knows its audio
|
||||
// recording was e-mailed — exposed as the APP_OPSLOG_RECORDING_SENT extra and a
|
||||
// "Recording sent" column in Recent QSOs. Re-reads the row first so a concurrent
|
||||
// status update (eQSL/upload) isn't clobbered by writing back the whole row.
|
||||
func (a *App) markRecordingSent(id int64) {
|
||||
if a.qso == nil || id == 0 {
|
||||
return
|
||||
}
|
||||
q, err := a.qso.GetByID(a.ctx, id)
|
||||
if err != nil {
|
||||
applog.Printf("qso-rec: mark sent: load %d: %v", id, err)
|
||||
return
|
||||
}
|
||||
if q.Extras == nil {
|
||||
q.Extras = map[string]string{}
|
||||
}
|
||||
q.Extras["APP_OPSLOG_RECORDING_SENT"] = time.Now().UTC().Format("2006-01-02")
|
||||
if err := a.qso.Update(a.ctx, q); err != nil {
|
||||
applog.Printf("qso-rec: mark sent: update %d: %v", id, err)
|
||||
}
|
||||
}
|
||||
|
||||
// sendRecordingEmail e-mails a QSO recording to the contacted operator.
|
||||
func (a *App) sendRecordingEmail(q qso.QSO, attachPath string) error {
|
||||
s, _ := a.GetEmailSettings()
|
||||
@@ -4732,7 +4771,11 @@ func (a *App) SendQSORecordingEmail(id int64) error {
|
||||
if _, e := os.Stat(path); e != nil {
|
||||
return fmt.Errorf("recording file missing: %s", name)
|
||||
}
|
||||
return a.sendRecordingEmail(q, path)
|
||||
if err := a.sendRecordingEmail(q, path); err != nil {
|
||||
return err
|
||||
}
|
||||
a.markRecordingSent(id)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ── ClubLog Country File (cty.xml) exceptions ─────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user