diff --git a/include/mtx/events.hpp b/include/mtx/events.hpp index b5b61d7d1606f9350f69ba2610c928d2576f679d..06e1187b8550affa97ac16534e07f7ebf81d2ecc 100644 --- a/include/mtx/events.hpp +++ b/include/mtx/events.hpp @@ -103,99 +103,7 @@ to_json(json &obj, const Event<Content> &event) { obj["content"] = event.content; obj["sender"] = event.sender; - - switch (event.type) { - case EventType::KeyVerificationStart: - obj["type"] = "m.key.verification.start"; - break; - case EventType::KeyVerificationAccept: - obj["type"] = "m.key.verification.accept"; - break; - case EventType::KeyVerificationMac: - obj["type"] = "m.key.verification.mac"; - break; - case EventType::KeyVerificationKey: - obj["type"] = "m.key.verification.key"; - break; - case EventType::KeyVerificationCancel: - obj["type"] = "m.key.verification.cancel"; - break; - case EventType::KeyVerificationRequest: - obj["type"] = "m.key.verification.request"; - break; - case EventType::Reaction: - obj["type"] = "m.reaction"; - break; - case EventType::RoomKey: - obj["type"] = "m.room_key"; - break; - case EventType::RoomKeyRequest: - obj["type"] = "m.room_key_request"; - break; - case EventType::RoomAliases: - obj["type"] = "m.room.aliases"; - break; - case EventType::RoomAvatar: - obj["type"] = "m.room.avatar"; - break; - case EventType::RoomCanonicalAlias: - obj["type"] = "m.room.canonical_alias"; - break; - case EventType::RoomCreate: - obj["type"] = "m.room.create"; - break; - case EventType::RoomEncrypted: - obj["type"] = "m.room.encrypted"; - break; - case EventType::RoomEncryption: - obj["type"] = "m.room.encryption"; - break; - case EventType::RoomGuestAccess: - obj["type"] = "m.room.guest_access"; - break; - case EventType::RoomHistoryVisibility: - obj["type"] = "m.room.history_visibility"; - break; - case EventType::RoomJoinRules: - obj["type"] = "m.room.join_rules"; - break; - case EventType::RoomMember: - obj["type"] = "m.room.member"; - break; - case EventType::RoomMessage: - obj["type"] = "m.room.message"; - break; - case EventType::RoomName: - obj["type"] = "m.room.name"; - break; - case EventType::RoomPowerLevels: - obj["type"] = "m.room.power_levels"; - break; - case EventType::RoomTopic: - obj["type"] = "m.room.topic"; - break; - case EventType::RoomRedaction: - obj["type"] = "m.room.redaction"; - break; - case EventType::RoomPinnedEvents: - obj["type"] = "m.room.pinned_events"; - break; - case EventType::RoomTombstone: - obj["type"] = "m.room.tombstone"; - break; - case EventType::Sticker: - obj["type"] = "m.sticker"; - break; - case EventType::Tag: - obj["type"] = "m.tag"; - break; - case EventType::PushRules: - obj["type"] = "m.push_rules"; - break; - case EventType::Unsupported: - default: - break; - } + obj["type"] = ::mtx::events::to_string(event.type); } template<class Content>