13#include <immer/flex_vector.hpp>
14#include <immer/map.hpp>
15#include <immer/set.hpp>
36 immer::map<std::string, immer::map<std::string, Event>>
messages;
52 template<
class Archive>
197 template<
class Archive>
204 immer::map<std::string, immer::flex_vector<std::string>> devices;
205 ar & txnId &
event & devices;
207 std::move(txnId), std::move(event), std::move(devices));
240 immer::map<std::string , immer::flex_vector<std::string >>>;
324 bool hasUser(std::string userId)
const;
329 immer::map<std::string, double>
tags()
const;
410 immer::map<std::string, RoomModel>
rooms;
412 inline auto at(std::string
id)
const {
return rooms.at(
id); }
414 inline bool has(std::string
id)
const {
return rooms.find(
id); }
426 template<
class Archive>
466 if constexpr (
typename Archive::is_loading()) {
484 if constexpr (
typename Archive::is_loading()) {
496 template<
class Archive>
504BOOST_CLASS_VERSION(
Kazv::ReadReceipt, 0)
505BOOST_CLASS_VERSION(
Kazv::RoomModel, 9)
506BOOST_CLASS_VERSION(
Kazv::RoomListModel, 0)
Definition push-rules-desc.hpp:38
Definition location.hpp:10
RoomModel::Action RoomAction
Definition room-model.hpp:400
const double ROOM_TAG_DEFAULT_ORDER
Definition room-model.hpp:195
std::int_fast64_t Timestamp
Definition event.hpp:18
auto sortKeyForTimelineEvent(Event e) -> std::tuple< Timestamp, std::string >
Get the sort key for a timeline event.
Definition room-model.cpp:56
RoomMembership
Definition types.hpp:128
immer::flex_vector< Event > EventList
Definition types.hpp:107
PendingRoomKeyEvent makePendingRoomKeyEventV0(std::string txnId, Event event, immer::map< std::string, immer::flex_vector< std::string > > devices)
Definition room-model.cpp:40
void serialize(Archive &ar, ClientModel &m, std::uint32_t const version)
Definition client-model.hpp:633
RoomListModel::Action RoomListAction
Definition room-model.hpp:424
Definition room-model.hpp:99
immer::flex_vector< Event > events
Definition room-model.hpp:100
Definition room-model.hpp:114
EventList events
Definition room-model.hpp:115
Definition room-model.hpp:137
LocalEchoDesc localEcho
Definition room-model.hpp:138
Update local notifications to include the new events.
Definition room-model.hpp:170
std::string myUserId
Definition room-model.hpp:173
EventList newEvents
Definition room-model.hpp:171
PushRulesDesc pushRulesDesc
Definition room-model.hpp:172
Add events to the messages map, but not the timeline.
Definition room-model.hpp:83
bool alsoInTimeline
Definition room-model.hpp:86
EventList events
Definition room-model.hpp:84
Definition room-model.hpp:147
PendingRoomKeyEvent pendingRoomKeyEvent
Definition room-model.hpp:148
Definition room-model.hpp:68
immer::flex_vector< Event > stateEvents
Definition room-model.hpp:69
Definition room-model.hpp:90
std::optional< std::string > prevBatch
Definition room-model.hpp:93
std::optional< std::string > gapEventId
Definition room-model.hpp:95
std::optional< bool > limited
Definition room-model.hpp:94
immer::flex_vector< Event > events
Events from oldest to latest.
Definition room-model.hpp:92
Definition room-model.hpp:109
immer::flex_vector< Event > events
Definition room-model.hpp:110
Definition room-model.hpp:104
RoomMembership membership
Definition room-model.hpp:105
Definition room-model.hpp:60
friend bool operator!=(const EventReader &a, const EventReader &b)=default
friend bool operator==(const EventReader &a, const EventReader &b)=default
std::string userId
Definition room-model.hpp:61
Timestamp timestamp
Definition room-model.hpp:62
Describes a local echo.
Definition local-echo.hpp:19
Definition room-model.hpp:128
Go from the back of stateEvents to the beginning, adding the event to room state only if the room has...
Definition room-model.hpp:76
immer::flex_vector< Event > stateEvents
Definition room-model.hpp:77
Definition room-model.hpp:34
friend bool operator!=(const PendingRoomKeyEvent &a, const PendingRoomKeyEvent &b)=default
immer::map< std::string, immer::map< std::string, Event > > messages
Definition room-model.hpp:36
friend bool operator==(const PendingRoomKeyEvent &a, const PendingRoomKeyEvent &b)=default
std::string txnId
Definition room-model.hpp:35
Remove events from the model, retaining only the latest maxToKeep events.
Definition room-model.hpp:191
std::size_t maxToKeep
Definition room-model.hpp:192
Definition room-model.hpp:45
Timestamp timestamp
Definition room-model.hpp:47
std::string eventId
Definition room-model.hpp:46
friend bool operator!=(const ReadReceipt &a, const ReadReceipt &b)=default
friend bool operator==(const ReadReceipt &a, const ReadReceipt &b)=default
Definition room-model.hpp:142
std::string txnId
Definition room-model.hpp:143
Definition room-model.hpp:152
std::string txnId
Definition room-model.hpp:153
Remove local notifications that are already read.
Definition room-model.hpp:178
std::string myUserId
Definition room-model.hpp:179
Definition room-model.hpp:409
std::variant< UpdateRoomAction > Action
Definition room-model.hpp:418
auto at(std::string id) const
Definition room-model.hpp:412
static RoomListModel update(RoomListModel l, Action a)
Definition room-model.cpp:451
bool has(std::string id) const
Definition room-model.hpp:414
immer::map< std::string, RoomModel > rooms
Definition room-model.hpp:410
friend bool operator==(const RoomListModel &a, const RoomListModel &b)=default
auto operator[](std::string id) const
Definition room-model.hpp:413
The model to store information about a room.
Definition room-model.hpp:236
immer::flex_vector< std::string > unreadNotificationEventIds
Definition room-model.hpp:302
immer::map< KeyOfState, Event > stateEvents
Definition room-model.hpp:243
EventList invitedMemberEvents() const
Definition room-model.cpp:539
EventList knockedMemberEvents() const
Definition room-model.cpp:544
Event makeRemoveTagEvent(std::string tagId) const
Definition room-model.cpp:679
bool canPaginateBack
whether this room has earlier events to be fetched
Definition room-model.hpp:253
immer::map< std::string, std::string > timelineGaps
Definition room-model.hpp:255
immer::map< std::string, Event > ephemeral
Definition room-model.hpp:257
bool encrypted
Definition room-model.hpp:261
immer::map< std::string, double > tags() const
Definition room-model.cpp:638
immer::flex_vector< std::string > timeline
Definition room-model.hpp:247
std::string paginateBackToken
Definition room-model.hpp:251
immer::map< std::string, immer::map< std::string, immer::flex_vector< std::string > > > ReverseEventRelationshipMap
Definition room-model.hpp:240
immer::set< std::string > nonTimelineEvents
The set of event ids that are in messages but not in timeline.
Definition room-model.hpp:307
Event makeAddTagEvent(std::string tagId, std::optional< double > order) const
Definition room-model.cpp:667
MegOlmSessionRotateDesc sessionRotateDesc() const
Definition room-model.cpp:579
EventList heroMemberEvents() const
Definition room-model.cpp:559
void regenerateRelationships()
Definition room-model.cpp:698
EventList bannedMemberEvents() const
Definition room-model.cpp:554
immer::map< std::string, Event > messages
Definition room-model.hpp:248
void generateRelationships(EventList newEvents)
Fill in reverseEventRelationships by gathering the relationships specified in newEvents
Definition room-model.cpp:686
std::size_t localNotificationCount
The local unread notification count for this room.
Definition room-model.hpp:287
std::size_t joinedMemberCount
Definition room-model.hpp:277
void addToUndecryptedEvents(EventList newEvents)
Fill in undecryptedEvents by gathering the session ids specified in newEvents.
Definition room-model.cpp:705
std::size_t localUnreadCount
The local unread count for this room.
Definition room-model.hpp:284
std::string localDraft
Definition room-model.hpp:259
immer::flex_vector< std::string > knockedMemberIds() const
Definition room-model.cpp:519
bool isInTimeline(const std::string &eventId) const
Check if the event is in the timeline.
Definition room-model.cpp:760
bool checkInvariants() const
Check if the invariants in the model are satisfied.
Definition room-model.cpp:740
immer::map< std::string, immer::flex_vector< std::string > > eventReadUsers
A map from event id to a list of users that has read receipt at that point.
Definition room-model.hpp:294
EventList leftMemberEvents() const
Definition room-model.cpp:549
immer::flex_vector< std::string > heroIds
Definition room-model.hpp:269
std::optional< PendingRoomKeyEvent > getPendingRoomKeyEventByTxnId(std::string txnId) const
Definition room-model.cpp:617
immer::flex_vector< LocalEchoDesc > localEchoes
Definition room-model.hpp:271
std::optional< LocalEchoDesc > getLocalEchoByTxnId(std::string txnId) const
Definition room-model.cpp:605
std::string roomId
Definition room-model.hpp:242
EventList joinedMemberEvents() const
Definition room-model.cpp:534
bool membersFullyLoaded
Definition room-model.hpp:268
std::variant< AddStateEventsAction, MaybeAddStateEventsAction, AddMessagesAction, AddToTimelineAction, AddAccountDataAction, ChangeMembershipAction, ChangeInviteStateAction, AddEphemeralAction, SetLocalDraftAction, SetRoomEncryptionAction, MarkMembersFullyLoadedAction, SetHeroIdsAction, AddLocalEchoAction, RemoveLocalEchoAction, AddPendingRoomKeyAction, RemovePendingRoomKeyAction, UpdateJoinedMemberCountAction, UpdateInvitedMemberCountAction, AddLocalNotificationsAction, RemoveReadLocalNotificationsAction, UpdateLocalReadMarkerAction, PurgeEventsAction > Action
Definition room-model.hpp:393
std::size_t invitedMemberCount
Definition room-model.hpp:278
immer::flex_vector< std::string > invitedMemberIds() const
Definition room-model.cpp:514
ReverseEventRelationshipMap reverseEventRelationships
Definition room-model.hpp:275
bool hasUser(std::string userId) const
Definition room-model.cpp:592
immer::map< std::string, immer::flex_vector< std::string > > undecryptedEvents
A map from the session id to a list of event ids of events that cannot (yet) be decrypted.
Definition room-model.hpp:300
immer::flex_vector< std::string > bannedMemberIds() const
Definition room-model.cpp:529
immer::flex_vector< PendingRoomKeyEvent > pendingRoomKeyEvents
Definition room-model.hpp:273
friend bool operator==(const RoomModel &a, const RoomModel &b)=default
immer::map< std::string, Event > accountData
Definition room-model.hpp:249
void recalculateUndecryptedEvents()
Definition room-model.cpp:729
immer::map< std::string, ReadReceipt > readReceipts
Read receipts for all users.
Definition room-model.hpp:289
bool shouldRotateSessionKey
a marker to indicate whether we need to rotate the session key earlier than it expires (e....
Definition room-model.hpp:266
immer::flex_vector< std::string > joinedMemberIds() const
Definition room-model.cpp:509
Membership membership
Definition room-model.hpp:250
std::string localReadMarker
The local read marker for this room.
Definition room-model.hpp:282
immer::map< KeyOfState, Event > inviteState
Definition room-model.hpp:244
immer::flex_vector< std::string > leftMemberIds() const
Definition room-model.cpp:524
static RoomModel update(RoomModel r, Action a)
Definition room-model.cpp:61
Definition room-model.hpp:132
immer::flex_vector< std::string > heroIds
Definition room-model.hpp:133
Definition room-model.hpp:119
std::string localDraft
Definition room-model.hpp:120
Definition room-model.hpp:124
Definition room-model.hpp:162
std::size_t invitedMemberCount
Definition room-model.hpp:163
Definition room-model.hpp:157
std::size_t joinedMemberCount
Definition room-model.hpp:158
Update the local read marker, removing any read notifications before it.
Definition room-model.hpp:184
std::string myUserId
Definition room-model.hpp:186
std::string localReadMarker
Definition room-model.hpp:185
Definition room-model.hpp:403
RoomAction roomAction
Definition room-model.hpp:405
std::string roomId
Definition room-model.hpp:404