aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-08-29 17:01:06 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-08-29 17:01:06 +0900
commitc02174bc8f09761c2e4ee3ca4a250ce49025343e (patch)
tree87802eb96677409632489d0eae50d892f2cc634f
parentb9423ed655787db3febe5af4f6ff531969e6abb9 (diff)
downloadlibquotient-c02174bc8f09761c2e4ee3ca4a250ce49025343e.tar.gz
libquotient-c02174bc8f09761c2e4ee3ca4a250ce49025343e.zip
RoomTopicEvent: parse and provide sender information
-rw-r--r--events/roomtopicevent.cpp9
-rw-r--r--events/roomtopicevent.h3
2 files changed, 10 insertions, 2 deletions
diff --git a/events/roomtopicevent.cpp b/events/roomtopicevent.cpp
index 5739d85e..7ccfc73c 100644
--- a/events/roomtopicevent.cpp
+++ b/events/roomtopicevent.cpp
@@ -24,6 +24,7 @@ class RoomTopicEvent::Private
{
public:
QString topic;
+ QString senderId;
};
RoomTopicEvent::RoomTopicEvent()
@@ -37,6 +38,11 @@ RoomTopicEvent::~RoomTopicEvent()
delete d;
}
+QString RoomTopicEvent::senderId() const
+{
+ return d->senderId;
+}
+
QString RoomTopicEvent::topic() const
{
return d->topic;
@@ -44,8 +50,9 @@ QString RoomTopicEvent::topic() const
RoomTopicEvent* RoomTopicEvent::fromJson(const QJsonObject& obj)
{
- RoomTopicEvent* e = new RoomTopicEvent();
+ auto e = new RoomTopicEvent();
e->parseJson(obj);
e->d->topic = obj.value("content").toObject().value("topic").toString();
+ e->d->senderId = obj["sender"].toString();
return e;
}
diff --git a/events/roomtopicevent.h b/events/roomtopicevent.h
index 9c27339c..17b10870 100644
--- a/events/roomtopicevent.h
+++ b/events/roomtopicevent.h
@@ -31,6 +31,7 @@ namespace QMatrixClient
RoomTopicEvent();
virtual ~RoomTopicEvent();
+ QString senderId() const;
QString topic() const;
static RoomTopicEvent* fromJson(const QJsonObject& obj);
@@ -41,4 +42,4 @@ namespace QMatrixClient
};
}
-#endif // QMATRIXCLIENT_ROOMTOPICEVENT_H \ No newline at end of file
+#endif // QMATRIXCLIENT_ROOMTOPICEVENT_H