From 2a6cbbff8246dd2f682624d1551facb2813394ad Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 3 Jan 2019 21:08:40 +0900 Subject: RoomMessageEvent: easier creation of file-based events --- lib/events/roommessageevent.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/events/roommessageevent.h') diff --git a/lib/events/roommessageevent.h b/lib/events/roommessageevent.h index 5657135b..d5b570f5 100644 --- a/lib/events/roommessageevent.h +++ b/lib/events/roommessageevent.h @@ -21,6 +21,8 @@ #include "roomevent.h" #include "eventcontent.h" +class QFileInfo; + namespace QMatrixClient { namespace MessageEventContent = EventContent; // Back-compatibility @@ -49,6 +51,9 @@ namespace QMatrixClient explicit RoomMessageEvent(const QString& plainBody, MsgType msgType = MsgType::Text, EventContent::TypedBase* content = nullptr); + explicit RoomMessageEvent(const QString& plainBody, + const QFileInfo& file, + bool asGenericFile = false); explicit RoomMessageEvent(const QJsonObject& obj); MsgType msgtype() const; @@ -68,6 +73,9 @@ namespace QMatrixClient bool hasFileContent() const; bool hasThumbnail() const; + static QString rawMsgTypeForUrl(const QUrl& url); + static QString rawMsgTypeForFile(const QFileInfo& fi); + private: QScopedPointer _content; -- cgit v1.2.3