22 QUO_EVENT(RoomMessageEvent,
"m.room.message")
36 RoomMessageEvent(
const QString& plainBody,
const QString& jsonMsgType,
37 std::unique_ptr<EventContent::Base> content =
nullptr,
38 const std::optional<EventRelation>& relatesTo = std::nullopt);
39 explicit RoomMessageEvent(
const QString& plainBody, MsgType msgType = MsgType::Text,
40 std::unique_ptr<EventContent::Base> content =
nullptr,
41 const std::optional<EventRelation>& relatesTo = std::nullopt);
43 explicit RoomMessageEvent(
const QJsonObject& obj);
45 MsgType msgtype()
const;
46 QString rawMsgtype()
const;
47 QString plainBody()
const;
60 std::unique_ptr<EventContent::Base> content()
const;
63 void setContent(std::unique_ptr<EventContent::Base> content);
69 template <std::derived_from<EventContent::Base> ContentT>
70 bool has()
const {
return false; }
76 template <std::derived_from<EventContent::Base> ContentT>
77 std::unique_ptr<ContentT> get()
const
79 return has<ContentT>()
80 ? std::unique_ptr<ContentT>(
static_cast<ContentT*>(content().release()))
84 QMimeType mimeType()
const;
92 bool hasThumbnail()
const;
95 EventContent::Thumbnail getThumbnail()
const;
101 std::optional<EventRelation> relatesTo()
const;
111 QString upstreamEventId()
const;
115 QString replacedEvent()
const;
121 bool isReplaced()
const;
123 QString replacedBy()
const;
136 bool isReply(
bool includeFallbacks =
false)
const;
145 QString replyEventId(
bool includeFallbacks =
false)
const;
152 bool isThreaded()
const;
159 QString threadRootEventId()
const;
161 QString fileNameToDownload()
const;
163 void updateFileSourceInfo(
const FileSourceInfo& fsi);
165 static QString rawMsgTypeForUrl(
const QUrl& url);
166 static QString rawMsgTypeForFile(
const QFileInfo& fi);
170 static QJsonObject assembleContentJson(
const QString& plainBody,
const QString& jsonMsgType,
171 std::unique_ptr<EventContent::Base> content,
172 const std::optional<EventRelation>& relatesTo);
177 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::TextContent>()
const;
178 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::LocationContent>()
const;
179 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::FileContentBase>()
const;
180 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::FileContent>()
const;
181 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::ImageContent>()
const;
182 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::AudioContent>()
const;
183 template <>
QUOTIENT_API bool RoomMessageEvent::has<EventContent::VideoContent>()
const;
185 using MessageEventType = RoomMessageEvent::MsgType;