aboutsummaryrefslogtreecommitdiff
path: root/events
diff options
context:
space:
mode:
Diffstat (limited to 'events')
-rw-r--r--events/roommessageevent.cpp10
-rw-r--r--events/roommessageevent.h16
2 files changed, 19 insertions, 7 deletions
diff --git a/events/roommessageevent.cpp b/events/roommessageevent.cpp
index 03e84444..a111ef12 100644
--- a/events/roommessageevent.cpp
+++ b/events/roommessageevent.cpp
@@ -31,6 +31,7 @@ class RoomMessageEvent::Private
QString userId;
MessageEventType msgtype;
+ QString plainBody;
QDateTime hsob_ts;
MessageEventContent::Base* content;
};
@@ -57,9 +58,14 @@ MessageEventType RoomMessageEvent::msgtype() const
return d->msgtype;
}
+QString RoomMessageEvent::plainBody() const
+{
+ return d->plainBody;
+}
+
QString RoomMessageEvent::body() const
{
- return d->content->body;
+ return plainBody();
}
QDateTime RoomMessageEvent::hsob_ts() const
@@ -179,7 +185,7 @@ RoomMessageEvent* RoomMessageEvent::fromJson(const QJsonObject& obj)
if( content.contains("body") )
{
- e->d->content->body = content.value("body").toString();
+ e->d->plainBody = content.value("body").toString();
} else {
qDebug() << "RoomMessageEvent: body not found";
}
diff --git a/events/roommessageevent.h b/events/roommessageevent.h
index 219f74f0..27cf5fd8 100644
--- a/events/roommessageevent.h
+++ b/events/roommessageevent.h
@@ -32,11 +32,7 @@ namespace QMatrixClient
namespace MessageEventContent
{
- class Base
- {
- public:
- QString body;
- };
+ class Base { };
}
class RoomMessageEvent: public Event
@@ -47,7 +43,17 @@ namespace QMatrixClient
QString userId() const;
MessageEventType msgtype() const;
+
+ QString plainBody() const;
+
+ /**
+ * Same as plainBody() for now; might change for "best-looking body"
+ * in the future. For richer contents, use content-specific data.
+ *
+ * @deprecated
+ */
QString body() const;
+
QDateTime hsob_ts() const;
MessageEventContent::Base* content() const;