Changeset View
Changeset View
Standalone View
Standalone View
src/client/client.hpp
| Show First 20 Lines • Show All 621 Lines • ▼ Show 20 Lines | #endif | ||||
| * should be put into the timeline. | * should be put into the timeline. | ||||
| * @param relatedEvents Map from room id to a list of message events that should | * @param relatedEvents Map from room id to a list of message events that should | ||||
| * not be put into the timeline (for example, because the storage does not | * not be put into the timeline (for example, because the storage does not | ||||
| * know or care where it should go in the timeline). | * know or care where it should go in the timeline). | ||||
| * @return A Promise that resolves when the events are loaded into the store. | * @return A Promise that resolves when the events are loaded into the store. | ||||
| */ | */ | ||||
| PromiseT loadEventsFromStorage(immer::map<std::string, EventList> timelineEvents, immer::map<std::string, EventList> relatedEvents) const; | PromiseT loadEventsFromStorage(immer::map<std::string, EventList> timelineEvents, immer::map<std::string, EventList> relatedEvents) const; | ||||
| /** | |||||
| * Import keys from a key backup file. | |||||
| * | |||||
| * @param fileContent The raw content of the file. | |||||
| * @param password The password to decrypt the file. | |||||
| * @return A Promise that resolves when the keys are imported or when there is an error. Assume the Promise resolves to `r`, if it is successful, `r.dataJson("imported")` contains the number of keys imported. Otherwise, `r` contains the standard error structure. | |||||
| */ | |||||
| PromiseT importFromKeyBackupFile(std::string fileContent, std::string password) const; | |||||
| private: | private: | ||||
| void syncForever(std::optional<int> retryTime = std::nullopt) const; | void syncForever(std::optional<int> retryTime = std::nullopt) const; | ||||
| const lager::reader<SdkModel> &sdkCursor() const; | const lager::reader<SdkModel> &sdkCursor() const; | ||||
| lager::reader<ClientModel> clientCursor() const; | lager::reader<ClientModel> clientCursor() const; | ||||
| std::optional<lager::reader<SdkModel>> m_sdk; | std::optional<lager::reader<SdkModel>> m_sdk; | ||||
| std::optional<lager::reader<ClientModel>> m_client; | std::optional<lager::reader<ClientModel>> m_client; | ||||
| ContextT m_ctx; | ContextT m_ctx; | ||||
| std::optional<DepsT> m_deps; | std::optional<DepsT> m_deps; | ||||
| KAZV_DECLARE_THREAD_ID(); | KAZV_DECLARE_THREAD_ID(); | ||||
| KAZV_DECLARE_EVENT_LOOP_THREAD_ID_KEEPER(m_deps.has_value() ? &lager::get<EventLoopThreadIdKeeper &>(m_deps.value()) : 0); | KAZV_DECLARE_EVENT_LOOP_THREAD_ID_KEEPER(m_deps.has_value() ? &lager::get<EventLoopThreadIdKeeper &>(m_deps.value()) : 0); | ||||
| }; | }; | ||||
| } | } | ||||