Modern UI contract: mailbox messages and news.update

The news read carries the desk manager's mailbox as the contract's
messages with ids that survive the original's compaction. news.update
marks a message read or unread, moves it to the trash and back (saved
marks; the message stays in the original mailbox) and archives it as the
original's keep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-29 09:16:57 +01:00
1 parent c361dccd34
commit 179cd970ad
6 files changed
+139 -2

No files matched your search

+13
View File
@@ -174,6 +174,15 @@ void save_world_career(const std::filesystem::path& path, const World& world, co
{"traffic_scale", int64_t(state.traffic_scale)},
{"press", press_json(state.press)},
{"press_serial", int64_t(state.press_serial)},
{"news_marks", [&] {
O managers;
for (const auto& [manager, marks] : state.news_marks) {
O m;
for (const auto& [message, flags] : marks) m[message] = int(flags);
managers[manager] = std::move(m);
}
return J(std::move(managers));
}()},
{"press_month", int64_t(state.press_month)},
{"press_month_cash", [&] { A a; for (int64_t v : state.press_month_cash) a.push_back(v); return J(std::move(a)); }()},
{"career_end_reason", state.career_end_reason},
@@ -239,6 +248,10 @@ SavedWorldCareer load_world_career(const std::filesystem::path& path, const Worl
out.state.press = press_json(get(modern, "press"));
out.state.press_serial = uint32_t(num(get(modern, "press_serial")));
}
if (const auto it = o->find("news_marks"); it != o->end() && it->second.object())
for (const auto& [manager, marks] : *it->second.object())
if (marks.object())
for (const auto& [message, flags] : *marks.object()) out.state.news_marks[manager][message] = uint8_t(num(flags));
if (o->count("press_month")) {
out.state.press_month = uint32_t(num(get(modern, "press_month")));
for (const J& v : arr(get(modern, "press_month_cash"))) out.state.press_month_cash.push_back(int64_t(num(v)));