aboutsummaryrefslogtreecommitdiff
path: root/events/roommessageevent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-26 09:00:33 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-26 09:00:33 +0900
commit76bff84a2aa63db677044cc529b910768fa018fa (patch)
treeefeb34e37b436267313169a1790e45a07e8f7fcb /events/roommessageevent.cpp
parent7d506f7bebbcc3b5f8a37589f8fda6fa1e7e1efd (diff)
parent2f83e4be20a15013181c1ba6944e21f051ccac9d (diff)
downloadlibquotient-76bff84a2aa63db677044cc529b910768fa018fa.tar.gz
libquotient-76bff84a2aa63db677044cc529b910768fa018fa.zip
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'events/roommessageevent.cpp')
-rw-r--r--events/roommessageevent.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/events/roommessageevent.cpp b/events/roommessageevent.cpp
index 20e81564..8c088f21 100644
--- a/events/roommessageevent.cpp
+++ b/events/roommessageevent.cpp
@@ -116,6 +116,13 @@ QMimeType RoomMessageEvent::mimeType() const
QMimeDatabase().mimeTypeForName("text/plain");
}
+bool RoomMessageEvent::hasTextContent() const
+{
+ return content() &&
+ (msgtype() == MsgType::Text || msgtype() == MsgType::Emote ||
+ msgtype() == MsgType::Notice); // FIXME: Unbind from specific msgtypes
+}
+
bool RoomMessageEvent::hasFileContent() const
{
return content() && content()->fileInfo();
@@ -159,13 +166,13 @@ void TextContent::fillJson(QJsonObject* json) const
}
LocationContent::LocationContent(const QString& geoUri, const ImageInfo& thumbnail)
- : WithThumbnail(thumbnail), geoUri(geoUri)
+ : geoUri(geoUri), thumbnail(thumbnail)
{ }
LocationContent::LocationContent(const QJsonObject& json)
: TypedBase(json)
- , WithThumbnail(json["info"].toObject())
, geoUri(json["geo_uri"].toString())
+ , thumbnail(json["info"].toObject())
{ }
QMimeType LocationContent::type() const
@@ -177,16 +184,5 @@ void LocationContent::fillJson(QJsonObject* o) const
{
Q_ASSERT(o);
o->insert("geo_uri", geoUri);
- QJsonObject infoJson;
- WithThumbnail::fillInfoJson(&infoJson);
- o->insert("info", infoJson);
-}
-
-WithDuration::WithDuration(const QJsonObject& infoJson)
- : duration(infoJson["duration"].toInt())
-{ }
-
-void WithDuration::fillInfoJson(QJsonObject* infoJson) const
-{
- infoJson->insert("duration", duration);
+ o->insert("info", toInfoJson(thumbnail));
}