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

#include <roommessageevent.h>

Inheritance diagram for Quotient::RoomMessageEvent:
Collaboration diagram for Quotient::RoomMessageEvent:

Public Types

enum class  MsgType {
  Text , Emote , Notice , Image ,
  File , Location , Video , Audio ,
  Unknown
}
 

Public Member Functions

 RoomMessageEvent (const QString &plainBody, const QString &jsonMsgType, EventContent::TypedBase *content=nullptr)
 
 RoomMessageEvent (const QString &plainBody, MsgType msgType=MsgType::Text, EventContent::TypedBase *content=nullptr)
 
 RoomMessageEvent (const QJsonObject &obj)
 
MsgType msgtype () const
 
QString rawMsgtype () const
 
QString plainBody () const
 
const EventContent::TypedBasecontent () const
 
void editContent (auto visitor)
 
QMimeType mimeType () const
 
bool hasTextContent () const
 Determine whether the message has text content. More...
 
bool hasFileContent () const
 Determine whether the message has a file/attachment. More...
 
bool hasThumbnail () const
 Determine whether the message has a thumbnail. More...
 
QString replacedEvent () const
 Obtain id of an event replaced by the current one. More...
 
bool isReplaced () const
 Determine whether the event has been replaced. More...
 
QString replacedBy () const
 
QString fileNameToDownload () const
 
- Public Member Functions inherited from Quotient::RoomEvent
 ~RoomEvent () override
 
QString id () const
 
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
 
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
 

Static Public Member Functions

static QString rawMsgTypeForUrl (const QUrl &url)
 
static QString rawMsgTypeForFile (const QFileInfo &fi)
 
- 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...
 

Additional Inherited Members

- Static Public Attributes inherited from Quotient::Event
static EventMetaType< EventBaseMetaType { "Event" }
 
- Protected Member Functions inherited from Quotient::RoomEvent
 RoomEvent (const QJsonObject &json)
 
void dumpTo (QDebug dbg) const override
 
- Protected Member Functions inherited from Quotient::Event
 Event (const QJsonObject &json)
 
QJsonObject & editJson ()
 

Detailed Description

The event class corresponding to m.room.message events

Definition at line 19 of file roommessageevent.h.

Member Enumeration Documentation

◆ MsgType

Enumerator
Text 
Emote 
Notice 
Image 
File 
Location 
Video 
Audio 
Unknown 

Definition at line 24 of file roommessageevent.h.

Constructor & Destructor Documentation

◆ RoomMessageEvent() [1/3]

Quotient::RoomMessageEvent::RoomMessageEvent ( const QString &  plainBody,
const QString &  jsonMsgType,
EventContent::TypedBase content = nullptr 
)

◆ RoomMessageEvent() [2/3]

Quotient::RoomMessageEvent::RoomMessageEvent ( const QString &  plainBody,
MsgType  msgType = MsgType::Text,
EventContent::TypedBase content = nullptr 
)
explicit

◆ RoomMessageEvent() [3/3]

Quotient::RoomMessageEvent::RoomMessageEvent ( const QJsonObject &  obj)
explicit

Member Function Documentation

◆ content()

const EventContent::TypedBase* Quotient::RoomMessageEvent::content ( ) const
inline

Definition at line 47 of file roommessageevent.h.

◆ editContent()

void Quotient::RoomMessageEvent::editContent ( auto  visitor)
inline

Definition at line 48 of file roommessageevent.h.

◆ fileNameToDownload()

QString Quotient::RoomMessageEvent::fileNameToDownload ( ) const

◆ hasFileContent()

bool Quotient::RoomMessageEvent::hasFileContent ( ) const

Determine whether the message has a file/attachment.

Returns
true, if the message has a data structure corresponding to a file (such as m.file or m.audio); false otherwise

◆ hasTextContent()

bool Quotient::RoomMessageEvent::hasTextContent ( ) const

Determine whether the message has text content.

Returns
true, if the message type is one of m.text, m.notice, m.emote, or the message type is unspecified (in which case plainBody() can still be examined); false otherwise

◆ hasThumbnail()

bool Quotient::RoomMessageEvent::hasThumbnail ( ) const

Determine whether the message has a thumbnail.

Returns
true, if the message has a data structure corresponding to a thumbnail (the message type may be one for visual content, such as m.image, or generic binary content, i.e. m.file); false otherwise

◆ isReplaced()

bool Quotient::RoomMessageEvent::isReplaced ( ) const

Determine whether the event has been replaced.

Returns
true if this event has been overridden by another event with "rel_type": "m.replace"; false otherwise

◆ mimeType()

QMimeType Quotient::RoomMessageEvent::mimeType ( ) const

◆ msgtype()

MsgType Quotient::RoomMessageEvent::msgtype ( ) const

◆ plainBody()

QString Quotient::RoomMessageEvent::plainBody ( ) const

◆ rawMsgtype()

QString Quotient::RoomMessageEvent::rawMsgtype ( ) const

◆ rawMsgTypeForFile()

static QString Quotient::RoomMessageEvent::rawMsgTypeForFile ( const QFileInfo &  fi)
static

◆ rawMsgTypeForUrl()

static QString Quotient::RoomMessageEvent::rawMsgTypeForUrl ( const QUrl &  url)
static

◆ replacedBy()

QString Quotient::RoomMessageEvent::replacedBy ( ) const

◆ replacedEvent()

QString Quotient::RoomMessageEvent::replacedEvent ( ) const

Obtain id of an event replaced by the current one.

See also
RoomEvent::isReplaced, RoomEvent::replacedBy

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