aboutsummaryrefslogtreecommitdiff
path: root/events/roommessageevent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-08-24 14:29:54 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-08-24 14:29:54 +0900
commit581a6976eeb7c35930cb19e89eae0fd3bf11a785 (patch)
tree08fedb70dfab49a24bb6855f3c5b52f3b3acc6d2 /events/roommessageevent.cpp
parent958675dccc0a308c02d490d0b246eade0123ce79 (diff)
downloadlibquotient-581a6976eeb7c35930cb19e89eae0fd3bf11a785.tar.gz
libquotient-581a6976eeb7c35930cb19e89eae0fd3bf11a785.zip
Move plain body from Base (former MessageEventContent) inside RoomMessageEvent
According to the spec, this key has the same status as msgtype: both should exist in any message. Besides, it's always supposed to be a plain text so there's no polymorphism allowed here.
Diffstat (limited to 'events/roommessageevent.cpp')
-rw-r--r--events/roommessageevent.cpp10
1 files changed, 8 insertions, 2 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";
}