|
libkazv
|
The model to store information about a room. More...
#include <room-model.hpp>
Public Types | |
| using | Membership = RoomMembership |
| using | ReverseEventRelationshipMap = immer::map< std::string, immer::map< std::string, immer::flex_vector< std::string > > > |
| using | Action = std::variant< AddStateEventsAction, MaybeAddStateEventsAction, AddMessagesAction, AddToTimelineAction, AddAccountDataAction, ChangeMembershipAction, ChangeInviteStateAction, AddEphemeralAction, SetLocalDraftAction, SetRoomEncryptionAction, MarkMembersFullyLoadedAction, SetHeroIdsAction, AddLocalEchoAction, RemoveLocalEchoAction, AddPendingRoomKeyAction, RemovePendingRoomKeyAction, UpdateJoinedMemberCountAction, UpdateInvitedMemberCountAction, AddLocalNotificationsAction, RemoveReadLocalNotificationsAction, UpdateLocalReadMarkerAction, PurgeEventsAction > |
Public Member Functions | |
| immer::flex_vector< std::string > | joinedMemberIds () const |
| immer::flex_vector< std::string > | invitedMemberIds () const |
| immer::flex_vector< std::string > | knockedMemberIds () const |
| immer::flex_vector< std::string > | leftMemberIds () const |
| immer::flex_vector< std::string > | bannedMemberIds () const |
| EventList | joinedMemberEvents () const |
| EventList | invitedMemberEvents () const |
| EventList | knockedMemberEvents () const |
| EventList | leftMemberEvents () const |
| EventList | bannedMemberEvents () const |
| EventList | heroMemberEvents () const |
| MegOlmSessionRotateDesc | sessionRotateDesc () const |
| bool | hasUser (std::string userId) const |
| std::optional< LocalEchoDesc > | getLocalEchoByTxnId (std::string txnId) const |
| std::optional< PendingRoomKeyEvent > | getPendingRoomKeyEventByTxnId (std::string txnId) const |
| immer::map< std::string, double > | tags () const |
| Event | makeAddTagEvent (std::string tagId, std::optional< double > order) const |
| Event | makeRemoveTagEvent (std::string tagId) const |
| void | generateRelationships (EventList newEvents) |
Fill in reverseEventRelationships by gathering the relationships specified in newEvents | |
| void | regenerateRelationships () |
| void | addToUndecryptedEvents (EventList newEvents) |
Fill in undecryptedEvents by gathering the session ids specified in newEvents. | |
| void | recalculateUndecryptedEvents () |
| bool | checkInvariants () const |
| Check if the invariants in the model are satisfied. | |
| bool | isInTimeline (const std::string &eventId) const |
| Check if the event is in the timeline. | |
Static Public Member Functions | |
| static RoomModel | update (RoomModel r, Action a) |
Public Attributes | |
| std::string | roomId |
| immer::map< KeyOfState, Event > | stateEvents |
| immer::map< KeyOfState, Event > | inviteState |
| immer::flex_vector< std::string > | timeline |
| immer::map< std::string, Event > | messages |
| immer::map< std::string, Event > | accountData |
| Membership | membership {} |
| std::string | paginateBackToken |
| bool | canPaginateBack {true} |
| whether this room has earlier events to be fetched | |
| immer::map< std::string, std::string > | timelineGaps |
| immer::map< std::string, Event > | ephemeral |
| std::string | localDraft |
| bool | encrypted {false} |
| bool | shouldRotateSessionKey {true} |
| a marker to indicate whether we need to rotate the session key earlier than it expires (e.g. | |
| bool | membersFullyLoaded {false} |
| immer::flex_vector< std::string > | heroIds |
| immer::flex_vector< LocalEchoDesc > | localEchoes |
| immer::flex_vector< PendingRoomKeyEvent > | pendingRoomKeyEvents |
| ReverseEventRelationshipMap | reverseEventRelationships |
| std::size_t | joinedMemberCount {0} |
| std::size_t | invitedMemberCount {0} |
| std::string | localReadMarker |
| The local read marker for this room. | |
| std::size_t | localUnreadCount {0} |
| The local unread count for this room. | |
| std::size_t | localNotificationCount {0} |
| The local unread notification count for this room. | |
| immer::map< std::string, ReadReceipt > | readReceipts |
| Read receipts for all users. | |
| 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. | |
| 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. | |
| immer::flex_vector< std::string > | unreadNotificationEventIds |
| immer::set< std::string > | nonTimelineEvents |
The set of event ids that are in messages but not in timeline. | |
Friends | |
| bool | operator== (const RoomModel &a, const RoomModel &b)=default |
The model to store information about a room.
Room invariants: Any event in timeline is in messages. Any event in undecryptedEvents is in messages. Any event in unreadNotificationEventIds is in messages. Any relater (i.e. child) event in reverseEventRelationships is in messages. localReadMarker (if not empty) is in messages.
| using Kazv::RoomModel::ReverseEventRelationshipMap = immer::map< std::string , immer::map<std::string , immer::flex_vector<std::string > >> |
| void Kazv::RoomModel::addToUndecryptedEvents | ( | EventList | newEvents | ) |
Fill in undecryptedEvents by gathering the session ids specified in newEvents.
| newEvents | New incoming events. |
| EventList Kazv::RoomModel::bannedMemberEvents | ( | ) | const |
| immer::flex_vector< std::string > Kazv::RoomModel::bannedMemberIds | ( | ) | const |
| bool Kazv::RoomModel::checkInvariants | ( | ) | const |
Check if the invariants in the model are satisfied.
| void Kazv::RoomModel::generateRelationships | ( | EventList | newEvents | ) |
Fill in reverseEventRelationships by gathering the relationships specified in newEvents
| newEvents | The events that just came in after last time event relationships are gathered. |
| std::optional< LocalEchoDesc > Kazv::RoomModel::getLocalEchoByTxnId | ( | std::string | txnId | ) | const |
| std::optional< PendingRoomKeyEvent > Kazv::RoomModel::getPendingRoomKeyEventByTxnId | ( | std::string | txnId | ) | const |
| bool Kazv::RoomModel::hasUser | ( | std::string | userId | ) | const |
| EventList Kazv::RoomModel::heroMemberEvents | ( | ) | const |
| EventList Kazv::RoomModel::invitedMemberEvents | ( | ) | const |
| immer::flex_vector< std::string > Kazv::RoomModel::invitedMemberIds | ( | ) | const |
| bool Kazv::RoomModel::isInTimeline | ( | const std::string & | eventId | ) | const |
Check if the event is in the timeline.
This function takes constant time.
| eventId | The id of the event to check. |
| EventList Kazv::RoomModel::joinedMemberEvents | ( | ) | const |
| immer::flex_vector< std::string > Kazv::RoomModel::joinedMemberIds | ( | ) | const |
| EventList Kazv::RoomModel::knockedMemberEvents | ( | ) | const |
| immer::flex_vector< std::string > Kazv::RoomModel::knockedMemberIds | ( | ) | const |
| EventList Kazv::RoomModel::leftMemberEvents | ( | ) | const |
| immer::flex_vector< std::string > Kazv::RoomModel::leftMemberIds | ( | ) | const |
| Event Kazv::RoomModel::makeAddTagEvent | ( | std::string | tagId, |
| std::optional< double > | order | ||
| ) | const |
| Event Kazv::RoomModel::makeRemoveTagEvent | ( | std::string | tagId | ) | const |
| void Kazv::RoomModel::recalculateUndecryptedEvents | ( | ) |
| void Kazv::RoomModel::regenerateRelationships | ( | ) |
| MegOlmSessionRotateDesc Kazv::RoomModel::sessionRotateDesc | ( | ) | const |
| immer::map< std::string, double > Kazv::RoomModel::tags | ( | ) | const |
| immer::map<std::string, Event> Kazv::RoomModel::accountData |
| bool Kazv::RoomModel::canPaginateBack {true} |
whether this room has earlier events to be fetched
| bool Kazv::RoomModel::encrypted {false} |
| immer::map<std::string, Event> Kazv::RoomModel::ephemeral |
| immer::map< std::string , immer::flex_vector<std::string > > Kazv::RoomModel::eventReadUsers |
A map from event id to a list of users that has read receipt at that point.
| immer::flex_vector<std::string> Kazv::RoomModel::heroIds |
| std::size_t Kazv::RoomModel::invitedMemberCount {0} |
| immer::map<KeyOfState, Event> Kazv::RoomModel::inviteState |
| std::size_t Kazv::RoomModel::joinedMemberCount {0} |
| std::string Kazv::RoomModel::localDraft |
| immer::flex_vector<LocalEchoDesc> Kazv::RoomModel::localEchoes |
| std::size_t Kazv::RoomModel::localNotificationCount {0} |
The local unread notification count for this room.
XXX this is never used.
| std::string Kazv::RoomModel::localReadMarker |
The local read marker for this room.
Indicates that you have read up to this event.
| std::size_t Kazv::RoomModel::localUnreadCount {0} |
The local unread count for this room.
| bool Kazv::RoomModel::membersFullyLoaded {false} |
| Membership Kazv::RoomModel::membership {} |
| immer::map<std::string, Event> Kazv::RoomModel::messages |
| immer::set<std::string> Kazv::RoomModel::nonTimelineEvents |
The set of event ids that are in messages but not in timeline.
The rationale is that non-timeline events are sparse, so instead of recording events that are in the timeline, we record those not in the timeline.
| std::string Kazv::RoomModel::paginateBackToken |
| immer::flex_vector<PendingRoomKeyEvent> Kazv::RoomModel::pendingRoomKeyEvents |
| immer::map<std::string , ReadReceipt> Kazv::RoomModel::readReceipts |
Read receipts for all users.
| ReverseEventRelationshipMap Kazv::RoomModel::reverseEventRelationships |
| std::string Kazv::RoomModel::roomId |
| bool Kazv::RoomModel::shouldRotateSessionKey {true} |
a marker to indicate whether we need to rotate the session key earlier than it expires (e.g.
when a user in the room's device list changed or when someone joins or leaves)
| immer::map<KeyOfState, Event> Kazv::RoomModel::stateEvents |
| immer::flex_vector<std::string> Kazv::RoomModel::timeline |
| immer::map<std::string , std::string > Kazv::RoomModel::timelineGaps |
| immer::map< std::string , immer::flex_vector<std::string > > Kazv::RoomModel::undecryptedEvents |
A map from the session id to a list of event ids of events that cannot (yet) be decrypted.
| immer::flex_vector<std::string> Kazv::RoomModel::unreadNotificationEventIds |