Skip to content

Commit

Permalink
Fix up RoomPinnedEvent -> RoomPinnedEventsEvent
Browse files Browse the repository at this point in the history
Aside from the ambiguous class name, the previous code was referring to
the wrong event type and looked for the wrong key under content.
  • Loading branch information
KitsuneRal committed Jul 3, 2023
1 parent 94dc332 commit 59e7d29
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Quotient/events/simplestateevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@
#include "single_key_value.h"

namespace Quotient {
#define DEFINE_SIMPLE_STATE_EVENT(Name_, TypeId_, ValueType_, ContentKey_) \
constexpr inline auto Name_##Key = #ContentKey_##_ls; \

#define DEFINE_SIMPLE_STATE_EVENT(Name_, TypeId_, ValueType_, GetterName_, \
JsonKey_) \
constexpr inline auto Name_##Key = JsonKey_##_ls; \
class QUOTIENT_API Name_ \
: public KeylessStateEventBase< \
Name_, EventContent::SingleKeyValue<ValueType_, Name_##Key>> { \
public: \
using value_type = ValueType_; \
QUO_EVENT(Name_, TypeId_) \
using KeylessStateEventBase::KeylessStateEventBase; \
auto ContentKey_() const { return content().value; } \
auto GetterName_() const { return content().value; } \
}; \
// End of macro
// End of macro

DEFINE_SIMPLE_STATE_EVENT(RoomNameEvent, "m.room.name", QString, name)
DEFINE_SIMPLE_STATE_EVENT(RoomTopicEvent, "m.room.topic", QString, topic)
DEFINE_SIMPLE_STATE_EVENT(RoomPinnedEvent, "m.room.pinned_messages",
QStringList, pinnedEvents)
DEFINE_SIMPLE_STATE_EVENT(RoomNameEvent, "m.room.name", QString, name, "name")
DEFINE_SIMPLE_STATE_EVENT(RoomTopicEvent, "m.room.topic", QString, topic,
"topic")
DEFINE_SIMPLE_STATE_EVENT(RoomPinnedEventsEvent, "m.room.pinned_events",
QStringList, pinnedEvents, "pinned")
using RoomPinnedEvent
[[deprecated("RoomPinnedEventsEvent is the new, correct name")]] =
RoomPinnedEventsEvent;

constexpr inline auto RoomAliasesEventKey = "aliases"_ls;
class QUOTIENT_API RoomAliasesEvent
Expand Down

0 comments on commit 59e7d29

Please sign in to comment.