libQuotient
A Qt library for building matrix clients
|
#include <room.h>
Public Types | |
enum class | Change : quint32 { None = 0x0 , RoomNames = 0x1 , Topic = 0x4 , PartiallyReadStats = 0x8 , Avatar = 0x10 , JoinState = 0x20 , Tags = 0x40 , Members = 0x80 , UnreadStats = 0x100 , Summary = 0x400 , Highlights = 0x1000 , Other = 0x8000 , Any = 0xFFFF } |
Room changes that can be tracked using Room::changed() signal. More... | |
enum | ActionScope { ThisRoomOnly , WithinSameState , OmitLeftState , WholeSequence } |
The scope to apply an action on. More... | |
using | Timeline = std::deque< TimelineItem > |
using | PendingEvents = std::vector< PendingEventItem > |
using | RelatedEvents = QVector< const RoomEvent * > |
using | rev_iter_t = Timeline::const_reverse_iterator |
using | timeline_iter_t = Timeline::const_iterator |
Public Slots | |
void | checkVersion () |
QString | postMessage (const QString &plainText, MessageEventType type) |
QString | postPlainText (const QString &plainText) |
QString | postHtmlMessage (const QString &plainText, const QString &html, MessageEventType type=MessageEventType::Text) |
QString | postHtmlText (const QString &plainText, const QString &html) |
QString | postReaction (const QString &eventId, const QString &key) |
Send a reaction on a given event with a given key. More... | |
QString | postEvent (RoomEvent *event) |
QString | postJson (const QString &matrixType, const QJsonObject &eventContent) |
QString | retryMessage (const QString &txnId) |
void | discardMessage (const QString &txnId) |
SetRoomStateWithKeyJob * | setState (const QString &evtType, const QString &stateKey, const QJsonObject &contentJson) |
Send a request to update the room state based on freeform inputs. More... | |
void | setName (const QString &newName) |
void | setCanonicalAlias (const QString &newAlias) |
void | setPinnedEvents (const QStringList &events) |
void | setLocalAliases (const QStringList &aliases) |
Set room aliases on the user's current server. More... | |
void | setTopic (const QString &newTopic) |
void | refreshDisplayName () |
You shouldn't normally call this method; it's here for debugging. More... | |
JobHandle< GetRoomEventsJob > | getPreviousContent (int limit=10, const QString &filter={}) |
void | inviteToRoom (const QString &memberId) |
JobHandle< LeaveRoomJob > | leaveRoom () |
void | kickMember (const QString &memberId, const QString &reason={}) |
void | ban (const QString &userId, const QString &reason={}) |
void | unban (const QString &userId) |
void | redactEvent (const QString &eventId, const QString &reason={}) |
void | uploadFile (const QString &id, const QUrl &localFilename, const QString &overrideContentType={}) |
void | downloadFile (const QString &eventId, const QUrl &localFilename={}) |
void | cancelFileTransfer (const QString &id) |
void | setReadReceipt (const QString &atEventId) |
Set a given event as last read and post a read receipt on it. More... | |
void | markAllMessagesAsRead () |
Put the fully-read marker at the latest message in the room. More... | |
void | switchVersion (QString newVersion) |
Switch the room's version (aka upgrade) More... | |
void | inviteCall (const QString &callId, const int lifetime, const QString &sdp) |
void | sendCallCandidates (const QString &callId, const QJsonArray &candidates) |
void | answerCall (const QString &callId, const QString &sdp) |
void | hangupCall (const QString &callId) |
void | activateEncryption () |
Signals | |
void | baseStateLoaded () |
Initial set of state events has been loaded. More... | |
void | eventsHistoryJobChanged () |
void | aboutToAddHistoricalMessages (Quotient::RoomEventsRange events) |
void | aboutToAddNewMessages (Quotient::RoomEventsRange events) |
void | addedMessages (int fromIndex, int toIndex) |
void | pendingEventAboutToAdd (Quotient::RoomEvent *event) |
The event is about to be appended to the list of pending events. More... | |
void | pendingEventAdded (const Quotient::RoomEvent *event) |
An event has been appended to the list of pending events. More... | |
void | pendingEventAboutToMerge (Quotient::RoomEvent *serverEvent, int pendingEventIndex) |
void | pendingEventMerged () |
The remote and local copies of the event have been merged. More... | |
void | pendingEventAboutToDiscard (int pendingEventIndex) |
An event will be removed from the list of pending events. More... | |
void | pendingEventDiscarded () |
An event has just been removed from the list of pending events. More... | |
void | pendingEventChanged (int pendingEventIndex) |
The status of a pending event has changed. More... | |
void | messageSent (QString txnId, QString eventId) |
The server accepted the message. More... | |
void | changed (Quotient::Room::Changes changes) |
void | namesChanged (Quotient::Room *room) |
The room name, the canonical alias or other aliases changed. More... | |
void | displaynameAboutToChange (Quotient::Room *room) |
void | displaynameChanged (Quotient::Room *room, QString oldName) |
void | pinnedEventsChanged () |
void | topicChanged () |
void | avatarChanged () |
void | memberJoined (RoomMember member) |
A new member has joined the room. More... | |
void | memberLeft (RoomMember member) |
A member who previously joined has left. More... | |
void | memberNameAboutToUpdate (RoomMember member, QString newName) |
A known joined member is about to update their display name. More... | |
void | memberNameUpdated (RoomMember member) |
A known joined member has updated their display name. More... | |
void | memberAvatarUpdated (RoomMember member) |
A known joined member has updated their avatar. More... | |
void | memberListChanged () |
The list of members has changed. More... | |
void | allMembersLoaded () |
void | encryption () |
void | joinStateChanged (Quotient::JoinState oldState, Quotient::JoinState newState) |
void | typingChanged () |
The list of members sending typing indicators has changed. More... | |
void | highlightCountChanged () |
void | notificationCountChanged () |
void | displayedChanged (bool displayed) |
void | firstDisplayedEventChanged () |
void | lastDisplayedEventChanged () |
void | lastReadEventChanged (QVector< QString > userIds) |
void | fullyReadMarkerMoved (QString fromEventId, QString toEventId) |
void | partiallyReadStatsChanged () |
void | unreadStatsChanged () |
void | allHistoryLoadedChanged () |
void | accountDataAboutToChange (QString type) |
void | accountDataChanged (QString type) |
void | tagsAboutToChange () |
void | tagsChanged () |
void | updatedEvent (QString eventId) |
void | replacedEvent (const Quotient::RoomEvent *newEvent, const Quotient::RoomEvent *oldEvent) |
void | newFileTransfer (QString id, QUrl localFile) |
void | fileTransferProgress (QString id, qint64 progress, qint64 total) |
void | fileTransferCompleted (QString id, QUrl localFile, FileSourceInfo fileMetadata) |
void | fileTransferFailed (QString id, QString errorMessage={}) |
void | callEvent (Quotient::Room *room, const Quotient::RoomEvent *event) |
void | stabilityUpdated (QString recommendedDefault, QStringList stableVersions) |
The room's version stability may have changed. More... | |
void | upgraded (QString serverMessage, Quotient::Room *successor) |
This room has been upgraded and won't receive updates any more. More... | |
void | upgradeFailed (QString errorMessage) |
An attempted room upgrade has failed. More... | |
void | beforeDestruction (Quotient::Room *) |
The room is about to be deleted. More... | |
Public Member Functions | |
Room (Connection *connection, QString id, JoinState initialJoinState) | |
~Room () override | |
Connection * | connection () const |
RoomMember | localMember () const |
Get a RoomMember object for the local user. More... | |
const QString & | id () const |
QString | version () const |
bool | isUnstable () const |
QString | predecessorId () const |
Room * | predecessor (JoinStates statesFilter=JoinState::Invite|JoinState::Join) const |
Room predecessor. More... | |
QString | successorId () const |
Room * | successor (JoinStates statesFilter=JoinState::Invite|JoinState::Join) const |
Room successor. More... | |
QString | name () const |
QString | canonicalAlias () const |
QStringList | altAliases () const |
QStringList | aliases () const |
Get a list of both canonical and alternative aliases. More... | |
QString | displayName () const |
QStringList | pinnedEventIds () const |
QVector< const RoomEvent * > | pinnedEvents () const |
QString | displayNameForHtml () const |
QString | topic () const |
QString | avatarMediaId () const |
QUrl | avatarUrl () const |
const Avatar & | avatarObject () const |
Q_INVOKABLE JoinState | joinState () const |
int | timelineSize () const |
bool | usesEncryption () const |
RoomEventPtr | decryptMessage (const EncryptedEvent &encryptedEvent) |
void | handleRoomKeyEvent (const RoomKeyEvent &roomKeyEvent, const QString &senderId, const QByteArray &olmSessionId, const QByteArray &senderKey, const QByteArray &senderEdKey) |
int | joinedCount () const |
int | invitedCount () const |
int | totalMemberCount () const |
GetRoomEventsJob * | eventsHistoryJob () const |
Q_INVOKABLE QImage | avatar (int dimension) |
Q_INVOKABLE QImage | avatar (int width, int height) |
Q_INVOKABLE RoomMember | member (const QString &userId) const |
Get a RoomMember object for the given user Matrix ID. More... | |
QList< RoomMember > | joinedMembers () const |
Get a list of room members who have joined the room. More... | |
QList< RoomMember > | members () const |
Get a list of all members known to the room. More... | |
QList< RoomMember > | membersLeft () const |
Get a list of all members known to have left the room. More... | |
QList< RoomMember > | membersTyping () const |
Get a list of room members who are currently sending a typing indicator. More... | |
QList< RoomMember > | otherMembersTyping () const |
Get a list of room members who are currently sending a typing indicator. More... | |
QStringList | joinedMemberIds () const |
Get a list of room member Matrix IDs who have joined the room. More... | |
QStringList | memberIds () const |
Get a list of all member Matrix IDs known to the room. More... | |
bool | needsDisambiguation (const QString &userId) const |
Whether the name for the given member should be disambiguated. More... | |
Q_INVOKABLE Quotient::Membership | memberState (const QString &userId) const |
Check the join state of a given user in this room. More... | |
Q_INVOKABLE bool | isMember (const QString &userId) const |
Check whether a user with the given id is a member of the room. More... | |
const Avatar & | memberAvatarObject (const QString &memberId) const |
Q_INVOKABLE QImage | memberAvatar (const QString &memberId, int width, int height) |
Get a avatar of the specified dimensions. More... | |
Q_INVOKABLE QImage | memberAvatar (const QString &memberId, int dimension) |
Get a square avatar of the specified size. More... | |
const Timeline & | messageEvents () const |
const PendingEvents & | pendingEvents () const |
int | requestedHistorySize () const |
Get the number of requested historical events. More... | |
bool | allHistoryLoaded () const |
rev_iter_t | historyEdge () const |
Get a reverse iterator at the position before the "oldest" event. More... | |
Timeline::const_iterator | syncEdge () const |
Get an iterator for the position beyond the latest arrived event. More... | |
Q_INVOKABLE Quotient::TimelineItem::index_t | minTimelineIndex () const |
Q_INVOKABLE Quotient::TimelineItem::index_t | maxTimelineIndex () const |
Q_INVOKABLE bool | isValidIndex (Quotient::TimelineItem::index_t timelineIndex) const |
rev_iter_t | findInTimeline (TimelineItem::index_t index) const |
rev_iter_t | findInTimeline (const QString &evtId) const |
PendingEvents::iterator | findPendingEvent (const QString &txnId) |
PendingEvents::const_iterator | findPendingEvent (const QString &txnId) const |
const RelatedEvents | relatedEvents (const QString &evtId, EventRelation::reltypeid_t relType) const |
const RelatedEvents | relatedEvents (const RoomEvent &evt, EventRelation::reltypeid_t relType) const |
const RoomCreateEvent * | creation () const |
const RoomTombstoneEvent * | tombstone () const |
bool | displayed () const |
void | setDisplayed (bool displayed=true) |
Mark the room as currently displayed to the user. More... | |
QString | firstDisplayedEventId () const |
rev_iter_t | firstDisplayedMarker () const |
void | setFirstDisplayedEventId (const QString &eventId) |
void | setFirstDisplayedEvent (TimelineItem::index_t index) |
QString | lastDisplayedEventId () const |
rev_iter_t | lastDisplayedMarker () const |
void | setLastDisplayedEventId (const QString &eventId) |
void | setLastDisplayedEvent (TimelineItem::index_t index) |
ReadReceipt | lastReadReceipt (const QString &userId) const |
Get the latest read receipt from a user. More... | |
ReadReceipt | lastLocalReadReceipt () const |
Get the latest read receipt from the local user. More... | |
rev_iter_t | localReadReceiptMarker () const |
Find the timeline item the local read receipt is at. More... | |
QString | lastFullyReadEventId () const |
Get the latest event id marked as fully read. More... | |
rev_iter_t | fullyReadMarker () const |
Get the iterator to the latest timeline item marked as fully read. More... | |
QSet< QString > | userIdsAtEvent (const QString &eventId) const |
Get users whose latest read receipts point to the event. More... | |
Q_INVOKABLE void | markMessagesAsRead (const QString &uptoEventId) |
Mark the event with uptoEventId as fully read. More... | |
virtual bool | isEventNotable (const TimelineItem &ti) const |
Determine whether an event should be counted as unread. More... | |
Notification | notificationFor (const TimelineItem &ti) const |
Get notification details for an event. More... | |
EventStats | partiallyReadStats () const |
Get event statistics since the fully read marker. More... | |
EventStats | unreadStats () const |
Get event statistics since the last read receipt. More... | |
qsizetype | notificationCount () const |
Get the number of notifications since the last read receipt. More... | |
qsizetype | highlightCount () const |
Get the number of highlights since the last read receipt. More... | |
bool | hasAccountData (const QString &type) const |
const EventPtr & | accountData (const QString &type) const |
QStringList | accountDataEventTypes () const |
QStringList | tagNames () const |
TagsMap | tags () const |
Tag | tag (const QString &name) const |
void | addTag (const QString &name, const Tag &tagData={}) |
Q_INVOKABLE void | addTag (const QString &name, float order) |
Q_INVOKABLE void | removeTag (const QString &name) |
Remove a tag from the room. More... | |
void | setTags (TagsMap newTags, ActionScope applyOn=ThisRoomOnly) |
bool | isFavourite () const |
Check whether the list of tags has m.favourite. More... | |
bool | isLowPriority () const |
Check whether the list of tags has m.lowpriority. More... | |
bool | isServerNoticeRoom () const |
Check whether this room is for server notices (MSC1452) More... | |
Q_INVOKABLE bool | isDirectChat () const |
Check whether this room is a direct chat. More... | |
QList< RoomMember > | directChatMembers () const |
Get the list of members this room is a direct chat with. More... | |
Q_INVOKABLE QUrl | makeMediaUrl (const QString &eventId, const QUrl &mxcUrl) const |
Q_INVOKABLE QUrl | urlToThumbnail (const QString &eventId) const |
Q_INVOKABLE QUrl | urlToDownload (const QString &eventId) const |
Q_INVOKABLE QString | fileNameToDownload (const QString &eventId) const |
Get a file name for downloading for a given event id. More... | |
Q_INVOKABLE Quotient::FileTransferInfo | fileTransferInfo (const QString &id) const |
Get information on file upload/download. More... | |
Q_INVOKABLE QUrl | fileSource (const QString &id) const |
Get the URL to the actual file source in a unified way. More... | |
Q_INVOKABLE QString | prettyPrint (const QString &plainText) const |
MemberSorter | memberSorter () const |
Q_INVOKABLE bool | supportsCalls () const |
Q_INVOKABLE bool | canSwitchVersions () const |
Whether the current user is allowed to upgrade the room. More... | |
RoomStateView | currentState () const |
Get the current room state. More... | |
Q_INVOKABLE int | memberEffectivePowerLevel (const QString &memberId={}) const |
The effective power level of the given member in the room. More... | |
Q_INVOKABLE int | powerLevelFor (const QString &eventTypeId, bool forceStateEvent=false) const |
Get the power level required to send events of the given type. More... | |
template<EventClass EvT> | |
int | powerLevelFor () const |
Get the power level required to send events of the given type. More... | |
const PendingEventItem & | post (RoomEventPtr event) |
Post a pre-created room message event. More... | |
template<typename EvT , typename... ArgTs> | |
const PendingEventItem & | post (ArgTs &&... args) |
QString | postFile (const QString &plainText, std::unique_ptr< EventContent::FileContentBase > fileContent) |
PendingEventItem::future_type | whenMessageMerged (QString txnId) const |
SetRoomStateWithKeyJob * | setState (const StateEvent &evt) |
Send a request to update the room state with the given event. More... | |
template<typename EvT , typename... ArgTs> | |
auto | setState (ArgTs &&... args) |
Set a state event of the given type with the given arguments. More... | |
void | addMegolmSessionFromBackup (const QByteArray &sessionId, const QByteArray &sessionKey, uint32_t index, const QByteArray &senderKey, const QByteArray &senderEdKey) |
Q_INVOKABLE void | startVerification () |
QJsonArray | exportMegolmSessions () |
Protected Member Functions | |
virtual Changes | processStateEvent (const RoomEvent &e) |
virtual Changes | processEphemeralEvent (EventPtr &&event) |
virtual Changes | processAccountDataEvent (EventPtr &&event) |
virtual void | onAddNewTimelineEvents (timeline_iter_t) |
virtual void | onAddHistoricalTimelineEvents (rev_iter_t) |
virtual void | onRedaction (const RoomEvent &, const RoomEvent &) |
virtual QJsonObject | toJson () const |
virtual void | updateData (SyncRoomData &&data, bool fromCache=false) |
virtual Notification | checkForNotifications (const TimelineItem &ti) |
Properties | |
Connection * | connection |
RoomMember | localMember |
QString | id |
QString | version |
bool | isUnstable |
QString | predecessorId |
QString | successorId |
QString | name |
QStringList | aliases |
QStringList | altAliases |
QString | canonicalAlias |
QString | displayName |
QStringList | pinnedEventIds |
QString | displayNameForHtml |
QString | topic |
QString | avatarMediaId |
QUrl | avatarUrl |
bool | usesEncryption |
int | timelineSize |
int | joinedCount |
int | invitedCount |
int | totalMemberCount |
QList< RoomMember > | membersTyping |
QList< RoomMember > | otherMembersTyping |
int | localMemberEffectivePowerLevel |
bool | displayed |
QString | firstDisplayedEventId |
QString | lastDisplayedEventId |
QString | lastFullyReadEventId |
qsizetype | highlightCount |
qsizetype | notificationCount |
EventStats | partiallyReadStats |
EventStats | unreadStats |
bool | allHistoryLoaded |
QStringList | tagNames |
bool | isFavourite |
bool | isLowPriority |
GetRoomEventsJob * | eventsHistoryJob |
int | requestedHistorySize |
QStringList | accountDataEventTypes |
Friends | |
class | Connection |
using Quotient::Room::PendingEvents = std::vector<PendingEventItem> |
using Quotient::Room::RelatedEvents = QVector<const RoomEvent*> |
using Quotient::Room::rev_iter_t = Timeline::const_reverse_iterator |
using Quotient::Room::Timeline = std::deque<TimelineItem> |
using Quotient::Room::timeline_iter_t = Timeline::const_iterator |
The scope to apply an action on.
This enumeration is used to pick a strategy to propagate certain actions on the room to its predecessors and successors.
|
strong |
Room changes that can be tracked using Room::changed() signal.
This enumeration lists kinds of changes that can be tracked with a "cumulative" changed() signal instead of using individual signals for each change. Specific enumerators mention these individual signals.
Enumerator | |
---|---|
None | No changes occurred in the room. |
RoomNames |
|
Topic |
|
PartiallyReadStats |
|
Avatar |
|
JoinState |
|
Tags |
|
Members |
|
UnreadStats |
|
Summary |
|
Highlights |
|
Other | A catch-all value that covers changes not listed above (such as encryption turned on or the room having been upgraded), as well as changes in the room state that the library is not aware of (e.g., custom state events) and m.read/m.fully_read position changes.
|
Any | This is intended to test a Change/Changes value for non-emptiness; adding
|
Quotient::Room::Room | ( | Connection * | connection, |
QString | id, | ||
JoinState | initialJoinState | ||
) |
|
override |
|
signal |
|
signal |
const EventPtr& Quotient::Room::accountData | ( | const QString & | type | ) | const |
Get a generic account data event of the given type This returns a generic hash map for any room account data event stored on the server. Tags and read markers cannot be retrieved using this method yet.
|
signal |
|
signal |
QStringList Quotient::Room::accountDataEventTypes | ( | ) | const |
Get a list of all room account data events
|
slot |
Activates encryption for this room. Warning: Cannot be undone
|
signal |
void Quotient::Room::addMegolmSessionFromBackup | ( | const QByteArray & | sessionId, |
const QByteArray & | sessionKey, | ||
uint32_t | index, | ||
const QByteArray & | senderKey, | ||
const QByteArray & | senderEdKey | ||
) |
void Quotient::Room::addTag | ( | const QString & | name, |
const Tag & | tagData = {} |
||
) |
Add a new tag to this room If this room already has this tag, nothing happens. If it's a new tag for the room, the respective tag record is added to the set of tags and the new set is sent to the server to update other clients.
Q_INVOKABLE void Quotient::Room::addTag | ( | const QString & | name, |
float | order | ||
) |
QStringList Quotient::Room::aliases | ( | ) | const |
Get a list of both canonical and alternative aliases.
bool Quotient::Room::allHistoryLoaded | ( | ) | const |
Check whether all historical messages are already loaded
|
signal |
|
signal |
The previously lazy-loaded members list is now loaded entirely
QStringList Quotient::Room::altAliases | ( | ) | const |
|
slot |
Q_INVOKABLE QImage Quotient::Room::avatar | ( | int | dimension | ) |
Returns a square room avatar with the given size and requests it from the network if needed
Q_INVOKABLE QImage Quotient::Room::avatar | ( | int | width, |
int | height | ||
) |
Returns a room avatar with the given dimensions and requests it from the network if needed
|
signal |
QString Quotient::Room::avatarMediaId | ( | ) | const |
const Avatar& Quotient::Room::avatarObject | ( | ) | const |
QUrl Quotient::Room::avatarUrl | ( | ) | const |
|
slot |
|
signal |
Initial set of state events has been loaded.
The initial set is what comes from the initial sync for the room. This includes all basic things like RoomCreateEvent, RoomNameEvent, a (lazy-loaded, not full) set of RoomMemberEvents etc. This is a per-room reflection of Connection::loadedRoomState
|
signal |
The room is about to be deleted.
|
signal |
|
slot |
QString Quotient::Room::canonicalAlias | ( | ) | const |
Q_INVOKABLE bool Quotient::Room::canSwitchVersions | ( | ) | const |
Whether the current user is allowed to upgrade the room.
|
signal |
A common signal for various kinds of changes in the room Aside from all changes in the room state
changes | a set of flags describing what changes occurred upon the last sync |
|
protectedvirtual |
|
slot |
Check whether the room should be upgraded
Connection* Quotient::Room::connection | ( | ) | const |
const RoomCreateEvent* Quotient::Room::creation | ( | ) | const |
RoomStateView Quotient::Room::currentState | ( | ) | const |
Get the current room state.
RoomEventPtr Quotient::Room::decryptMessage | ( | const EncryptedEvent & | encryptedEvent | ) |
QList<RoomMember> Quotient::Room::directChatMembers | ( | ) | const |
Get the list of members this room is a direct chat with.
|
slot |
bool Quotient::Room::displayed | ( | ) | const |
|
signal |
QString Quotient::Room::displayName | ( | ) | const |
|
signal |
|
signal |
QString Quotient::Room::displayNameForHtml | ( | ) | const |
|
slot |
|
signal |
GetRoomEventsJob* Quotient::Room::eventsHistoryJob | ( | ) | const |
|
signal |
QJsonArray Quotient::Room::exportMegolmSessions | ( | ) |
Q_INVOKABLE QString Quotient::Room::fileNameToDownload | ( | const QString & | eventId | ) | const |
Get a file name for downloading for a given event id.
The event MUST be RoomMessageEvent and have content for downloading.
Q_INVOKABLE QUrl Quotient::Room::fileSource | ( | const QString & | id | ) | const |
Get the URL to the actual file source in a unified way.
For uploads it will return a URL to a local file; for downloads the URL will be taken from the corresponding room event.
|
signal |
|
signal |
Q_INVOKABLE Quotient::FileTransferInfo Quotient::Room::fileTransferInfo | ( | const QString & | id | ) | const |
Get information on file upload/download.
id | uploads are identified by the corresponding event's transactionId (because uploads are done before the event is even sent), while downloads are using the normal event id for identifier. |
|
signal |
rev_iter_t Quotient::Room::findInTimeline | ( | const QString & | evtId | ) | const |
rev_iter_t Quotient::Room::findInTimeline | ( | TimelineItem::index_t | index | ) | const |
PendingEvents::iterator Quotient::Room::findPendingEvent | ( | const QString & | txnId | ) |
PendingEvents::const_iterator Quotient::Room::findPendingEvent | ( | const QString & | txnId | ) | const |
|
signal |
QString Quotient::Room::firstDisplayedEventId | ( | ) | const |
rev_iter_t Quotient::Room::firstDisplayedMarker | ( | ) | const |
rev_iter_t Quotient::Room::fullyReadMarker | ( | ) | const |
Get the iterator to the latest timeline item marked as fully read.
This method calls findInTimeline on the result of lastFullyReadEventId. If the fully read marker turns out to be outside the timeline (because the event marked as fully read is too far back in the history) the returned value will be equal to historyEdge.
Be sure to read the caveats on iterators returned by findInTimeline.
|
signal |
|
slot |
void Quotient::Room::handleRoomKeyEvent | ( | const RoomKeyEvent & | roomKeyEvent, |
const QString & | senderId, | ||
const QByteArray & | olmSessionId, | ||
const QByteArray & | senderKey, | ||
const QByteArray & | senderEdKey | ||
) |
|
slot |
bool Quotient::Room::hasAccountData | ( | const QString & | type | ) | const |
Check whether the room has account data of the given type Tags and read markers are not supported by this method yet.
qsizetype Quotient::Room::highlightCount | ( | ) | const |
Get the number of highlights since the last read receipt.
As of 0.7, this is defined by the homeserver as Quotient doesn't process push rules.
|
signal |
rev_iter_t Quotient::Room::historyEdge | ( | ) | const |
Get a reverse iterator at the position before the "oldest" event.
Same as messageEvents().crend()
const QString& Quotient::Room::id | ( | ) | const |
|
slot |
int Quotient::Room::invitedCount | ( | ) | const |
|
slot |
Q_INVOKABLE bool Quotient::Room::isDirectChat | ( | ) | const |
Check whether this room is a direct chat.
|
virtual |
Determine whether an event should be counted as unread.
The criteria of including an event in unread counters are described in MSC2654; according to these, the event should be counted as unread (or, in libQuotient parlance, is "notable") if it is:
m.room.topic
, m.room.name
, m.room.avatar
, m.room.tombstone
;bool Quotient::Room::isFavourite | ( | ) | const |
Check whether the list of tags has m.favourite.
bool Quotient::Room::isLowPriority | ( | ) | const |
Check whether the list of tags has m.lowpriority.
Q_INVOKABLE bool Quotient::Room::isMember | ( | const QString & | userId | ) | const |
Check whether a user with the given id is a member of the room.
bool Quotient::Room::isServerNoticeRoom | ( | ) | const |
Check whether this room is for server notices (MSC1452)
bool Quotient::Room::isUnstable | ( | ) | const |
Q_INVOKABLE bool Quotient::Room::isValidIndex | ( | Quotient::TimelineItem::index_t | timelineIndex | ) | const |
int Quotient::Room::joinedCount | ( | ) | const |
QStringList Quotient::Room::joinedMemberIds | ( | ) | const |
Get a list of room member Matrix IDs who have joined the room.
QList<RoomMember> Quotient::Room::joinedMembers | ( | ) | const |
Get a list of room members who have joined the room.
Q_INVOKABLE JoinState Quotient::Room::joinState | ( | ) | const |
|
signal |
|
slot |
|
signal |
QString Quotient::Room::lastDisplayedEventId | ( | ) | const |
rev_iter_t Quotient::Room::lastDisplayedMarker | ( | ) | const |
QString Quotient::Room::lastFullyReadEventId | ( | ) | const |
Get the latest event id marked as fully read.
This can be either the event id pointed to by the actual latest m.fully_read event, or the latest event id marked locally as fully read if markMessagesAsRead or markAllMessagesAsRead has been called and the homeserver didn't return an updated m.fully_read event yet.
ReadReceipt Quotient::Room::lastLocalReadReceipt | ( | ) | const |
Get the latest read receipt from the local user.
This is a shortcut for lastReadReceipt(localUserId)
.
|
signal |
The event the m.read receipt points to has changed for the listed users
ReadReceipt Quotient::Room::lastReadReceipt | ( | const QString & | userId | ) | const |
Get the latest read receipt from a user.
The user id must be valid. A read receipt with an empty event id is returned if the user id is valid but there was no read receipt from them.
|
slot |
RoomMember Quotient::Room::localMember | ( | ) | const |
Get a RoomMember object for the local user.
rev_iter_t Quotient::Room::localReadReceiptMarker | ( | ) | const |
Find the timeline item the local read receipt is at.
This is a shortcut for
Q_INVOKABLE QUrl Quotient::Room::makeMediaUrl | ( | const QString & | eventId, |
const QUrl & | mxcUrl | ||
) | const |
|
slot |
Put the fully-read marker at the latest message in the room.
Q_INVOKABLE void Quotient::Room::markMessagesAsRead | ( | const QString & | uptoEventId | ) |
Mark the event with uptoEventId as fully read.
Marks the event with the specified id as fully read locally and also sends an update to m.fully_read account data to the server either for this message or, if it's from the local user, for the nearest non-local message before. uptoEventId must point to a known event in the timeline; the method will do nothing if the event is behind the current m.fully_read marker or is not loaded, to prevent accidentally trying to move the marker back in the timeline.
Q_INVOKABLE Quotient::TimelineItem::index_t Quotient::Room::maxTimelineIndex | ( | ) | const |
Q_INVOKABLE RoomMember Quotient::Room::member | ( | const QString & | userId | ) | const |
Get a RoomMember object for the given user Matrix ID.
Will return a nullptr if there is no m.room.member event for the user in the room so needs to be null checked.
Q_INVOKABLE QImage Quotient::Room::memberAvatar | ( | const QString & | memberId, |
int | dimension | ||
) |
Get a square avatar of the specified size.
This is an overload for the case when the needed width and height are equal.
Q_INVOKABLE QImage Quotient::Room::memberAvatar | ( | const QString & | memberId, |
int | width, | ||
int | height | ||
) |
Get a avatar of the specified dimensions.
This always returns immediately; if there's no avatar cached yet, the call triggers a network request, that will emit Room::memberAvatarUpdated() once completed.
const Avatar& Quotient::Room::memberAvatarObject | ( | const QString & | memberId | ) | const |
|
signal |
A known joined member has updated their avatar.
Q_INVOKABLE int Quotient::Room::memberEffectivePowerLevel | ( | const QString & | memberId = {} | ) | const |
The effective power level of the given member in the room.
This is normally the same as calling RoomPowerLevelEvent::powerLevelForUser(userId)
but takes into account the room context and works even if the room state has no power levels event. It is THE recommended way to get a room member's power level to display in the UI.
memberId | The room member ID to check; if empty, the local user will be checked |
QStringList Quotient::Room::memberIds | ( | ) | const |
Get a list of all member Matrix IDs known to the room.
|
signal |
A new member has joined the room.
This can be from any previous state or a member previously unknown to the room.
|
signal |
A member who previously joined has left.
The member will still be known to the room their membership state has changed from Membership::Join to anything else.
|
signal |
The list of members has changed.
Emitted no more than once per sync, this is a good signal to for cases when some action should be done upon any change in the member list. If you need per-item granularity you should use userAdded, userRemoved and memberAboutToRename / memberRenamed instead.
|
signal |
A known joined member is about to update their display name.
|
signal |
A known joined member has updated their display name.
QList<RoomMember> Quotient::Room::members | ( | ) | const |
Get a list of all members known to the room.
QList<RoomMember> Quotient::Room::membersLeft | ( | ) | const |
Get a list of all members known to have left the room.
MemberSorter Quotient::Room::memberSorter | ( | ) | const |
Q_INVOKABLE Quotient::Membership Quotient::Room::memberState | ( | const QString & | userId | ) | const |
Check the join state of a given user in this room.
QList<RoomMember> Quotient::Room::membersTyping | ( | ) | const |
Get a list of room members who are currently sending a typing indicator.
const Timeline& Quotient::Room::messageEvents | ( | ) | const |
|
signal |
The server accepted the message.
This is emitted when an event sending request has successfully completed. This does not mean that the event is already in the local timeline, only that the server has accepted it.
txnId | transaction id assigned by the client during sending |
eventId | event id assigned by the server upon acceptance |
Q_INVOKABLE Quotient::TimelineItem::index_t Quotient::Room::minTimelineIndex | ( | ) | const |
QString Quotient::Room::name | ( | ) | const |
|
signal |
The room name, the canonical alias or other aliases changed.
Not triggered when display name changes.
bool Quotient::Room::needsDisambiguation | ( | const QString & | userId | ) | const |
Whether the name for the given member should be disambiguated.
|
signal |
qsizetype Quotient::Room::notificationCount | ( | ) | const |
Get the number of notifications since the last read receipt.
This is the same as unreadStats().notableCount
.
|
signal |
Notification Quotient::Room::notificationFor | ( | const TimelineItem & | ti | ) | const |
Get notification details for an event.
This allows to get details on the kind of notification that should generated for evt
.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
QList<RoomMember> Quotient::Room::otherMembersTyping | ( | ) | const |
Get a list of room members who are currently sending a typing indicator.
The local member is excluded from this list.
EventStats Quotient::Room::partiallyReadStats | ( | ) | const |
Get event statistics since the fully read marker.
This call returns a structure containing:
Note that this is different from the unread count defined by MSC2654 and from the notification/highlight numbers defined by the spec in that it counts events since the fully read marker, not since the last read receipt position.
As E2EE is not supported in the library, the returned result will always be an estimate (isEstimate == true
) for encrypted rooms; moreover, since the library doesn't know how to tackle push rules yet the number of highlights returned here will always be zero (there's no good substitute for that now).
|
signal |
|
signal |
The event is about to be appended to the list of pending events.
|
signal |
An event will be removed from the list of pending events.
|
signal |
The remote echo has arrived with the sync and will be merged with its local counterpart NB: Requires a sync loop to be emitted
|
signal |
An event has been appended to the list of pending events.
|
signal |
The status of a pending event has changed.
|
signal |
An event has just been removed from the list of pending events.
|
signal |
The remote and local copies of the event have been merged.
NB: Requires a sync loop to be emitted
const PendingEvents& Quotient::Room::pendingEvents | ( | ) | const |
QStringList Quotient::Room::pinnedEventIds | ( | ) | const |
QVector<const RoomEvent*> Quotient::Room::pinnedEvents | ( | ) | const |
|
signal |
|
inline |
const PendingEventItem& Quotient::Room::post | ( | RoomEventPtr | event | ) |
Post a pre-created room message event.
Takes ownership of the event, deleting it once the matching one arrives with the sync.
post*
) method returns; it can be queued internally.
|
slot |
Post a pre-created room message event
Takes ownership of the event, deleting it once the matching one arrives with the sync
QString Quotient::Room::postFile | ( | const QString & | plainText, |
std::unique_ptr< EventContent::FileContentBase > | fileContent | ||
) |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
Send a reaction on a given event with a given key.
|
inline |
Get the power level required to send events of the given type.
This is an optimised version of non-template powerLevelFor() (with the same caveat about operations based on some event types) for cases when the event type is known at build time.
EvT | the event type to get the power level for |
Q_INVOKABLE int Quotient::Room::powerLevelFor | ( | const QString & | eventTypeId, |
bool | forceStateEvent = false |
||
) | const |
Get the power level required to send events of the given type.
true
as the second parameter to override that. Room* Quotient::Room::predecessor | ( | JoinStates | statesFilter = JoinState::Invite|JoinState::Join | ) | const |
Room predecessor.
This function validates that the predecessor has a tombstone and the tombstone refers to the current room. If that's not the case, or if the predecessor is in a join state not matching stateFilter
, the function returns nullptr.
QString Quotient::Room::predecessorId | ( | ) | const |
Q_INVOKABLE QString Quotient::Room::prettyPrint | ( | const QString & | plainText | ) | const |
Pretty-prints plain text into HTML As of now, it's exactly the same as Quotient::prettyPrint(); in the future, it will also linkify room aliases, mxids etc. using the room context.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
slot |
|
slot |
You shouldn't normally call this method; it's here for debugging.
const RelatedEvents Quotient::Room::relatedEvents | ( | const QString & | evtId, |
EventRelation::reltypeid_t | relType | ||
) | const |
const RelatedEvents Quotient::Room::relatedEvents | ( | const RoomEvent & | evt, |
EventRelation::reltypeid_t | relType | ||
) | const |
Q_INVOKABLE void Quotient::Room::removeTag | ( | const QString & | name | ) |
Remove a tag from the room.
|
signal |
int Quotient::Room::requestedHistorySize | ( | ) | const |
Get the number of requested historical events.
|
slot |
|
slot |
|
slot |
void Quotient::Room::setDisplayed | ( | bool | displayed = true | ) |
Mark the room as currently displayed to the user.
Marking the room displayed causes the room to obtain the full list of members if it's been lazy-loaded before; in the future it may do more things bound to "screen time" of the room, e.g. measure that "screen time".
void Quotient::Room::setFirstDisplayedEvent | ( | TimelineItem::index_t | index | ) |
void Quotient::Room::setFirstDisplayedEventId | ( | const QString & | eventId | ) |
void Quotient::Room::setLastDisplayedEvent | ( | TimelineItem::index_t | index | ) |
void Quotient::Room::setLastDisplayedEventId | ( | const QString & | eventId | ) |
|
slot |
Set room aliases on the user's current server.
|
slot |
|
slot |
|
slot |
Set a given event as last read and post a read receipt on it.
Does nothing if the event is behind the current read receipt.
|
inline |
|
slot |
Send a request to update the room state based on freeform inputs.
SetRoomStateWithKeyJob* Quotient::Room::setState | ( | const StateEvent & | evt | ) |
Send a request to update the room state with the given event.
void Quotient::Room::setTags | ( | TagsMap | newTags, |
ActionScope | applyOn = ThisRoomOnly |
||
) |
Overwrite the room's tags This completely replaces the existing room's tags with a set of new ones and updates the new set on the server. Unlike most other methods in Room, this one sends a signal about changes immediately, not waiting for confirmation from the server (because tags are saved in account data rather than in shared room state).
applyOn | setting this to Room::OnAllConversations will set tags on this and all known predecessors and successors; by default only the current room is changed |
|
slot |
|
signal |
The room's version stability may have changed.
Q_INVOKABLE void Quotient::Room::startVerification | ( | ) |
Room* Quotient::Room::successor | ( | JoinStates | statesFilter = JoinState::Invite|JoinState::Join | ) | const |
Room successor.
This function validates that the successor room's creation event refers to the current room. If that's not the case, or if the successor is in a join state not matching stateFilter
, it returns nullptr.
QString Quotient::Room::successorId | ( | ) | const |
Q_INVOKABLE bool Quotient::Room::supportsCalls | ( | ) | const |
|
slot |
Switch the room's version (aka upgrade)
Timeline::const_iterator Quotient::Room::syncEdge | ( | ) | const |
Get an iterator for the position beyond the latest arrived event.
Same as messageEvents().cend()
Tag Quotient::Room::tag | ( | const QString & | name | ) | const |
QStringList Quotient::Room::tagNames | ( | ) | const |
TagsMap Quotient::Room::tags | ( | ) | const |
|
signal |
|
signal |
int Quotient::Room::timelineSize | ( | ) | const |
|
protectedvirtual |
const RoomTombstoneEvent* Quotient::Room::tombstone | ( | ) | const |
QString Quotient::Room::topic | ( | ) | const |
|
signal |
int Quotient::Room::totalMemberCount | ( | ) | const |
|
signal |
The list of members sending typing indicators has changed.
|
slot |
EventStats Quotient::Room::unreadStats | ( | ) | const |
Get event statistics since the last read receipt.
This call returns a structure that contains the following three numbers, all counted on the timeline segment between the event pointed to by the m.fully_read marker and the sync edge:
As E2EE is not supported in the library, the returned result will always be an estimate (isEstimate == true
) for encrypted rooms; moreover, since the library doesn't know how to tackle push rules yet the number of highlights returned here will always be zero - use highlightCount() for now.
|
signal |
|
protectedvirtual |
|
signal |
|
signal |
This room has been upgraded and won't receive updates any more.
|
signal |
An attempted room upgrade has failed.
|
slot |
Q_INVOKABLE QUrl Quotient::Room::urlToDownload | ( | const QString & | eventId | ) | const |
Q_INVOKABLE QUrl Quotient::Room::urlToThumbnail | ( | const QString & | eventId | ) | const |
QSet<QString> Quotient::Room::userIdsAtEvent | ( | const QString & | eventId | ) | const |
Get users whose latest read receipts point to the event.
This method is for cases when you need to show users who have read an event. Calling it on inexistent or empty event id will return an empty set.
bool Quotient::Room::usesEncryption | ( | ) | const |
QString Quotient::Room::version | ( | ) | const |
PendingEventItem::future_type Quotient::Room::whenMessageMerged | ( | QString | txnId | ) | const |
|
friend |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
readwrite |
|
read |
|
read |