app/core/BackgroundAccountSession.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "app/core/BackgroundAccountSession.h" | ||
| 2 | |||
| 3 | #include "data/CredentialStore.h" | ||
| 4 | #include "data/MailCache.h" | ||
| 5 | #include "data/Models.h" | ||
| 6 | #include "service/ConnectionHealthMonitor.h" | ||
| 7 | #include "service/ImapService.h" | ||
| 8 | |||
| 9 | #include <QLoggingCategory> | ||
| 10 | #include <QPointer> | ||
| 11 | |||
| 12 | #include <algorithm> | ||
| 13 | #include <memory> | ||
| 14 | |||
| 15 | Q_DECLARE_LOGGING_CATEGORY(lcAccountSession) | ||
| 16 | |||
| 17 | namespace { | ||
| 18 | // F-50: the production credential resolution — one keyring interaction per | ||
| 19 | // staggered start, never a burst. | ||
| 20 | ✗ | void resolveViaKeyring(std::vector<AccountConfig> &accounts, std::function<void()> done) { | |
| 21 | ✗ | auto *store = new CredentialStore; | |
| 22 | ✗ | AccountConfigLoader::resolvePasswords(accounts, store, [store, done] { | |
| 23 | ✗ | store->deleteLater(); | |
| 24 | ✗ | done(); | |
| 25 | ✗ | }); | |
| 26 | ✗ | } | |
| 27 | } // namespace | ||
| 28 | |||
| 29 | 861 | BackgroundAccountSession::BackgroundAccountSession(Deps deps, QObject *parent) | |
| 30 |
1/1✓ Branch 6 → 7 taken 861 times.
|
861 | : QObject(parent), m_deps(std::move(deps)) { |
| 31 |
2/2✓ Branch 8 → 9 taken 854 times.
✓ Branch 8 → 10 taken 7 times.
|
861 | if (!m_deps.resolveCredentials) m_deps.resolveCredentials = resolveViaKeyring; |
| 32 |
1/1✓ Branch 10 → 11 taken 861 times.
|
861 | m_pollTimer.setInterval(m_deps.pollIntervalMs); |
| 33 |
1/1✓ Branch 11 → 12 taken 861 times.
|
861 | connect(&m_pollTimer, &QTimer::timeout, this, [this] { |
| 34 | ✗ | if (!m_networkEnabled && m_deps.networkEnabled && !m_deps.networkEnabled()) return; | |
| 35 | ✗ | for (auto it = m_watches.begin(); it != m_watches.end(); ++it) | |
| 36 | ✗ | if (it->ready) pollWatch(it.key(), it.value()); | |
| 37 | }); | ||
| 38 | 861 | } | |
| 39 | |||
| 40 | 1715 | BackgroundAccountSession::~BackgroundAccountSession() { | |
| 41 | // Services and monitors are children of this object, but their timers | ||
| 42 | // (reconnect backoff, probes) must not fire after the member hash is | ||
| 43 | // gone: stop every watch before the members go. | ||
| 44 | 861 | const auto ids = m_watches.keys(); | |
| 45 |
2/2✓ Branch 9 → 5 taken 6 times.
✓ Branch 9 → 10 taken 861 times.
|
867 | for (const QString &id : ids) stopWatch(id); |
| 46 | 1715 | } | |
| 47 | |||
| 48 | 874 | void BackgroundAccountSession::onAccountsLoaded() { | |
| 49 | 874 | ++m_epoch; | |
| 50 | 874 | reconcile(); | |
| 51 | 874 | } | |
| 52 | |||
| 53 | 9 | void BackgroundAccountSession::onConfigurationChanged(const QString &id) { | |
| 54 | // A saved account may have a new server or password: restart its watch. | ||
| 55 | 9 | ++m_epoch; | |
| 56 | 9 | stopWatch(id); | |
| 57 | 9 | reconcile(); | |
| 58 | 9 | } | |
| 59 | |||
| 60 | 12 | void BackgroundAccountSession::onConfigurationRemoved(const QString &id) { | |
| 61 | 12 | ++m_epoch; | |
| 62 | 12 | stopWatch(id); | |
| 63 | 12 | } | |
| 64 | |||
| 65 | 875 | void BackgroundAccountSession::setNetworkEnabled(bool enabled) { | |
| 66 | 875 | m_networkEnabled = enabled; | |
| 67 |
2/2✓ Branch 2 → 3 taken 845 times.
✓ Branch 2 → 13 taken 30 times.
|
875 | if (!enabled) { |
| 68 | 845 | ++m_epoch; | |
| 69 |
1/1✓ Branch 3 → 4 taken 845 times.
|
845 | const auto ids = m_watches.keys(); |
| 70 |
3/3✓ Branch 7 → 8 taken 1 time.
✓ Branch 10 → 6 taken 1 time.
✓ Branch 10 → 11 taken 845 times.
|
846 | for (const QString &id : ids) stopWatch(id); |
| 71 | 845 | } else { | |
| 72 | 30 | reconcile(); | |
| 73 | } | ||
| 74 | 875 | } | |
| 75 | |||
| 76 | 913 | void BackgroundAccountSession::reconcile() { | |
| 77 | const QString selected = | ||
| 78 |
2/3✓ Branch 3 → 4 taken 913 times.
✗ Branch 3 → 5 not taken.
✓ Branch 4 → 6 taken 913 times.
|
913 | m_deps.selectedAccountId ? m_deps.selectedAccountId() : QString(); |
| 79 | const auto configs = | ||
| 80 |
2/3✓ Branch 7 → 8 taken 913 times.
✗ Branch 7 → 9 not taken.
✓ Branch 8 → 10 taken 913 times.
|
913 | m_deps.configurations ? m_deps.configurations() : std::vector<AccountConfig>{}; |
| 81 | |||
| 82 | // Stop the watches of removed accounts and of the now-selected account: | ||
| 83 | // its own primary connection (plus search/body secondaries) takes over. | ||
| 84 |
1/1✓ Branch 10 → 11 taken 913 times.
|
913 | const auto ids = m_watches.keys(); |
| 85 |
2/2✓ Branch 26 → 13 taken 1 time.
✓ Branch 26 → 27 taken 913 times.
|
914 | for (const QString &id : ids) { |
| 86 | const bool stillThere = | ||
| 87 |
1/1✓ Branch 16 → 17 taken 1 time.
|
1 | std::any_of(configs.begin(), configs.end(), |
| 88 | 2 | [&id](const AccountConfig &account) { return account.id == id; }); | |
| 89 |
4/7✓ Branch 17 → 18 taken 1 time.
✗ Branch 17 → 20 not taken.
✓ Branch 19 → 20 taken 1 time.
✗ Branch 19 → 21 not taken.
✓ Branch 22 → 23 taken 1 time.
✗ Branch 22 → 24 not taken.
✓ Branch 23 → 24 taken 1 time.
|
1 | if (!stillThere || id == selected) stopWatch(id); |
| 90 | } | ||
| 91 | |||
| 92 | // Offline (a reload with networking disabled) stops every watch. | ||
| 93 |
8/9✓ Branch 28 → 29 taken 913 times.
✗ Branch 28 → 31 not taken.
✓ Branch 29 → 30 taken 913 times.
✓ Branch 30 → 31 taken 60 times.
✓ Branch 30 → 32 taken 853 times.
✓ Branch 31 → 32 taken 21 times.
✓ Branch 31 → 33 taken 39 times.
✓ Branch 34 → 35 taken 874 times.
✓ Branch 34 → 45 taken 39 times.
|
913 | if ((m_deps.networkEnabled && !m_deps.networkEnabled()) || !m_networkEnabled) { |
| 94 |
1/1✓ Branch 35 → 36 taken 874 times.
|
874 | const auto stopIds = m_watches.keys(); |
| 95 |
1/3✗ Branch 39 → 40 not taken.
✗ Branch 42 → 38 not taken.
✓ Branch 42 → 43 taken 874 times.
|
874 | for (const QString &id : stopIds) stopWatch(id); |
| 96 | 874 | return; | |
| 97 | 874 | } | |
| 98 | |||
| 99 | // Start the missing watches, staggered — never a burst, and the first | ||
| 100 | // connect sits startDelayMs after the session loaded, off the startup | ||
| 101 | // critical path (D-11). | ||
| 102 | 39 | int index = 0; | |
| 103 |
2/2✓ Branch 63 → 47 taken 64 times.
✓ Branch 63 → 64 taken 39 times.
|
103 | for (const AccountConfig &account : configs) { |
| 104 |
5/6✓ Branch 49 → 50 taken 27 times.
✓ Branch 49 → 52 taken 37 times.
✗ Branch 51 → 52 not taken.
✓ Branch 51 → 53 taken 27 times.
✓ Branch 54 → 55 taken 37 times.
✓ Branch 54 → 56 taken 27 times.
|
64 | if (account.id == selected || m_watches.contains(account.id)) continue; |
| 105 |
1/2✗ Branch 57 → 58 not taken.
✓ Branch 57 → 59 taken 27 times.
|
27 | if (account.imap.host.isEmpty()) continue; |
| 106 | 27 | startWatch(account.id, account, | |
| 107 |
1/1✓ Branch 59 → 60 taken 27 times.
|
27 | m_deps.startDelayMs + index * m_deps.staggerMs); |
| 108 | 27 | ++index; | |
| 109 | } | ||
| 110 | 2661 | } | |
| 111 | |||
| 112 | 27 | void BackgroundAccountSession::startWatch(const QString &accountId, const AccountConfig &config, | |
| 113 | int delayMs) { | ||
| 114 | 27 | const quint64 epoch = m_epoch; | |
| 115 | const QString selectedAtStart = | ||
| 116 |
2/3✓ Branch 3 → 4 taken 27 times.
✗ Branch 3 → 5 not taken.
✓ Branch 4 → 6 taken 27 times.
|
27 | m_deps.selectedAccountId ? m_deps.selectedAccountId() : QString(); |
| 117 |
1/5✓ Branch 9 → 10 taken 27 times.
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 17 not taken.
✗ Branch 18 → 19 not taken.
✗ Branch 18 → 20 not taken.
|
27 | QTimer::singleShot(delayMs, this, [this, accountId, config, epoch, selectedAtStart] { |
| 118 |
5/6✓ Branch 2 → 3 taken 11 times.
✓ Branch 2 → 5 taken 8 times.
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 11 times.
✓ Branch 7 → 8 taken 8 times.
✓ Branch 7 → 9 taken 11 times.
|
19 | if (epoch != m_epoch || m_watches.contains(accountId)) return; // reloaded meanwhile |
| 119 |
1/2✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 11 times.
|
11 | if (!m_deps.configurations) return; |
| 120 |
1/1✓ Branch 12 → 13 taken 11 times.
|
11 | const auto configs = m_deps.configurations(); |
| 121 |
1/1✓ Branch 15 → 16 taken 11 times.
|
11 | const auto stillThere = std::any_of(configs.begin(), configs.end(), |
| 122 | 11 | [&accountId](const AccountConfig &account) { | |
| 123 | 23 | return account.id == accountId; | |
| 124 | }); | ||
| 125 |
3/6✓ Branch 16 → 17 taken 11 times.
✗ Branch 16 → 19 not taken.
✗ Branch 18 → 19 not taken.
✓ Branch 18 → 20 taken 11 times.
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 23 taken 11 times.
|
11 | if (!stillThere || accountId == selectedAtStart) return; |
| 126 | |||
| 127 |
1/1✓ Branch 23 → 24 taken 11 times.
|
11 | auto accounts = std::make_shared<std::vector<AccountConfig>>(1, config); |
| 128 | // S106-191: the keyring answers asynchronously; the session may be gone. | ||
| 129 |
1/1✓ Branch 24 → 25 taken 11 times.
|
11 | const QPointer<BackgroundAccountSession> guard(this); |
| 130 |
2/8✓ Branch 28 → 29 taken 11 times.
✓ Branch 30 → 31 taken 11 times.
✗ Branch 47 → 48 not taken.
✗ Branch 47 → 49 not taken.
✗ Branch 50 → 51 not taken.
✗ Branch 50 → 52 not taken.
✗ Branch 53 → 54 not taken.
✗ Branch 53 → 55 not taken.
|
11 | m_deps.resolveCredentials(*accounts, [this, guard, accountId, accounts, epoch] { |
| 131 |
6/8✓ Branch 3 → 4 taken 10 times.
✓ Branch 3 → 7 taken 1 time.
✓ Branch 4 → 5 taken 10 times.
✗ Branch 4 → 7 not taken.
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 10 times.
✓ Branch 9 → 10 taken 1 time.
✓ Branch 9 → 11 taken 10 times.
|
12 | if (!guard || epoch != m_epoch || m_watches.contains(accountId)) return; |
| 132 | 10 | const AccountConfig &resolved = accounts->front(); | |
| 133 |
2/2✓ Branch 14 → 15 taken 1 time.
✓ Branch 14 → 34 taken 9 times.
|
10 | if (resolved.imap.password.isEmpty()) { |
| 134 | // One account without a keyring entry disables only its own watch. | ||
| 135 |
6/6✓ Branch 15 → 16 taken 1 time.
✓ Branch 19 → 20 taken 1 time.
✓ Branch 20 → 21 taken 1 time.
✓ Branch 21 → 22 taken 1 time.
✓ Branch 26 → 17 taken 1 time.
✓ Branch 26 → 27 taken 1 time.
|
2 | qCWarning(lcAccountSession) << "Background watch of" << accountId |
| 136 |
1/1✓ Branch 22 → 23 taken 1 time.
|
1 | << "disabled: no password available"; |
| 137 |
1/1✓ Branch 30 → 31 taken 1 time.
|
2 | emit watchFailed(accountId, QStringLiteral("password")); |
| 138 | 1 | return; | |
| 139 | } | ||
| 140 |
1/1✓ Branch 34 → 35 taken 9 times.
|
9 | Watch watch; |
| 141 | 9 | watch.name = resolved.name; | |
| 142 | 9 | watch.config = resolved.imap; | |
| 143 |
3/6✓ Branch 37 → 38 taken 9 times.
✓ Branch 38 → 39 taken 9 times.
✗ Branch 39 → 40 not taken.
✓ Branch 39 → 41 taken 9 times.
✗ Branch 88 → 89 not taken.
✗ Branch 88 → 90 not taken.
|
9 | auto *service = new ImapService(this); |
| 144 | // The search connection's secondary pattern: a monitor without the | ||
| 145 | // system-wide hooks reacts to probes and state changes and reconnects | ||
| 146 | // after TLS drops and suspends (T-720). | ||
| 147 |
3/6✓ Branch 41 → 42 taken 9 times.
✓ Branch 42 → 43 taken 9 times.
✗ Branch 43 → 44 not taken.
✓ Branch 43 → 45 taken 9 times.
✗ Branch 91 → 92 not taken.
✗ Branch 91 → 93 not taken.
|
9 | auto *monitor = new ConnectionHealthMonitor(false, this); |
| 148 |
1/1✓ Branch 45 → 46 taken 9 times.
|
9 | monitor->attach(service); |
| 149 |
1/1✓ Branch 46 → 47 taken 9 times.
|
9 | monitor->setReconnectConfig(watch.config); |
| 150 |
1/1✓ Branch 47 → 48 taken 9 times.
|
9 | monitor->setActive(true); |
| 151 | 9 | watch.service = service; | |
| 152 | 9 | watch.monitor = monitor; | |
| 153 |
1/1✓ Branch 49 → 50 taken 9 times.
|
9 | connect(service, &ImapService::stateChanged, this, |
| 154 | 26 | [this, accountId](ImapService::State state) { onStateChanged(accountId, state); }); | |
| 155 |
1/1✓ Branch 53 → 54 taken 9 times.
|
9 | connect(service, &ImapService::folderStatusReceived, this, |
| 156 | 18 | [this, accountId](const StatusResult &result) { | |
| 157 | 1 | onFolderStatus(accountId, result); | |
| 158 | 1 | }); | |
| 159 |
1/1✓ Branch 57 → 58 taken 9 times.
|
9 | m_watches.insert(accountId, std::move(watch)); |
| 160 |
3/3✓ Branch 58 → 59 taken 1 time.
✓ Branch 58 → 60 taken 8 times.
✓ Branch 59 → 60 taken 1 time.
|
9 | if (m_deps.connectToServer) service->connectToServer(resolved.imap); |
| 161 |
7/7✓ Branch 60 → 61 taken 9 times.
✓ Branch 64 → 65 taken 9 times.
✓ Branch 65 → 66 taken 9 times.
✓ Branch 66 → 67 taken 9 times.
✓ Branch 67 → 68 taken 9 times.
✓ Branch 72 → 62 taken 9 times.
✓ Branch 72 → 73 taken 9 times.
|
18 | qCInfo(lcAccountSession) << "Background watch of" << accountId << "connecting to" |
| 162 |
1/1✓ Branch 68 → 69 taken 9 times.
|
9 | << resolved.imap.host; |
| 163 | 9 | }); | |
| 164 |
1/2✓ Branch 37 → 38 taken 11 times.
✗ Branch 37 → 40 not taken.
|
11 | }); |
| 165 | 27 | } | |
| 166 | |||
| 167 | 29 | void BackgroundAccountSession::stopWatch(const QString &accountId) { | |
| 168 |
1/1✓ Branch 2 → 3 taken 29 times.
|
29 | auto it = m_watches.find(accountId); |
| 169 |
2/2✓ Branch 5 → 6 taken 20 times.
✓ Branch 5 → 7 taken 9 times.
|
29 | if (it == m_watches.end()) return; |
| 170 |
1/2✓ Branch 8 → 9 taken 9 times.
✗ Branch 8 → 16 not taken.
|
9 | if (it->monitor) { |
| 171 |
1/1✓ Branch 10 → 11 taken 9 times.
|
9 | it->monitor->setActive(false); |
| 172 |
1/1✓ Branch 12 → 13 taken 9 times.
|
9 | it->monitor->detach(); |
| 173 |
1/2✓ Branch 14 → 15 taken 9 times.
✗ Branch 14 → 16 not taken.
|
9 | delete it->monitor; // a child of this object; direct delete stops its timers |
| 174 | } | ||
| 175 |
1/2✓ Branch 17 → 18 taken 9 times.
✗ Branch 17 → 23 not taken.
|
9 | if (it->service) { |
| 176 |
1/1✓ Branch 19 → 20 taken 9 times.
|
9 | it->service->disconnect(ImapService::DisconnectReason::AccountReload); |
| 177 |
1/2✓ Branch 21 → 22 taken 9 times.
✗ Branch 21 → 23 not taken.
|
9 | delete it->service; |
| 178 | } | ||
| 179 |
1/1✓ Branch 24 → 25 taken 9 times.
|
9 | m_watches.erase(it); |
| 180 |
7/7✓ Branch 25 → 26 taken 9 times.
✓ Branch 29 → 30 taken 9 times.
✓ Branch 30 → 31 taken 9 times.
✓ Branch 31 → 32 taken 9 times.
✓ Branch 32 → 33 taken 9 times.
✓ Branch 36 → 27 taken 9 times.
✓ Branch 36 → 37 taken 9 times.
|
18 | qCInfo(lcAccountSession) << "Background watch of" << accountId << "stopped"; |
| 181 | } | ||
| 182 | |||
| 183 | 9 | void BackgroundAccountSession::onStateChanged(const QString &accountId, ImapService::State state) { | |
| 184 |
1/1✓ Branch 2 → 3 taken 9 times.
|
9 | auto it = m_watches.find(accountId); |
| 185 |
1/2✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 9 times.
|
9 | if (it == m_watches.end()) return; |
| 186 |
5/6✓ Branch 7 → 8 taken 7 times.
✓ Branch 7 → 9 taken 2 times.
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 12 taken 7 times.
✓ Branch 13 → 14 taken 2 times.
✓ Branch 13 → 20 taken 7 times.
|
11 | if ((state == ImapService::State::Authenticated || state == ImapService::State::Selected) && |
| 187 |
1/2✓ Branch 10 → 11 taken 2 times.
✗ Branch 10 → 12 not taken.
|
2 | !it->ready) { |
| 188 | 2 | it->ready = true; | |
| 189 | // The first round fills the badges at once; later rounds ride the timer. | ||
| 190 |
1/1✓ Branch 16 → 17 taken 2 times.
|
2 | pollWatch(accountId, it.value()); |
| 191 |
3/4✓ Branch 17 → 18 taken 2 times.
✓ Branch 18 → 19 taken 2 times.
✗ Branch 18 → 20 not taken.
✓ Branch 19 → 20 taken 2 times.
|
2 | if (!m_pollTimer.isActive()) m_pollTimer.start(); |
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | 2 | void BackgroundAccountSession::pollNow(const QString &accountId) { | |
| 196 |
1/1✓ Branch 2 → 3 taken 2 times.
|
2 | auto it = m_watches.find(accountId); |
| 197 |
2/3✓ Branch 5 → 6 taken 2 times.
✗ Branch 5 → 8 not taken.
✓ Branch 7 → 8 taken 2 times.
|
2 | if (it != m_watches.end()) pollWatch(accountId, it.value()); |
| 198 | 2 | } | |
| 199 | |||
| 200 | 4 | void BackgroundAccountSession::pollWatch(const QString &accountId, Watch &watch) { | |
| 201 | Q_UNUSED(accountId); | ||
| 202 |
2/4✓ Branch 2 → 3 taken 4 times.
✗ Branch 2 → 4 not taken.
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 4 times.
|
4 | if (!watch.service || !watch.ready) return; |
| 203 |
2/2✓ Branch 6 → 7 taken 2 times.
✓ Branch 6 → 41 taken 2 times.
|
4 | if (watch.folders.isEmpty()) { |
| 204 | // The folders the account had locally when the watch began; a folder | ||
| 205 | // list refresh belongs to the selected account's sync. | ||
| 206 | 2 | QString error; | |
| 207 |
1/1✓ Branch 7 → 8 taken 2 times.
|
2 | const auto all = m_deps.cache->allFolderPaths(watch.name, &error); |
| 208 |
1/1✓ Branch 8 → 9 taken 2 times.
|
2 | watch.folders = all.mid(0, m_deps.maxFolders); |
| 209 |
1/2✗ Branch 12 → 13 not taken.
✓ Branch 12 → 27 taken 2 times.
|
2 | if (!error.isEmpty()) |
| 210 | ✗ | qCWarning(lcAccountSession) << "Background folder list of" << watch.name << ":" << error; | |
| 211 | // An account never opened here has no local folders yet: its INBOX | ||
| 212 | // (RFC 3501: every account has one) still gets its badge and arrivals. | ||
| 213 |
4/6✓ Branch 28 → 29 taken 1 time.
✓ Branch 28 → 38 taken 1 time.
✓ Branch 34 → 35 taken 1 time.
✓ Branch 34 → 36 taken 1 time.
✗ Branch 58 → 59 not taken.
✗ Branch 58 → 60 not taken.
|
4 | if (watch.folders.isEmpty()) watch.folders = {QStringLiteral("INBOX")}; |
| 214 | 2 | } | |
| 215 |
3/3✓ Branch 45 → 46 taken 6 times.
✓ Branch 48 → 44 taken 6 times.
✓ Branch 48 → 49 taken 4 times.
|
10 | for (const QString &folder : std::as_const(watch.folders)) watch.service->statusFolder(folder); |
| 216 | 2 | } | |
| 217 | |||
| 218 | 4 | void BackgroundAccountSession::onFolderStatus(const QString &accountId, const StatusResult &result) { | |
| 219 |
1/1✓ Branch 2 → 3 taken 4 times.
|
4 | auto it = m_watches.find(accountId); |
| 220 |
5/6✓ Branch 5 → 6 taken 3 times.
✓ Branch 5 → 7 taken 1 time.
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 3 times.
✓ Branch 9 → 10 taken 1 time.
✓ Branch 9 → 11 taken 3 times.
|
4 | if (it == m_watches.end() || !result.hasUnseen) return; |
| 221 |
1/1✓ Branch 12 → 13 taken 3 times.
|
3 | const qint64 folderId = m_deps.cache->ensureFolder(it->name, result.folderPath); |
| 222 |
1/1✓ Branch 13 → 14 taken 3 times.
|
3 | m_deps.cache->storeBadge(folderId, result.unseen); |
| 223 |
1/1✓ Branch 15 → 16 taken 3 times.
|
3 | emit backgroundUnreadChanged(accountId, it->name, result.folderPath, result.unseen); |
| 224 | } | ||
| 225 | |||
| 226 | 8 | bool BackgroundAccountSession::isReady(const QString &accountId) const { | |
| 227 | 8 | const auto it = m_watches.constFind(accountId); | |
| 228 |
3/4✓ Branch 5 → 6 taken 8 times.
✗ Branch 5 → 9 not taken.
✓ Branch 7 → 8 taken 4 times.
✓ Branch 7 → 9 taken 4 times.
|
8 | return it != m_watches.constEnd() && it->ready; |
| 229 | } | ||
| 230 | |||
| 231 | 1 | ImapService *BackgroundAccountSession::serviceForTests(const QString &accountId) const { | |
| 232 | 1 | const auto it = m_watches.constFind(accountId); | |
| 233 |
1/2✓ Branch 5 → 6 taken 1 time.
✗ Branch 5 → 8 not taken.
|
1 | return it != m_watches.constEnd() ? it->service : nullptr; |
| 234 | } | ||
| 235 |