aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/events/accountdataevents.h3
-rw-r--r--lib/events/directchatevent.h2
-rw-r--r--lib/events/event.cpp2
-rw-r--r--lib/events/receiptevent.cpp2
-rw-r--r--lib/events/receiptevent.h2
-rw-r--r--lib/events/redactionevent.h2
-rw-r--r--lib/events/roomavatarevent.h2
-rw-r--r--lib/events/roommemberevent.h2
-rw-r--r--lib/events/roommessageevent.h2
-rw-r--r--lib/events/simplestateevents.h2
-rw-r--r--lib/events/typingevent.h2
-rw-r--r--lib/jobs/sendeventjob.h2
-rw-r--r--lib/jobs/setroomstatejob.h4
-rw-r--r--lib/room.cpp2
14 files changed, 15 insertions, 16 deletions
diff --git a/lib/events/accountdataevents.h b/lib/events/accountdataevents.h
index f3ba27bb..11667172 100644
--- a/lib/events/accountdataevents.h
+++ b/lib/events/accountdataevents.h
@@ -54,8 +54,7 @@ namespace QMatrixClient
class _Name : public Event \
{ \
public: \
- static constexpr const char* TypeId = _TypeId; \
- static const char* typeId() { return TypeId; } \
+ static constexpr const char* typeId() { return _TypeId; } \
explicit _Name(const QJsonObject& obj) \
: Event((_EnumType), obj) \
, _content(contentJson(), QStringLiteral(#_ContentKey)) \
diff --git a/lib/events/directchatevent.h b/lib/events/directchatevent.h
index 2b0ad0a0..bd8f2d35 100644
--- a/lib/events/directchatevent.h
+++ b/lib/events/directchatevent.h
@@ -29,6 +29,6 @@ namespace QMatrixClient
QMultiHash<QString, QString> usersToDirectChats() const;
- static constexpr const char * TypeId = "m.direct";
+ static constexpr const char* typeId() { return "m.direct"; }
};
}
diff --git a/lib/events/event.cpp b/lib/events/event.cpp
index 57049671..c2b92a50 100644
--- a/lib/events/event.cpp
+++ b/lib/events/event.cpp
@@ -76,7 +76,7 @@ template <typename BaseEventT, typename EventT, typename... EventTs>
inline event_ptr_tt<BaseEventT> makeIfMatches(const QJsonObject& o,
const QString& selector)
{
- if (selector == EventT::TypeId)
+ if (selector == EventT::typeId())
return _impl::create<EventT>(o);
return makeIfMatches<BaseEventT, EventTs...>(o, selector);
diff --git a/lib/events/receiptevent.cpp b/lib/events/receiptevent.cpp
index 7555db82..a12f4c05 100644
--- a/lib/events/receiptevent.cpp
+++ b/lib/events/receiptevent.cpp
@@ -43,7 +43,7 @@ using namespace QMatrixClient;
ReceiptEvent::ReceiptEvent(const QJsonObject& obj)
: Event(Type::Receipt, obj)
{
- Q_ASSERT(obj["type"].toString() == TypeId);
+ Q_ASSERT(obj["type"].toString() == typeId());
const QJsonObject contents = contentJson();
_eventsWithReceipts.reserve(contents.size());
diff --git a/lib/events/receiptevent.h b/lib/events/receiptevent.h
index 5b99ae3f..e1d2d1ec 100644
--- a/lib/events/receiptevent.h
+++ b/lib/events/receiptevent.h
@@ -42,7 +42,7 @@ namespace QMatrixClient
EventsWithReceipts eventsWithReceipts() const
{ return _eventsWithReceipts; }
- static constexpr const char* const TypeId = "m.receipt";
+ static constexpr const char* typeId() { return "m.receipt"; }
private:
EventsWithReceipts _eventsWithReceipts;
diff --git a/lib/events/redactionevent.h b/lib/events/redactionevent.h
index 829b9085..dad54788 100644
--- a/lib/events/redactionevent.h
+++ b/lib/events/redactionevent.h
@@ -25,7 +25,7 @@ namespace QMatrixClient
class RedactionEvent : public RoomEvent
{
public:
- static constexpr const char* const TypeId = "m.room.redaction";
+ static constexpr const char* typeId() { return "m.room.redaction"; }
explicit RedactionEvent(const QJsonObject& obj)
: RoomEvent(Type::Redaction, obj)
diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h
index ccfe8fbf..0e44ad7c 100644
--- a/lib/events/roomavatarevent.h
+++ b/lib/events/roomavatarevent.h
@@ -37,7 +37,7 @@ namespace QMatrixClient
: StateEvent(Type::RoomAvatar, obj)
{ }
- static constexpr const char* TypeId = "m.room.avatar";
+ static constexpr const char* typeId() { return "m.room.avatar"; }
};
} // namespace QMatrixClient
diff --git a/lib/events/roommemberevent.h b/lib/events/roommemberevent.h
index 5f1e578d..8e0cc0a4 100644
--- a/lib/events/roommemberevent.h
+++ b/lib/events/roommemberevent.h
@@ -52,7 +52,7 @@ namespace QMatrixClient
{
Q_GADGET
public:
- static constexpr const char* TypeId = "m.room.member";
+ static constexpr const char* typeId() { return "m.room.member"; }
using MembershipType = MemberEventContent::MembershipType;
diff --git a/lib/events/roommessageevent.h b/lib/events/roommessageevent.h
index a55564ed..dc734b6e 100644
--- a/lib/events/roommessageevent.h
+++ b/lib/events/roommessageevent.h
@@ -65,7 +65,7 @@ namespace QMatrixClient
QJsonObject toJson() const;
- static constexpr const char* TypeId = "m.room.message";
+ static constexpr const char* typeId() { return "m.room.message"; }
private:
QString _msgtype;
diff --git a/lib/events/simplestateevents.h b/lib/events/simplestateevents.h
index 6b0cd51a..d9f403e8 100644
--- a/lib/events/simplestateevents.h
+++ b/lib/events/simplestateevents.h
@@ -28,7 +28,7 @@ namespace QMatrixClient
: public StateEvent<EventContent::SimpleContent<_ContentType>> \
{ \
public: \
- static constexpr const char* TypeId = _TypeId; \
+ static constexpr const char* typeId() { return _TypeId; } \
explicit _Name(const QJsonObject& obj) \
: StateEvent(_EnumType, obj, QStringLiteral(#_ContentKey)) \
{ } \
diff --git a/lib/events/typingevent.h b/lib/events/typingevent.h
index 8c9551a4..6ccbc1c8 100644
--- a/lib/events/typingevent.h
+++ b/lib/events/typingevent.h
@@ -27,7 +27,7 @@ namespace QMatrixClient
class TypingEvent: public Event
{
public:
- static constexpr const char* const TypeId = "m.typing";
+ static constexpr const char* typeId() { return "m.typing"; }
TypingEvent(const QJsonObject& obj);
diff --git a/lib/jobs/sendeventjob.h b/lib/jobs/sendeventjob.h
index 3a11eb6a..a3e9a291 100644
--- a/lib/jobs/sendeventjob.h
+++ b/lib/jobs/sendeventjob.h
@@ -32,7 +32,7 @@ namespace QMatrixClient
SendEventJob(const QString& roomId, const EvT& event)
: BaseJob(HttpVerb::Put, QStringLiteral("SendEventJob"),
QStringLiteral("_matrix/client/r0/rooms/%1/send/%2/")
- .arg(roomId, EvT::TypeId), // See also beforeStart()
+ .arg(roomId, EvT::typeId()), // See also beforeStart()
Query(),
Data(event.toJson()))
{ }
diff --git a/lib/jobs/setroomstatejob.h b/lib/jobs/setroomstatejob.h
index b7e6d4a1..36047667 100644
--- a/lib/jobs/setroomstatejob.h
+++ b/lib/jobs/setroomstatejob.h
@@ -36,7 +36,7 @@ namespace QMatrixClient
const EvT& event)
: BaseJob(HttpVerb::Put, "SetRoomStateJob",
QStringLiteral("_matrix/client/r0/rooms/%1/state/%2/%3")
- .arg(roomId, EvT::TypeId, stateKey),
+ .arg(roomId, EvT::typeId(), stateKey),
Query(),
Data(event.toJson()))
{ }
@@ -48,7 +48,7 @@ namespace QMatrixClient
SetRoomStateJob(const QString& roomId, const EvT& event)
: BaseJob(HttpVerb::Put, "SetRoomStateJob",
QStringLiteral("_matrix/client/r0/rooms/%1/state/%2")
- .arg(roomId, EvT::TypeId),
+ .arg(roomId, EvT::typeId()),
Query(),
Data(event.toJson()))
{ }
diff --git a/lib/room.cpp b/lib/room.cpp
index 6c708a42..f8f195e1 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1774,7 +1774,7 @@ void appendEvent(QJsonArray& events, const QString& type,
template <typename EvtT>
void appendEvent(QJsonArray& events, const EvtT& event)
{
- appendEvent(events, EvtT::TypeId, event.toJson());
+ appendEvent(events, EvtT::typeId(), event.toJson());
}
QJsonObject Room::Private::toJson() const