mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Make code compile with hidden friends
This commit is contained in:
parent
b594242358
commit
3c480d47f1
2 changed files with 8 additions and 8 deletions
|
@ -1207,7 +1207,7 @@ Cache::runMigrations()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
mtx::events::collections::TimelineEvent te;
|
mtx::events::collections::TimelineEvent te;
|
||||||
mtx::events::collections::from_json(j["event"], te);
|
from_json(j["event"], te);
|
||||||
oldMessages.events.push_back(te.data);
|
oldMessages.events.push_back(te.data);
|
||||||
}
|
}
|
||||||
// messages were stored in reverse order, so we
|
// 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;
|
mtx::events::collections::TimelineEvent te;
|
||||||
try {
|
try {
|
||||||
mtx::events::collections::from_json(nlohmann::json::parse(event), te);
|
from_json(nlohmann::json::parse(event), te);
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
nhlog::db()->error("Failed to parse message from cache {}", e.what());
|
nhlog::db()->error("Failed to parse message from cache {}", e.what());
|
||||||
continue;
|
continue;
|
||||||
|
@ -2231,7 +2231,7 @@ Cache::getEvent(const std::string &room_id, const std::string &event_id)
|
||||||
|
|
||||||
mtx::events::collections::TimelineEvent te;
|
mtx::events::collections::TimelineEvent te;
|
||||||
try {
|
try {
|
||||||
mtx::events::collections::from_json(nlohmann::json::parse(event), te);
|
from_json(nlohmann::json::parse(event), te);
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
nhlog::db()->error("Failed to parse message from cache {}", e.what());
|
nhlog::db()->error("Failed to parse message from cache {}", e.what());
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -3177,7 +3177,7 @@ Cache::firstPendingMessage(const std::string &room_id)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mtx::events::collections::TimelineEvent te;
|
mtx::events::collections::TimelineEvent te;
|
||||||
mtx::events::collections::from_json(nlohmann::json::parse(event), te);
|
from_json(nlohmann::json::parse(event), te);
|
||||||
|
|
||||||
pendingCursor.close();
|
pendingCursor.close();
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
@ -3316,8 +3316,8 @@ Cache::saveTimelineMessages(lmdb::txn &txn,
|
||||||
|
|
||||||
mtx::events::collections::TimelineEvent te;
|
mtx::events::collections::TimelineEvent te;
|
||||||
try {
|
try {
|
||||||
mtx::events::collections::from_json(
|
from_json(nlohmann::json::parse(std::string_view(oldEvent.data(), oldEvent.size())),
|
||||||
nlohmann::json::parse(std::string_view(oldEvent.data(), oldEvent.size())), te);
|
te);
|
||||||
// overwrite the content and add redation data
|
// overwrite the content and add redation data
|
||||||
std::visit(
|
std::visit(
|
||||||
[redaction](auto &ev) {
|
[redaction](auto &ev) {
|
||||||
|
@ -3578,7 +3578,7 @@ Cache::getTimelineMentionsForRoom(lmdb::txn &txn, const std::string &room_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mtx::responses::Notification notification;
|
mtx::responses::Notification notification;
|
||||||
mtx::responses::from_json(obj, notification);
|
from_json(obj, notification);
|
||||||
|
|
||||||
notif.notifications.push_back(notification);
|
notif.notifications.push_back(notification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ decryptEvent(const MegolmSessionIndex &index,
|
||||||
body["unsigned"] = event.unsigned_data;
|
body["unsigned"] = event.unsigned_data;
|
||||||
|
|
||||||
mtx::events::collections::TimelineEvent te;
|
mtx::events::collections::TimelineEvent te;
|
||||||
mtx::events::collections::from_json(body, te);
|
from_json(body, te);
|
||||||
|
|
||||||
// relations are unencrypted in content...
|
// relations are unencrypted in content...
|
||||||
mtx::accessors::set_relations(te.data, std::move(event.content.relations));
|
mtx::accessors::set_relations(te.data, std::move(event.content.relations));
|
||||||
|
|
Loading…
Reference in a new issue