Changeset View
Changeset View
Standalone View
Standalone View
src/client/actions/storage.cpp
- This file was added.
| /* | |||||
| * This file is part of libkazv. | |||||
| * SPDX-FileCopyrightText: 2025 tusooa <tusooa@kazv.moe> | |||||
| * SPDX-License-Identifier: AGPL-3.0-or-later | |||||
| */ | |||||
| #include <libkazv-config.hpp> | |||||
| #include "storage.hpp" | |||||
| #include "room/room-model.hpp" | |||||
| #include "debug.hpp" | |||||
| namespace Kazv | |||||
| { | |||||
| ClientResult updateClient(ClientModel m, LoadEventsFromStorageAction a) | |||||
| { | |||||
| for (auto [roomId, timelineEvents]: a.timelineEvents) { | |||||
| if (!timelineEvents.empty()) { | |||||
| m.roomList = RoomListModel::update( | |||||
| std::move(m.roomList), | |||||
| // If this call is changed, also change the comments in the AddToTimelineAction reducer in room/room-model.cpp | |||||
| UpdateRoomAction{roomId, AddToTimelineAction{ | |||||
| timelineEvents, | |||||
| std::nullopt, | |||||
| std::nullopt, | |||||
| std::nullopt, | |||||
| }} | |||||
| ); | |||||
| } | |||||
| } | |||||
| for (auto [roomId, relatedEvents] : a.relatedEvents) { | |||||
| if (!relatedEvents.empty()) { | |||||
| m.roomList = RoomListModel::update( | |||||
| std::move(m.roomList), | |||||
| UpdateRoomAction{roomId, AddMessagesAction{ | |||||
| relatedEvents, | |||||
| }} | |||||
| ); | |||||
| } | |||||
| } | |||||
| return { m, lager::noop }; | |||||
| } | |||||
| } |