aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-23 08:09:28 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-25 13:07:14 +0900
commite997f214562acf30ae8d4ea7132dde6e583ac6fe (patch)
treefbd0fb8ead5c6f32f9ee269a2bc6e3d111e362be
parent25f8622bcdd4322ce9e41c34883cea5ff71a6817 (diff)
downloadlibquotient-e997f214562acf30ae8d4ea7132dde6e583ac6fe.tar.gz
libquotient-e997f214562acf30ae8d4ea7132dde6e583ac6fe.zip
RoomMessageEvent::content(): constify event content
-rw-r--r--lib/events/eventcontent.h2
-rw-r--r--lib/events/roommessageevent.h8
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/events/eventcontent.h b/lib/events/eventcontent.h
index c26cb931..e7656de5 100644
--- a/lib/events/eventcontent.h
+++ b/lib/events/eventcontent.h
@@ -25,6 +25,7 @@
#include <QtCore/QMimeType>
#include <QtCore/QSize>
#include <QtCore/QUrl>
+#include <QtCore/QMetaType>
namespace Quotient {
namespace EventContent {
@@ -276,3 +277,4 @@ namespace EventContent {
using FileContent = UrlWithThumbnailContent<FileInfo>;
} // namespace EventContent
} // namespace Quotient
+Q_DECLARE_METATYPE(const Quotient::EventContent::TypedBase*)
diff --git a/lib/events/roommessageevent.h b/lib/events/roommessageevent.h
index b393382a..e95aabfc 100644
--- a/lib/events/roommessageevent.h
+++ b/lib/events/roommessageevent.h
@@ -34,7 +34,7 @@ class RoomMessageEvent : public RoomEvent {
Q_PROPERTY(QString msgType READ rawMsgtype CONSTANT)
Q_PROPERTY(QString plainBody READ plainBody CONSTANT)
Q_PROPERTY(QMimeType mimeType READ mimeType STORED false CONSTANT)
- Q_PROPERTY(EventContent::TypedBase* content READ content CONSTANT)
+ Q_PROPERTY(const EventContent::TypedBase* content READ content CONSTANT)
public:
DEFINE_EVENT_TYPEID("m.room.message", RoomMessageEvent)
@@ -62,13 +62,13 @@ public:
MsgType msgtype() const;
QString rawMsgtype() const;
QString plainBody() const;
- EventContent::TypedBase* content() const { return _content.data(); }
+ const EventContent::TypedBase* content() const { return _content.data(); }
template <typename VisitorT>
- void editContent(VisitorT visitor)
+ void editContent(VisitorT&& visitor)
{
visitor(*_content);
editJson()[ContentKeyL] = assembleContentJson(plainBody(), rawMsgtype(),
- content());
+ _content.data());
}
QMimeType mimeType() const;
bool hasTextContent() const;