libQuotient
A Qt library for building matrix clients
Quotient::RoomEvent Class Reference

#include <roomevent.h>

Inheritance diagram for Quotient::RoomEvent:
Collaboration diagram for Quotient::RoomEvent:

Public Member Functions

 ~RoomEvent () override
 
QString displayId () const
 A convenience function to get a display string for an event ID. More...
 
QString id () const
 The event_id JSON value for the event. More...
 
QDateTime originTimestamp () const
 
QString roomId () const
 
QString senderId () const
 
bool isRedacted () const
 
const event_ptr_tt< RedactionEvent > & redactedBecause () const
 
QString redactionReason () const
 
QString transactionId () const
 The transaction_id JSON value for the event. More...
 
bool isStateEvent () const
 
QString stateKey () const
 
void setRoomId (const QString &roomId)
 Fill the pending event object with the room id. More...
 
void setSender (const QString &senderId)
 Fill the pending event object with the sender id. More...
 
void setTransactionId (const QString &txnId)
 Fill the pending event object with the transaction id. More...
 
void addId (const QString &newId)
 Add an event id to locally created events after they are sent. More...
 
void setOriginalEvent (event_ptr_tt< EncryptedEvent > &&originalEvent)
 
const EncryptedEventoriginalEvent () const
 
const QJsonObject encryptedJson () const
 
- Public Member Functions inherited from Quotient::Event
virtual const AbstractEventMetaTypemetaType () const
 
 Event (Event &&) noexcept=default
 
Eventoperator= (Event &&)=delete
 
virtual ~Event ()
 
QString matrixType () const
 Exact Matrix type stored in JSON. More...
 
template<EventClass EventT>
bool is () const
 
template<typename... VisitorTs>
auto switchOnType (VisitorTs &&... visitors) const
 Apply one of the visitors based on the actual event type. More...
 
const QJsonObject & fullJson () const
 
const QJsonObject contentJson () const
 
template<typename T , typename KeyT >
const T contentPart (KeyT &&key) const
 Get a part of the content object, assuming a given type. More...
 
const QJsonObject unsignedJson () const
 
template<typename T , typename KeyT >
const T unsignedPart (KeyT &&key) const
 Get a part of the unsigned object, assuming a given type. More...
 
bool isStateEvent () const
 

Protected Member Functions

 RoomEvent (const QJsonObject &json)
 
void dumpTo (QDebug dbg) const override
 
- Protected Member Functions inherited from Quotient::Event
 Event (const QJsonObject &json)
 
QJsonObject & editJson ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Quotient::Event
static QJsonObject basicJson (const QString &matrixType, const QJsonObject &content)
 Make a minimal correct Matrix event JSON. More...
 
- Static Public Attributes inherited from Quotient::Event
static EventMetaType< EventBaseMetaType { "Event" }
 

Detailed Description

Definition at line 22 of file roomevent.h.

Constructor & Destructor Documentation

◆ ~RoomEvent()

Quotient::RoomEvent::~RoomEvent ( )
override

◆ RoomEvent()

Quotient::RoomEvent::RoomEvent ( const QJsonObject &  json)
explicitprotected

Member Function Documentation

◆ addId()

void Quotient::RoomEvent::addId ( const QString &  newId)

Add an event id to locally created events after they are sent.

When a new event is created locally, it has no id; the homeserver assigns it once the event is sent. This function allows to add the id once the confirmation from the server is received. There should be no id set previously in the event. It's the responsibility of the code calling addId() to notify clients about the change; there's no signal or callback for that in RoomEvent.

◆ displayId()

QString Quotient::RoomEvent::displayId ( ) const

A convenience function to get a display string for an event ID.

Returns
id() if the event id is not empty, otherwise transactionId(); this is useful to deal with pending and normal events uniformly.
See also
id(), transactionId()

◆ dumpTo()

void Quotient::RoomEvent::dumpTo ( QDebug  dbg) const
overrideprotectedvirtual

Reimplemented from Quotient::Event.

Reimplemented in Quotient::StateEvent.

◆ encryptedJson()

const QJsonObject Quotient::RoomEvent::encryptedJson ( ) const

◆ id()

QString Quotient::RoomEvent::id ( ) const

The event_id JSON value for the event.

◆ isRedacted()

bool Quotient::RoomEvent::isRedacted ( ) const
inline

Definition at line 40 of file roomevent.h.

◆ isStateEvent()

bool Quotient::RoomEvent::isStateEvent ( ) const

◆ originalEvent()

const EncryptedEvent* Quotient::RoomEvent::originalEvent ( ) const
inline

Definition at line 78 of file roomevent.h.

◆ originTimestamp()

QDateTime Quotient::RoomEvent::originTimestamp ( ) const

◆ redactedBecause()

const event_ptr_tt<RedactionEvent>& Quotient::RoomEvent::redactedBecause ( ) const
inline

Definition at line 41 of file roomevent.h.

◆ redactionReason()

QString Quotient::RoomEvent::redactionReason ( ) const

◆ roomId()

QString Quotient::RoomEvent::roomId ( ) const

◆ senderId()

QString Quotient::RoomEvent::senderId ( ) const

◆ setOriginalEvent()

void Quotient::RoomEvent::setOriginalEvent ( event_ptr_tt< EncryptedEvent > &&  originalEvent)

◆ setRoomId()

void Quotient::RoomEvent::setRoomId ( const QString &  roomId)

Fill the pending event object with the room id.

◆ setSender()

void Quotient::RoomEvent::setSender ( const QString &  senderId)

Fill the pending event object with the sender id.

◆ setTransactionId()

void Quotient::RoomEvent::setTransactionId ( const QString &  txnId)

Fill the pending event object with the transaction id.

Parameters
txnId- transaction id, normally obtained from Connection::generateTxnId()

◆ stateKey()

QString Quotient::RoomEvent::stateKey ( ) const

◆ transactionId()

QString Quotient::RoomEvent::transactionId ( ) const

The transaction_id JSON value for the event.


The documentation for this class was generated from the following file: