Make code compile with hidden friends

This commit is contained in:
Nicolas Werner 2022-07-29 04:04:44 +02:00
parent b594242358
commit 3c480d47f1
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
2 changed files with 8 additions and 8 deletions

View File

@ -1207,7 +1207,7 @@ Cache::runMigrations()
break;
mtx::events::collections::TimelineEvent te;
mtx::events::collections::from_json(j["event"], te);
from_json(j["event"], te);
oldMessages.events.push_back(te.data);
}
// messages were stored in reverse order, so we
@ -2201,7 +2201,7 @@ Cache::getTimelineMessages(lmdb::txn &txn, const std::string &room_id, uint64_t
mtx::events::collections::TimelineEvent te;
try {
mtx::events::collections::from_json(nlohmann::json::parse(event), te);
from_json(nlohmann::json::parse(event), te);
} catch (std::exception &e) {
nhlog::db()->error("Failed to parse message from cache {}", e.what());
continue;
@ -2231,7 +2231,7 @@ Cache::getEvent(const std::string &room_id, const std::string &event_id)
mtx::events::collections::TimelineEvent te;
try {
mtx::events::collections::from_json(nlohmann::json::parse(event), te);
from_json(nlohmann::json::parse(event), te);
} catch (std::exception &e) {
nhlog::db()->error("Failed to parse message from cache {}", e.what());
return std::nullopt;
@ -3177,7 +3177,7 @@ Cache::firstPendingMessage(const std::string &room_id)
try {
mtx::events::collections::TimelineEvent te;
mtx::events::collections::from_json(nlohmann::json::parse(event), te);
from_json(nlohmann::json::parse(event), te);
pendingCursor.close();
txn.commit();
@ -3316,8 +3316,8 @@ Cache::saveTimelineMessages(lmdb::txn &txn,
mtx::events::collections::TimelineEvent te;
try {
mtx::events::collections::from_json(
nlohmann::json::parse(std::string_view(oldEvent.data(), oldEvent.size())), te);
from_json(nlohmann::json::parse(std::string_view(oldEvent.data(), oldEvent.size())),
te);
// overwrite the content and add redation data
std::visit(
[redaction](auto &ev) {
@ -3578,7 +3578,7 @@ Cache::getTimelineMentionsForRoom(lmdb::txn &txn, const std::string &room_id)
continue;
mtx::responses::Notification notification;
mtx::responses::from_json(obj, notification);
from_json(obj, notification);
notif.notifications.push_back(notification);
}

View File

@ -1245,7 +1245,7 @@ decryptEvent(const MegolmSessionIndex &index,
body["unsigned"] = event.unsigned_data;
mtx::events::collections::TimelineEvent te;
mtx::events::collections::from_json(body, te);
from_json(body, te);
// relations are unencrypted in content...
mtx::accessors::set_relations(te.data, std::move(event.content.relations));