aboutsummaryrefslogtreecommitdiffstats
path: root/src/mailsync.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailsync.h')
-rw-r--r--src/mailsync.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mailsync.h b/src/mailsync.h
index f83b526..a826f43 100644
--- a/src/mailsync.h
+++ b/src/mailsync.h
@@ -65,6 +65,17 @@ private:
QString m_status;
};
+/// The outcome of a sync run this process did not start.
+///
+/// Unknown is not a failure, it is the absence of evidence: no log, no marker,
+/// an unreadable file. Callers must treat it as "nothing observed" and change
+/// no state on it, exactly as SyncMonitor::State::Unknown is treated.
+enum class SyncOutcome {
+ Unknown,
+ Ok,
+ Failed,
+};
+
/// Runs the configured external sync command.
///
/// qtmaildir deliberately does not implement sync itself. The existing script
@@ -97,6 +108,23 @@ public:
QString log() const { return m_log; }
+ /// Where assets/mailsync.sh writes its log, unless the config overrides it.
+ static QString defaultLogPath();
+
+ /// Reads the outcome of the last COMPLETED run from \p logPath.
+ ///
+ /// This is how a sync fired by the user's cron is judged: the process that
+ /// ran it is gone and its exit status died with it, but the script writes
+ /// a "RUN END ... status=OK" line before exiting, and that line survives.
+ /// Deriving the outcome from mbsync's own chatter was rejected for the
+ /// reason given on SyncPhaseTracker: a second opinion built from loose text
+ /// matching eventually disagrees with the authoritative one.
+ ///
+ /// Reads a bounded tail, not the file: this runs on the UI thread every
+ /// time a background sync ends, against a file logrotate lets grow all day.
+ /// Anything unreadable, absent or unmarked is Unknown.
+ static SyncOutcome lastRunOutcome(const QString &logPath);
+
signals:
void started();
void outputReceived(const QString &chunk);